service

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 18

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

View Source
const (
	TaskTypeRebalance    = TaskType("task-rebalance")
	TaskTypePrepared     = TaskType("task-prepared")
	TaskTypeBucketPause  = TaskType("task-pause-bucket")
	TaskTypeBucketResume = TaskType("task-resume-bucket")
)
View Source
const (
	TaskStatusRunning = TaskStatus("task-running")
	TaskStatusFailed  = TaskStatus("task-failed")

	TaskStatusCannotResume = TaskStatus("task-status-cannot-resume")
)
View Source
const (
	RecoveryTypeFull  = RecoveryType("recovery-full")
	RecoveryTypeDelta = RecoveryType("recovery-delta")
)
View Source
const (
	TopologyChangeTypeRebalance = TopologyChangeType("topology-change-rebalance")
	TopologyChangeTypeFailover  = TopologyChangeType("topology-change-failover")
)

Variables

View Source
var (
	ErrNotFound           = errors.New("not_found")
	ErrConflict           = errors.New("conflict")
	ErrNotSupported       = errors.New("operation_not_supported")
	ErrCanceled           = errors.New("operation_canceled")
	ErrRecoveryImpossible = errors.New("recovery_impossible")
)

Functions

func RegisterManager

func RegisterManager(mgr Manager, errorPolicy revrpc.BabysitErrorPolicy) error

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 Cancel

type Cancel <-chan struct{}

type CancelTaskReq

type CancelTaskReq struct {
	ID  string   `json:"id"`
	Rev Revision `json:"rev,omitempty"`
}

type DefragmentedUtilizationInfo added in v0.1.3

type DefragmentedUtilizationInfo map[string]map[string]interface{}

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 GetCurrentTopologyReq struct {
	Rev     Revision `json:"rev,omitempty"`
	Timeout int64    `json:"timeout,omitempty"`
}

type GetTaskListReq

type GetTaskListReq struct {
	Rev     Revision `json:"rev,omitempty"`
	Timeout int64    `json:"timeout,omitempty"`
}

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 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 NodeID

type NodeID string

type NodeInfo

type NodeInfo struct {
	NodeID   NodeID      `json:"nodeId"`
	Priority Priority    `json:"priority"`
	Opaque   interface{} `json:"opaque"`
}

type PauseParams added in v0.1.4

type PauseParams struct {
	ID                string `json:"id"`
	Bucket            string `json:"bucket"`
	RemotePath        string `json:"remotePath"`
	BlobStorageRegion string `json:"blobStorageRegion"`
	RateLimit         uint64 `json:"rateLimit"`
}

type Priority

type Priority int64

type RecoveryType

type RecoveryType string

type ResumeParams added in v0.1.4

type ResumeParams struct {
	ID                string `json:"id"`
	Bucket            string `json:"bucket"`
	RemotePath        string `json:"remotePath"`
	BlobStorageRegion string `json:"blobStorageRegion"`
	DryRun            bool   `json:"dryRun"`
	RateLimit         uint64 `json:"rateLimit"`
}

type Revision

type Revision []byte

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 TaskList

type TaskList struct {
	Rev   Revision `json:"rev"`
	Tasks []Task   `json:"tasks"`
}

type TaskStatus

type TaskStatus string

type TaskType

type TaskType string

type Topology

type Topology struct {
	Rev   Revision `json:"rev"`
	Nodes []NodeID `json:"nodes"`

	IsBalanced bool     `json:"isBalanced"`
	Messages   []string `json:"messages,omitempty"`
}

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 Void

type Void *struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL