etcdstore

package
v0.0.0-...-1a62c48 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Krypton

type Krypton struct {
	// contains filtered or unexported fields
}

Krypton means store with etcd

func New

func New(config types.Config) (*Krypton, error)

New for create a krypton instance

func (*Krypton) AddContainer

func (k *Krypton) AddContainer(ctx context.Context, container *types.Container) error

AddContainer add a container 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 `/container/:containerid`

func (*Krypton) AddNode

func (k *Krypton) AddNode(ctx context.Context, name, endpoint, podname, ca, cert, key string, cpu, share int, memory int64, labels map[string]string) (*types.Node, error)

AddNode save it to etcd storage path in etcd is `/pod/:podname/node/:nodename/info`

func (*Krypton) AddPod

func (k *Krypton) AddPod(ctx context.Context, name, favor, desc string) (*types.Pod, error)

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

func (*Krypton) CleanContainerData

func (k *Krypton) CleanContainerData(ctx context.Context, ID, appname, entrypoint, nodename string) error

CleanContainerData clean container data

func (*Krypton) ContainerDeployed

func (k *Krypton) ContainerDeployed(ctx context.Context, ID, appname, entrypoint, nodename, data string) error

ContainerDeployed store deployed container info

func (*Krypton) CreateLock

func (k *Krypton) CreateLock(key string, ttl int) (lock.DistributedLock, error)

CreateLock create a lock instance

func (*Krypton) DeleteNode

func (k *Krypton) DeleteNode(ctx context.Context, node *types.Node)

DeleteNode delete a node

func (*Krypton) GetAllNodes

func (k *Krypton) GetAllNodes(ctx context.Context) (nodes []*types.Node, err error)

GetAllNodes get all nodes from etcd any error will break and return immediately

func (*Krypton) GetAllPods

func (k *Krypton) GetAllPods(ctx context.Context) (pods []*types.Pod, err error)

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

func (*Krypton) GetContainer

func (k *Krypton) GetContainer(ctx context.Context, ID string) (*types.Container, error)

GetContainer get a container container if must be in full length, or we can't find it in etcd storage path in etcd is `/container/:containerid`

func (*Krypton) GetContainers

func (k *Krypton) GetContainers(ctx context.Context, IDs []string) (containers []*types.Container, err error)

GetContainers get many containers

func (*Krypton) GetNode

func (k *Krypton) GetNode(ctx context.Context, podname, nodename string) (*types.Node, error)

GetNode get a node from etcd and construct it's docker client a node must belong to a pod and since node is not the smallest unit to user, to get a node we must specify the corresponding pod storage path in etcd is `/pod/:podname/node/:nodename/info`

func (*Krypton) GetNodeByName

func (k *Krypton) GetNodeByName(ctx context.Context, nodename string) (node *types.Node, err error)

GetNodeByName get node by name

func (*Krypton) GetNodesByPod

func (k *Krypton) GetNodesByPod(ctx context.Context, podname string) (nodes []*types.Node, err error)

GetNodesByPod get all nodes bound to pod here we use podname instead of pod instance storage path in etcd is `/pod/:podname/node`

func (*Krypton) GetPod

func (k *Krypton) GetPod(ctx context.Context, name string) (*types.Pod, error)

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

func (*Krypton) ListContainers

func (k *Krypton) ListContainers(ctx context.Context, appname, entrypoint, nodename string) ([]*types.Container, error)

ListContainers list containers

func (*Krypton) ListNodeContainers

func (k *Krypton) ListNodeContainers(ctx context.Context, nodename string) ([]*types.Container, error)

ListNodeContainers list containers belong to one node

func (*Krypton) MakeDeployStatus

func (k *Krypton) MakeDeployStatus(ctx context.Context, opts *types.DeployOptions, nodesInfo []types.NodeInfo) ([]types.NodeInfo, error)

MakeDeployStatus get deploy status from store

func (*Krypton) RemoveContainer

func (k *Krypton) RemoveContainer(ctx context.Context, container *types.Container) error

RemoveContainer remove a container container id must be in full length

func (*Krypton) RemovePod

func (k *Krypton) RemovePod(ctx context.Context, podname string) error

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

func (*Krypton) UpdateNode

func (k *Krypton) UpdateNode(ctx context.Context, node *types.Node) error

UpdateNode update a node, save it to etcd storage path in etcd is `/pod/:podname/node/:nodename/info`

func (*Krypton) UpdateNodeResource

func (k *Krypton) UpdateNodeResource(ctx context.Context, podname, nodename string, cpu types.CPUMap, mem int64, action string) error

UpdateNodeResource update cpu and mem on a node, either add or substract need to lock

func (*Krypton) WatchDeployStatus

func (k *Krypton) WatchDeployStatus(appname, entrypoint, nodename string) etcdclient.Watcher

WatchDeployStatus watch deployed status

Jump to

Keyboard shortcuts

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