Documentation ¶
Index ¶
- func GetAuthHeader(token string) req.Headers
- type ClientInfo
- type ClientState
- type CommandQueue
- type CommandQueueItem
- type CoreCompatibility
- type DefaultRequest
- type DefaultResponse
- type FetchResponse
- type HelloRequest
- type HelloResponse
- type InfoRequest
- type InfoResponse
- type MasterCommand
- type MasterCommandInfo
- type MasterInfo
- type Method
- type PullResponse
- type PushRequest
- type ReplicationInfo
- type ReplicationResponse
- type ResponseStatus
- type StatsInfo
- type StatsResponse
- type StatusCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthHeader ¶
GetAuthHeader return API authentication header
Types ¶
type ClientInfo ¶
type ClientState ¶
type ClientState uint8
const ( STATE_UNKNOWN ClientState = iota STATE_ONLINE STATE_POSSIBLE_DOWN STATE_DOWN STATE_SYNCING STATE_DEAD )
func (ClientState) String ¶
func (s ClientState) String() string
String returns string representation of client status
type CommandQueue ¶
type CommandQueue struct { Items []*CommandQueueItem `json:"items"` // Items with actions ModTime int64 `json:"mod_time"` // Time of latest action }
CommandQueue is command queue
type CommandQueueItem ¶
type CommandQueueItem struct { Command MasterCommand `json:"command"` InstanceID int `json:"instance_id"` InstanceUUID string `json:"instance_uuid"` Timestamp int64 `json:"timestamp"` }
type CoreCompatibility ¶
type CoreCompatibility uint8
const ( CORE_COMPAT_OK CoreCompatibility = iota CORE_COMPAT_PARTIAL CORE_COMPAT_ERROR )
type DefaultRequest ¶
type DefaultRequest struct {
CID string `json:"cid"`
}
type DefaultResponse ¶
type DefaultResponse struct {
Status ResponseStatus `json:"status"`
}
type FetchResponse ¶
type FetchResponse struct { Instances []*CORE.InstanceInfo `json:"instances"` Status ResponseStatus `json:"status"` }
type HelloRequest ¶
type HelloResponse ¶
type HelloResponse struct { Status ResponseStatus `json:"status"` Version string `json:"version"` CID string `json:"cid"` Auth *CORE.SuperuserAuth `json:"auth"` SentinelWorks bool `json:"sentinel_works"` }
type InfoRequest ¶
type InfoResponse ¶
type InfoResponse struct { Status ResponseStatus `json:"status"` Info *CORE.InstanceInfo `json:"info"` }
type MasterCommand ¶
type MasterCommand string
const ( COMMAND_CREATE MasterCommand = "create" COMMAND_DESTROY MasterCommand = "destroy" COMMAND_EDIT MasterCommand = "edit" COMMAND_START MasterCommand = "start" COMMAND_STOP MasterCommand = "stop" COMMAND_RESTART MasterCommand = "restart" COMMAND_START_ALL MasterCommand = "start-all" COMMAND_STOP_ALL MasterCommand = "stop-all" COMMAND_RESTART_ALL MasterCommand = "restart-all" COMMAND_SENTINEL_START MasterCommand = "sentinel-start" COMMAND_SENTINEL_STOP MasterCommand = "sentinel-stop" )
type MasterCommandInfo ¶
type MasterCommandInfo struct { Command MasterCommand `json:"command"` ID int `json:"id"` UUID string `json:"uuid"` }
type MasterInfo ¶
type PullResponse ¶
type PullResponse struct { Commands []*CommandQueueItem `json:"commands"` Status ResponseStatus `json:"status"` }
type PushRequest ¶
type PushRequest struct { Command MasterCommand `json:"command"` ID int `json:"id"` UUID string `json:"uuid"` }
type ReplicationInfo ¶
type ReplicationInfo struct { Master *MasterInfo `json:"master"` Clients []*ClientInfo `json:"clients"` SuppliantCID string `json:"suppliant_cid,omitempty"` }
type ReplicationResponse ¶
type ReplicationResponse struct { Status ResponseStatus `json:"status"` Info *ReplicationInfo `json:"info"` }
type ResponseStatus ¶
type ResponseStatus struct { Desc string `json:"desc"` Code StatusCode `json:"code"` }
type StatsResponse ¶
type StatsResponse struct { Status ResponseStatus `json:"status"` Stats *StatsInfo `json:"stats"` }
type StatusCode ¶
type StatusCode uint8
const ( STATUS_OK StatusCode = 0 STATUS_WRONG_REQUEST StatusCode = 1 STATUS_WRONG_AUTH_TOKEN StatusCode = 2 STATUS_UNKNOWN_CLIENT StatusCode = 3 STATUS_WRONG_METHOD StatusCode = 4 STATUS_WRONG_ARGS StatusCode = 5 STATUS_INCORRECT_REQUEST StatusCode = 6 STATUS_UNKNOWN_INSTANCE StatusCode = 7 STATUS_INCOMPATIBLE_CORE_VERSION StatusCode = 8 STATUS_UNKNOWN_ERROR StatusCode = 99 )
Click to show internal directories.
Click to hide internal directories.