kvstore

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBucketName = "nodes"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeStore

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

func NewNodeStore

func NewNodeStore(ctx context.Context, params NodeStoreParams) (*NodeStore, error)

func (*NodeStore) Add

func (n *NodeStore) Add(ctx context.Context, nodeInfo models.NodeInfo) error

Add adds a node info to the repo.

func (*NodeStore) Delete

func (n *NodeStore) Delete(ctx context.Context, nodeID string) error

Delete deletes a node info from the repo.

func (*NodeStore) FindPeer

func (n *NodeStore) FindPeer(ctx context.Context, peerID peer.ID) (peer.AddrInfo, error)

func (*NodeStore) Get

func (n *NodeStore) Get(ctx context.Context, nodeID string) (models.NodeInfo, error)

Get returns the node info for the given node ID.

func (*NodeStore) GetByPrefix

func (n *NodeStore) GetByPrefix(ctx context.Context, prefix string) (models.NodeInfo, error)

GetByPrefix returns the node info for the given node ID. Supports both full and short node IDs band currently iterates through all of the keys to find matches, due to NATS KVStore not supporting prefix searches (yet).

func (*NodeStore) List

func (n *NodeStore) List(ctx context.Context, filters ...routing.NodeInfoFilter) ([]models.NodeInfo, error)

List returns a list of nodes

type NodeStoreParams

type NodeStoreParams struct {
	BucketName string
	Client     *nats.Conn
}

Jump to

Keyboard shortcuts

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