Documentation
¶
Index ¶
- Variables
- func ClusterIDValidator(clusterID *uint32) nodeValidator
- func ClusterNameValidator(clusterName string) nodeValidator
- func NameValidator() nodeValidator
- func ValidatingKeyCreator(validators ...nodeValidator) store.KeyCreator
- type NodeExtendedManager
- type NodeManager
- type NodeObserver
- type NodeRegistrar
- type ValidatingNode
Constants ¶
This section is empty.
Variables ¶
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 } )
Functions ¶
func ClusterIDValidator ¶ added in v1.16.0
func ClusterIDValidator(clusterID *uint32) nodeValidator
ClusterIDValidator returns a validator enforcing that the cluster ID of the unmarshaled node matches the provided one. The access to the provided clusterID value is not synchronized, and it shall not be mutated concurrently.
func ClusterNameValidator ¶ added in v1.16.0
func ClusterNameValidator(clusterName string) nodeValidator
ClusterNameValidator returns a validator enforcing that the cluster field of the unmarshaled node matches the provided one.
func NameValidator ¶ added in v1.16.0
func NameValidator() nodeValidator
NameValidator returns a validator enforcing that the name of the the unmarshaled node matches the kvstore key.
func ValidatingKeyCreator ¶ added in v1.16.0
func ValidatingKeyCreator(validators ...nodeValidator) store.KeyCreator
ValidatingKeyCreator returns a store.KeyCreator for Nodes, configuring the specified extra validators.
Types ¶
type NodeExtendedManager ¶ added in v1.16.0
type NodeExtendedManager interface {
NodeManager
// NodeSync is called when the store completes the initial nodes listing
NodeSync()
}
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, source source.Source) *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 {
}
NodeRegistrar is a wrapper around store.SharedStore.
func (*NodeRegistrar) RegisterNode ¶
func (nr *NodeRegistrar) RegisterNode(ctx context.Context, logger *slog.Logger, client kvstore.Client, n *nodeTypes.Node, manager NodeExtendedManager) error
RegisterNode registers the local node in the cluster.
func (*NodeRegistrar) UpdateLocalKeySync ¶
UpdateLocalKeySync synchronizes the local key for the node using the SharedStore.
type ValidatingNode ¶ added in v1.16.0
ValidatingNode wraps a Node to perform additional validation at unmarshal time.