store

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NodeStorePrefix is the kvstore prefix of the shared store
	//
	// WARNING - STABLE API: Changing the structure or values of this will
	// break backwards compatibility
	NodeStorePrefix = path.Join(kvstore.BaseKeyPrefix, "state", "nodes", "v1")

	// KeyCreator creates a node for a shared store
	KeyCreator = func() store.Key {
		n := nodeTypes.Node{}
		return &n
	}

	// NodeRegisterStorePrefix is the kvstore prefix of the shared
	// store for node registration
	//
	// WARNING - STABLE API: Changing the structure or values of this will
	// break backwards compatibility
	NodeRegisterStorePrefix = path.Join(kvstore.BaseKeyPrefix, "state", "noderegister", "v1")

	// RegisterKeyCreator creates a node for a shared store
	RegisterKeyCreator = func() store.Key {
		n := nodeTypes.RegisterNode{}
		return &n
	}
)

Functions

This section is empty.

Types

type NodeManager

type NodeManager interface {
	// NodeUpdated is called when the store detects a change in node
	// information
	NodeUpdated(n nodeTypes.Node)

	// NodeDeleted is called when the store detects a deletion of a node
	NodeDeleted(n nodeTypes.Node)
}

NodeManager is the interface that the manager of nodes has to implement

type NodeObserver

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

NodeObserver implements the store.Observer interface and delegates update and deletion events to the node object itself.

func NewNodeObserver

func NewNodeObserver(manager NodeManager) *NodeObserver

NewNodeObserver returns a new NodeObserver associated with the specified node manager

func (*NodeObserver) OnDelete

func (o *NodeObserver) OnDelete(k store.NamedKey)

func (*NodeObserver) OnUpdate

func (o *NodeObserver) OnUpdate(k store.Key)

type NodeRegistrar

type NodeRegistrar struct {
	*store.SharedStore
	// contains filtered or unexported fields
}

NodeRegistrar is a wrapper around store.SharedStore.

func (*NodeRegistrar) JoinCluster

func (nr *NodeRegistrar) JoinCluster(name string) (*nodeTypes.Node, error)

JoinCluster registers the local node in the cluster. Blocks until timeout occurs or an updated Node is received from the kv-store and returns it. Otherwise this does not block and returns nil.

func (*NodeRegistrar) RegisterNode

func (nr *NodeRegistrar) RegisterNode(n *nodeTypes.Node, manager NodeManager) error

RegisterNode registers the local node in the cluster.

func (*NodeRegistrar) UpdateLocalKeySync

func (nr *NodeRegistrar) UpdateLocalKeySync(n *nodeTypes.Node) error

UpdateLocalKeySync synchronizes the local key for the node using the SharedStore.

type RegisterObserver

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

RegisterObserver implements the store.Observer interface and sends named node's identity updates on a channel.

func NewRegisterObserver

func NewRegisterObserver(name string, updateChan chan *nodeTypes.RegisterNode) *RegisterObserver

NewRegisterObserver returns a new RegisterObserver

func (*RegisterObserver) OnDelete

func (o *RegisterObserver) OnDelete(k store.NamedKey)

func (*RegisterObserver) OnUpdate

func (o *RegisterObserver) OnUpdate(k store.Key)

Jump to

Keyboard shortcuts

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