etcdv3

package
v0.0.0-...-06bcc1c Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mercury

type Mercury struct {
	meta.KV
	// contains filtered or unexported fields
}

Mercury means store with etcdv3

func New

func New(config types.Config, t *testing.T) (m *Mercury, err error)

New for create a Mercury instance

func (*Mercury) AddNode

func (m *Mercury) AddNode(ctx context.Context, opts *types.AddNodeOptions) (*types.Node, error)

AddNode save it to etcd storage path in etcd is `/pod/nodes/:podname/:nodename` node->pod path in etcd is `/node/pod/:nodename` func (m *Mercury) AddNode(ctx context.Context, name, endpoint, podname, ca, cert, key string, cpu, share int, memory, storage int64, labels map[string]string, numa types.NUMA, numaMemory types.NUMAMemory, volume types.VolumeMap) (*types.Node, error) {

func (*Mercury) AddPod

func (m *Mercury) AddPod(ctx context.Context, name, desc string) (*types.Pod, error)

AddPod add a pod save it to etcd storage path in etcd is `/pod/info/:podname`

func (Mercury) AddWorkload

func (m Mercury) AddWorkload(ctx context.Context, workload *types.Workload, processing *types.Processing) error

AddWorkload add a workload mainly record its relationship on pod and node actually if we already know its node, we will know its pod but we still store it storage path in etcd is `/workload/:workloadid`

func (*Mercury) CreateProcessing

func (m *Mercury) CreateProcessing(ctx context.Context, processing *types.Processing, count int) error

CreateProcessing save processing status in etcd

func (*Mercury) DeleteProcessing

func (m *Mercury) DeleteProcessing(ctx context.Context, processing *types.Processing) error

DeleteProcessing delete processing status in etcd

func (*Mercury) GetAllPods

func (m *Mercury) GetAllPods(ctx context.Context) ([]*types.Pod, error)

GetAllPods get all pods in etcd any error will break and return error immediately storage path in etcd is `/pod`

func (*Mercury) GetDeployStatus

func (m *Mercury) GetDeployStatus(ctx context.Context, appname, entryname string) (map[string]int, error)

GetDeployStatus get deploy status from store

func (*Mercury) GetNode

func (m *Mercury) GetNode(ctx context.Context, nodename string) (*types.Node, error)

GetNode get node by name

func (*Mercury) GetNodeStatus

func (m *Mercury) GetNodeStatus(ctx context.Context, nodename string) (*types.NodeStatus, error)

GetNodeStatus returns status for a node

func (*Mercury) GetNodes

func (m *Mercury) GetNodes(ctx context.Context, nodenames []string) ([]*types.Node, error)

GetNodes get nodes

func (*Mercury) GetNodesByPod

func (m *Mercury) GetNodesByPod(ctx context.Context, nodeFilter *types.NodeFilter, opts ...store.Option) ([]*types.Node, error)

GetNodesByPod get all nodes bound to pod here we use podname instead of pod instance

func (*Mercury) GetPod

func (m *Mercury) GetPod(ctx context.Context, name string) (*types.Pod, error)

GetPod get a pod from etcd storage path in etcd is `/pod/info/:podname`

func (*Mercury) GetWorkload

func (m *Mercury) GetWorkload(ctx context.Context, ID string) (*types.Workload, error)

GetWorkload get a workload workload if must be in full length, or we can't find it in etcd storage path in etcd is `/workload/:workloadid`

func (*Mercury) GetWorkloadStatus

func (m *Mercury) GetWorkloadStatus(ctx context.Context, ID string) (*types.StatusMeta, error)

GetWorkloadStatus get workload status

func (*Mercury) GetWorkloads

func (m *Mercury) GetWorkloads(ctx context.Context, IDs []string) (workloads []*types.Workload, err error)

GetWorkloads get many workloads

func (*Mercury) ListNodeWorkloads

func (m *Mercury) ListNodeWorkloads(ctx context.Context, nodename string, labels map[string]string) ([]*types.Workload, error)

ListNodeWorkloads list workloads belong to one node

func (*Mercury) ListWorkloads

func (m *Mercury) ListWorkloads(ctx context.Context, appname, entrypoint, nodename string, limit int64, labels map[string]string) ([]*types.Workload, error)

ListWorkloads list workloads

func (*Mercury) LoadNodeCert

func (m *Mercury) LoadNodeCert(ctx context.Context, node *types.Node) (err error)

func (*Mercury) NodeStatusStream

func (m *Mercury) NodeStatusStream(ctx context.Context) chan *types.NodeStatus

NodeStatusStream returns a stream of node status it tells you if status of a node is changed, either PUT or DELETE PUT -> Alive: true DELETE -> Alive: false

func (*Mercury) RegisterService

func (m *Mercury) RegisterService(ctx context.Context, serviceAddress string, expire time.Duration) (<-chan struct{}, func(), error)

RegisterService put /services/{address}

func (*Mercury) RemoveNode

func (m *Mercury) RemoveNode(ctx context.Context, node *types.Node) error

RemoveNode delete a node

func (*Mercury) RemovePod

func (m *Mercury) RemovePod(ctx context.Context, podname string) error

RemovePod if the pod has no nodes left, otherwise return an error

func (*Mercury) RemoveWorkload

func (m *Mercury) RemoveWorkload(ctx context.Context, workload *types.Workload) error

RemoveWorkload remove a workload workload ID must be in full length

func (*Mercury) ServiceStatusStream

func (m *Mercury) ServiceStatusStream(ctx context.Context) (chan []string, error)

ServiceStatusStream watches /services/ --prefix

func (*Mercury) SetNodeStatus

func (m *Mercury) SetNodeStatus(ctx context.Context, node *types.Node, ttl int64) error

SetNodeStatus sets status for a node, value will expire after ttl seconds ttl < 0 means to delete node status this is heartbeat of node

func (*Mercury) SetWorkloadStatus

func (m *Mercury) SetWorkloadStatus(ctx context.Context, status *types.StatusMeta, ttl int64) error

SetWorkloadStatus set workload status

func (*Mercury) UpdateNodes

func (m *Mercury) UpdateNodes(ctx context.Context, nodes ...*types.Node) error

UpdateNodes .

func (*Mercury) UpdateWorkload

func (m *Mercury) UpdateWorkload(ctx context.Context, workload *types.Workload) error

UpdateWorkload update a workload

func (*Mercury) WorkloadStatusStream

func (m *Mercury) WorkloadStatusStream(ctx context.Context, appname, entrypoint, nodename string, labels map[string]string) chan *types.WorkloadStatus

WorkloadStatusStream watch deployed status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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