Documentation
¶
Overview ¶
@author Couchbase <info@couchbase.com> @copyright 2015 Couchbase, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@author Couchbase <info@couchbase.com> @copyright 2015 Couchbase, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func RegisterManager(mgr Manager, errorPolicy revrpc.BabysitErrorPolicy) error
- func RegisterManagerWithCompletionCallback(mgr Manager, errorPolicy revrpc.BabysitErrorPolicy, ...) error
- type AutofailoverManager
- type BucketConfigParams
- type BucketConfigValidationError
- type BucketConfigValidationSuccess
- type BucketConfigurationManager
- type BucketValidationResult
- type Cancel
- type CancelTaskReq
- type DefragmentedUtilizationInfo
- type DefragmentedUtilizationReply
- type GetCurrentTopologyReq
- type GetTaskListReq
- type HealthInfo
- type HibernationManager
- type InfoManager
- type Manager
- type NodeID
- type NodeInfo
- type PauseParams
- type Priority
- type RecoveryType
- type ResumeParams
- type Revision
- type ServerlessManager
- type Task
- type TaskList
- type TaskStatus
- type TaskType
- type Topology
- type TopologyChange
- type TopologyChangeType
- type ValidateBucketConfigParams
- type Void
Constants ¶
const ( TaskTypeRebalance = TaskType("task-rebalance") TaskTypePrepared = TaskType("task-prepared") TaskTypeBucketPause = TaskType("task-pause-bucket") TaskTypeBucketResume = TaskType("task-resume-bucket") )
const ( TaskStatusRunning = TaskStatus("task-running") TaskStatusFailed = TaskStatus("task-failed") TaskStatusCannotResume = TaskStatus("task-status-cannot-resume") )
const ( RecoveryTypeFull = RecoveryType("recovery-full") RecoveryTypeDelta = RecoveryType("recovery-delta") )
const ( TopologyChangeTypeRebalance = TopologyChangeType("topology-change-rebalance") TopologyChangeTypeFailover = TopologyChangeType("topology-change-failover") )
Variables ¶
Functions ¶
func RegisterManager ¶
func RegisterManager(mgr Manager, errorPolicy revrpc.BabysitErrorPolicy) error
Register the manager with ns_server. This blocks the current execution context. See also RegisterManagerWithCompletionCallback.
func RegisterManagerWithCompletionCallback ¶ added in v0.1.18
func RegisterManagerWithCompletionCallback(mgr Manager, errorPolicy revrpc.BabysitErrorPolicy, serviceSetupCallback func() error) error
See RegisterManager. Invokes the passed serviceSetupCallback function when the ServiceAPI has been registered. This can be used by services to determine when it is safe to continue bootstrapping if said bootstrapping requires use of ns_server APIs that in turn require use of the ServiceAPI.
Types ¶
type AutofailoverManager ¶
type AutofailoverManager interface {
// returns HealthInfo if the service considers itself overall
// healthy and error otherwise
HealthCheck() (*HealthInfo, error)
// returns nil if the auto failover is safe from the service
// perspective for the NodeID's passed, and error otherwise
IsSafe(nodeUUIDs []NodeID) error
}
type BucketConfigParams ¶ added in v0.1.14
type BucketConfigValidationError ¶ added in v0.1.14
type BucketConfigValidationSuccess ¶ added in v0.1.14
type BucketConfigurationManager ¶ added in v0.1.14
type BucketConfigurationManager interface {
ValidateBucketConfig(ValidateBucketConfigParams) (*BucketValidationResult, error)
}
If registering a BucketConfigurationManager, note that ValidateBucketConfig will be called in various ns_server REST APIs. As such, care should be taken to:
- Not require any API calling this (`/pools/default/buckets` etc) to bootstrap before registering the ServiceAPI
- Reduce the time spent taken in this call - a parameter `JustReturnParams` is set on the read/GET path such that heavy validation actions can be skipped when not necessary.
type BucketValidationResult ¶ added in v0.1.14
type BucketValidationResult struct {
// Result should map to the same format given by memcached.
// Named and included as a sub-field of the result such that we can add
// to this payload if ever we need to in the future.
//
// The mapped type should be either BucketConfigValidationSuccess or
// BucketConfigValidationError.
Result map[string]any `json:"validationResult"`
}
type CancelTaskReq ¶
type DefragmentedUtilizationInfo ¶ added in v0.1.3
type DefragmentedUtilizationReply ¶ added in v0.1.3
type DefragmentedUtilizationReply struct {
Info *DefragmentedUtilizationInfo
}
For some strange reason golang jsonrpc doesn't allow to return any marshallable type except struct. So we have to wrap map returned by the service into structure to deal with this peculiarity.
type GetCurrentTopologyReq ¶
type GetTaskListReq ¶
type HealthInfo ¶
type HealthInfo struct {
// number of the disk failures encountered since the
// start of the service executable
DiskFailures int `json:"diskFailures"`
}
type HibernationManager ¶ added in v0.1.4
type HibernationManager interface {
PreparePause(params PauseParams) error
Pause(params PauseParams) error
PrepareResume(params ResumeParams) error
Resume(params ResumeParams) error
}
type InfoManager ¶ added in v0.1.13
type InfoManager interface {
GetParams() *map[string]interface{}
}
type Manager ¶
type Manager interface {
GetNodeInfo() (*NodeInfo, error)
Shutdown() error
GetTaskList(rev Revision, cancel Cancel) (*TaskList, error)
CancelTask(id string, rev Revision) error
GetCurrentTopology(rev Revision, cancel Cancel) (*Topology, error)
PrepareTopologyChange(change TopologyChange) error
StartTopologyChange(change TopologyChange) error
}
type PauseParams ¶ added in v0.1.4
type RecoveryType ¶
type RecoveryType string
type ResumeParams ¶ added in v0.1.4
type ServerlessManager ¶ added in v0.1.3
type ServerlessManager interface {
// returns projected utilization stats if the service would
// be defragmented
GetDefragmentedUtilization() (*DefragmentedUtilizationInfo, error)
}
type Task ¶
type Task struct {
Rev Revision `json:"rev"`
ID string `json:"id"`
Type TaskType `json:"type"`
Status TaskStatus `json:"status"`
IsCancelable bool `json:"isCancelable"`
Progress float64 `json:"progress"`
DetailedProgress map[NodeID]float64 `json:"detailedProgress,omitempty"`
Description string `json:"description,omitempty"`
ErrorMessage string `json:"errorMessage,omitempty"`
Extra map[string]interface{} `json:"extra"`
}
type TaskStatus ¶
type TaskStatus string
type TopologyChange ¶
type TopologyChange struct {
ID string `json:"id"`
CurrentTopologyRev Revision `json:"currentTopologyRev"`
Type TopologyChangeType `json:"type"`
KeepNodes []struct {
NodeInfo NodeInfo `json:"nodeInfo"`
RecoveryType RecoveryType `json:"recoveryType"`
} `json:"keepNodes"`
EjectNodes []NodeInfo `json:"ejectNodes"`
}
type TopologyChangeType ¶
type TopologyChangeType string
type ValidateBucketConfigParams ¶ added in v0.1.17
type ValidateBucketConfigParams struct {
// Parsed form of BucketConfigParams.Config
ParsedParams map[string]string
JustReturnParams bool
}
See BucketConfigParams for additional info.