Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultHTTPClient() *http.Client
- func IsBadRequest(err error) bool
- func IsInternalServer(err error) bool
- func IsNotFound(err error) bool
- func IsPreconditionFailed(err error) bool
- func IsServiceUnavailable(err error) bool
- func IsStatusError(err error) (int, bool)
- func IsStatusErrorWithCode(err error, code int) bool
- func NewBadRequestError(msg string) error
- func NewInternalServerError(msg string) error
- func NewNotFoundError(msg string) error
- func NewPreconditionFailedError(msg string) error
- func NewServiceUnavailableError(msg string) error
- func ParseResponseError(r *http.Response, body []byte) error
- type API
- type DatabaseVersionResponse
- type EndpointList
- type ErrorResponse
- type GoodbyeRequest
- type IDInfo
- type ProcessList
- type ServerProcess
- type ServerType
- type StatusError
- type UpgradeStatus
- type UpgradeStatusServer
- type VersionInfo
Constants ¶
const ( ServerTypeCoordinator = ServerType("coordinator") ServerTypeDBServer = ServerType("dbserver") ServerTypeAgent = ServerType("agent") ServerTypeSingle = ServerType("single") )
Variables ¶
var ( StatusError{StatusCode: http.StatusServiceUnavailable, /* contains filtered or unexported fields */} // BadRequestError indicates invalid arguments. BadRequestError = StatusError{StatusCode: http.StatusBadRequest, /* contains filtered or unexported fields */} // PreconditionFailedError indicates that the state of the system is such that the request cannot be executed. PreconditionFailedError = StatusError{StatusCode: http.StatusPreconditionFailed, /* contains filtered or unexported fields */} // InternalServerError indicates an unspecified error inside the server, perhaps a bug. InternalServerError = StatusError{StatusCode: http.StatusInternalServerError, /* contains filtered or unexported fields */} )ServiceUnavailableError =
Functions ¶
func DefaultHTTPClient ¶
DefaultHTTPClient creates a new HTTP client configured for accessing a starter.
func IsBadRequest ¶
IsBadRequest returns true if the given error is caused by a BadRequestError.
func IsInternalServer ¶
IsInternalServer returns true if the given error is caused by a InternalServerError.
func IsNotFound ¶
IsNotFound returns true if the given error is caused by a NotFoundError.
func IsPreconditionFailed ¶
IsPreconditionFailed returns true if the given error is caused by a PreconditionFailedError.
func IsServiceUnavailable ¶
IsServiceUnavailable returns true if the given error is caused by a ServiceUnavailableError.
func IsStatusError ¶
IsStatusError returns the status code and true if the given error is caused by a StatusError.
func IsStatusErrorWithCode ¶
IsStatusErrorWithCode returns true if the given error is caused by a StatusError with given code.
func NewBadRequestError ¶
NewBadRequestError creates a bad request error with given message.
func NewInternalServerError ¶
NewInternalServerError creates a internal server error with given message.
func NewNotFoundError ¶
NewNotFoundError creates a not found error with given message.
func NewPreconditionFailedError ¶
NewPreconditionFailedError creates a precondition failed error with given message.
func NewServiceUnavailableError ¶
NewServiceUnavailableError creates a service unavailable error with given message.
Types ¶
type API ¶
type API interface { // ID requests the starters ID. ID(ctx context.Context) (IDInfo, error) // Version requests the starter version. Version(ctx context.Context) (VersionInfo, error) // DatabaseVersion returns the version of the `arangod` binary that is being // used by this starter. DatabaseVersion(ctx context.Context) (driver.Version, error) // Processes loads information of all the database server processes launched by the starter. Processes(ctx context.Context) (ProcessList, error) // Endpoints loads the URL's needed to reach all starters, agents & coordinators in the cluster. Endpoints(ctx context.Context) (EndpointList, error) // Shutdown will shutdown a starter (and all its started database servers). // With goodbye set, it will remove the peer slot for the starter. Shutdown(ctx context.Context, goodbye bool) error // RemovePeer removes a peer with given ID from the starter cluster. // The removal tries to cleanout & properly shutdown servers first. // If that does not succeed, the operation returns an error, // unless force is set to true. RemovePeer(ctx context.Context, id string, force bool) error // StartDatabaseUpgrade is called to start the upgrade process StartDatabaseUpgrade(ctx context.Context, forceMinorUpgrade bool) error // RetryDatabaseUpgrade resets a failure mark in the existing upgrade plan // such that the starters will retry the upgrade once more. RetryDatabaseUpgrade(ctx context.Context) error // AbortDatabaseUpgrade removes the existing upgrade plan. // Note that Starters working on an entry of the upgrade // will finish that entry. // If there is no plan, a NotFoundError will be returned. AbortDatabaseUpgrade(ctx context.Context) error // UpgradeStatus returns the status of any upgrade plan UpgradeStatus(context.Context) (UpgradeStatus, error) Inventory(ctx context.Context) (api.Inventory, error) ClusterInventory(ctx context.Context) (api.ClusterInventory, error) AdminJWTRefresh(ctx context.Context) (api.Empty, error) AdminJWTActivate(ctx context.Context, token string) (api.Empty, error) }
API is the interface implemented by the starter's HTTP API's.
type DatabaseVersionResponse ¶
DatabaseVersionResponse is the JSON response of a `/database-version` request.
type EndpointList ¶
type EndpointList struct { Starters []string `json:"starters,omitempty"` // List of URL's to all starter APIs Agents []string `json:"agents,omitempty"` // List of URL's to all agents (database servers) in the cluster Coordinators []string `json:"coordinators,omitempty"` // List of URL's to all coordinators (database servers) in the cluster }
EndpointList is the JSON response of a `/endpoints` request. It contains URL's of all starters, agents & coordinators in the cluster.
type ErrorResponse ¶
type ErrorResponse struct {
Error string
}
ErrorResponse is the JSON structure returned in an API error.
type GoodbyeRequest ¶
type GoodbyeRequest struct {
SlaveID string // Unique ID of the slave that should be removed.
}
GoodbyeRequest is the JSON structure send in the request to /goodbye.
type ProcessList ¶
type ProcessList struct { ServersStarted bool `json:"servers-started,omitempty"` // True if the server have all been started Servers []ServerProcess `json:"servers,omitempty"` // List of servers started by the starter }
ProcessList is the JSON response of a `/process` request.
func (ProcessList) ServerByType ¶
func (list ProcessList) ServerByType(serverType ServerType) (ServerProcess, bool)
ServerByType returns the server of given type. If no such server process is found, false is returned.
type ServerProcess ¶
type ServerProcess struct { Type ServerType `json:"type"` // agent | coordinator | dbserver IP string `json:"ip"` // IP address needed to reach the server Port int `json:"port"` // Port needed to reach the server ProcessID int `json:"pid,omitempty"` // PID of the process (0 when running in docker) ContainerID string `json:"container-id,omitempty"` // ID of docker container running the server ContainerIP string `json:"container-ip,omitempty"` // IP address of docker container running the server IsSecure bool `json:"is-secure,omitempty"` // If set, this server is using an SSL connection }
ServerProcess holds all information of a single server started by the starter.
func (*ServerProcess) GetEndpoint ¶
func (s *ServerProcess) GetEndpoint() string
GetEndpoint return address endpoint to the server.
type StatusError ¶
type StatusError struct { StatusCode int // contains filtered or unexported fields }
StatusError is an error with a given HTTP status code.
func (StatusError) Error ¶
func (e StatusError) Error() string
type UpgradeStatus ¶
type UpgradeStatus struct { // Ready is set to true when the entire upgrade has been finished succesfully. Ready bool `json:"ready"` // Failed is set to true when the upgrade process has yielded an error Failed bool `json:"failed"` // Reasons contains a human readable description of the state Reason string `json:"reason,omitempty"` // FromVersions contains all database versions found that will be upgraded. FromVersions []driver.Version `json:"from_versions"` // ToVersion contains the database version that will be upgraded to. ToVersion driver.Version `json:"to_version"` // ServersUpgraded contains the servers that have been upgraded ServersUpgraded []UpgradeStatusServer `json:"servers_upgraded"` // ServersRemaining contains the servers that have not yet been upgraded ServersRemaining []UpgradeStatusServer `json:"servers_remaining"` }
UpgradeStatus is the JSON structure returns from a `GET /database-auto-upgrade` request.
type UpgradeStatusServer ¶
type UpgradeStatusServer struct { // Type of the server Type ServerType `json:"type"` // Port the server is listening on Port int `json:"port"` // Address of the server (IP or hostname) Address string `json:"address"` }
UpgradeStatusServer is the nested JSON structure returns from a `GET /database-auto-upgrade` request.
type VersionInfo ¶
VersionInfo is the JSON response of a `/version` request.