state

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package state provides an interface for querying mesh state.

Index

Constants

View Source
const (
	// MeshStatePrefix is the prefix for mesh state keys.
	MeshStatePrefix = "/registry/meshstate"
	// IPv6PrefixKey is the key for the IPv6 prefix.
	IPv6PrefixKey = MeshStatePrefix + "/ipv6prefix"
	// IPv4PrefixKey is the key for the IPv4 prefix.
	IPv4PrefixKey = MeshStatePrefix + "/ipv4prefix"
	// MeshDomainKey is the key for the mesh domain.
	MeshDomainKey = MeshStatePrefix + "/meshdomain"
)

Variables

View Source
var ErrNodeNotFound = sql.ErrNoRows

ErrNodeNotFound is returned when a node is not found.

Functions

This section is empty.

Types

type State

type State interface {
	// GetIPv6Prefix returns the IPv6 prefix.
	GetIPv6Prefix(ctx context.Context) (netip.Prefix, error)
	// GetIPv4Prefix returns the IPv4 prefix.
	GetIPv4Prefix(ctx context.Context) (netip.Prefix, error)
	// GetMeshDomain returns the mesh domain.
	GetMeshDomain(ctx context.Context) (string, error)
	// GetNodePrivateRPCAddress returns the private gRPC address for a node.
	GetNodePrivateRPCAddress(ctx context.Context, nodeID string) (netip.AddrPort, error)
	// ListPublicRPCAddresses returns all public gRPC addresses in the mesh.
	// The map key is the node ID.
	ListPublicRPCAddresses(ctx context.Context) (map[string]netip.AddrPort, error)
	// ListPeerPublicRPCAddresses returns all public gRPC addresses in the mesh excluding a node.
	// The map key is the node ID.
	ListPeerPublicRPCAddresses(ctx context.Context, nodeID string) (map[string]netip.AddrPort, error)
	// ListPeerPrivateRPCAddresses returns all private gRPC addresses in the mesh excluding a node.
	// The map key is the node ID.
	ListPeerPrivateRPCAddresses(ctx context.Context, nodeID string) (map[string]netip.AddrPort, error)
	// ListPublicPeersWithFeature returns all public peers of the given node with the given feature.
	// TODO: Creds are needed because this method calls the peers to get their feature set.
	// This should be replaced with tracking the features in the meshdb.
	ListPublicPeersWithFeature(ctx context.Context, creds []grpc.DialOption, nodeID string, feature v1.Feature) (map[string]netip.AddrPort, error)
}

State is the interface for querying mesh state.

func New

func New(db storage.Storage) State

New returns a new State.

Jump to

Keyboard shortcuts

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