Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

REST Entities

Randgalt edited this page Sep 19, 2012 · 22 revisions

All Exhibitor entities are received/returned as JSON.

Result

Many Exhibitor APIs return a Result to indicate success or failure.

{
    "succeeded": boolean,
    "message": string,  // Any error message if succeeded is false
}

NameAndModifiedDate

{
    "name": string,      // the file/index name
    "modifiedDate": long // an epoch
}

State

{
    "version": string,           // Exhibitor version
    "running": boolean,          // is the ZooKeeper instance running
    "config": Config             // Shared Configuration (see the Config entity)
    
    // ... other values as needed ...
}

Config

{
    "rollInProgress": boolean,            // is a rolling config change in progress
    "rollStatus": string,                 // The status of the rolling config change
    "rollPercentDone": int,
    "hostname": string,                   // The hostname of this machine (not really a shared value but still returned here)
    "serverId": int,                      // The ZooKeeper Server Id configured for this instance or -1
    "logIndexDirectory": string,          // Path to store indexed logs
    "zookeeperInstallDirectory": string,
    "zookeeperDataDirectory": string,
    "serversSpec": string,                // List of servers in the ensemble (see below for syntax)
    "backupExtra": string,                // URL encoded values used for backing-up
    "zooCfgExtra": string,                // URL encoded values to add to zoo.cfg file
    "clientPort": int,                    // ZK client port (usually 2181)
    "connectPort": int,                   // ZK connect port (usually 2888)
    "electionPort": int,                  // ZK election port (usually 3888)
    "checkMs": int,                       // How often to poll the ZK instance (in milliseconds)
    "cleanPeriodMs": int,                 // Period in ms to perform log cleanup
    "cleanupMaxFiles": int,               // Value to pass to PurgeTxnLog as max
    "backupMaxStoreMs": int,              // Max age to save backups (in milliseconds)
    "backupPeriodMs": int                 // Period in ms to perform backups
}

“serversSpec” is a comma separated list of servers in the form: <type>:<id>:<hostname>. The type is optional but can be “S” for standard (the default) or “O” for an observer.

Index

{
    "name": string,    // index name
    "from": string,    // from date (formatted)
    "to": string,      // to date (formatted)
    "entryCount": int  // number of entries in the index
}

NewIndexRequest

{
    type: string,      // index type: see below for values
    value: string,     // type->value: see below for values
    backup: NameAndModifiedDate
}

This entity controls backup/restore/etc.

type value
“backup” n/a Starts the indexing of a specified backup. The “backup” parameter specifies the backup to index.
“default” n/a Starts a backup of the current set of ZooKeeper log files
“path” Path to a ZooKeeper log file Starts a backup of the specified log file

SearchId

{
    id: string     // the Id
}

SearchRequest

{
    indexName: string,    // Name of the index to search
    pathPrefix: string,   // null or partial ZooKeeper path to search
    firstDate: date,      // null or the beginning date for the search
    secondDate: date,     // null or the ending date for the search
    operationType: int,   // -1 or type of ZooKeeper operation (see below)
    reuseHandle: string,  // if an existing search, the search Id
    maxResults: int       // the maximum results to return
}
operationType ZK Operation
0 Create-Persistent
1 Create-Ephemeral
2 Delete
3 Set Data

SearchResult

{
    docId: int,           // Lucene DocId
    type: int,            // Operation type (see above)
    path: string,         // ZK Path
    date: string,         // Formatted date of operation
    dataAsString: string, // The node payload as a string
    dataBytes: string     // The node payload as hex
}

ClusterState

{
    switches: ClusterSwitches,
    state: int,                 // State code: see below
    description: string         // State description
}
state
0 LATENT
1 DOWN
2 NOT_SERVING
3 SERVING

ServerStatus

{
    hostname: the server's hostname,
    state: int,                 // State code: see below
    description: string         // State description
}
state
0 LATENT
1 DOWN
2 NOT_SERVING
3 SERVING

ClusterSwitches

{
    "restarts": boolean,         // true if instance restarts are on
    "unlistedRestarts": boolean, // true if unlisted instance restarts are on
    "cleanup": boolean,          // true if the cleanup task is on
    "backups": boolean           // true if the backup task is on
}

Servers

{
    "servers": string[],       // array of server hostnames
    "port": int                // the ZooKeeper client port
}

PathAnalysisRequest

{
    "max": int,               // path for the lock. Either the parent path or one of the lock ZNodes
    "path": string            // max locks for this path. i.e. a mutex has a max of 1, a semaphore has a max of 1 - n.
}

PathAnalysisNode

{
    "path": string,          // the analyzed path 
    "max": int,              // the max locks for the path
    "childIds": string[]     // Array of process IDs of the path. The first "max" IDs are deemed to own the lock.
}

IdList

{
    "ids": string[]      // Array of process IDs
}

PathAnalysis

{
    "error": string,                // any analysis errors or an empty string
    "nodes": PathAnalysisNode[],    // the nodes/paths that were analyzed
    "possibleCycles": IdList[]      // Array potential deadlocks. Lists the nodes/paths and process IDs involved in the deadlock.
}

UsageListingRequest

{
    "maxChildrenForTraversal": int,  // Paths with this many child or greater will not be traversed
    "startPath": string              // Path to start at
}
Clone this wiki locally