Documentation ¶
Overview ¶
Package passthrough provides a passthrough storage provider. This is intended to be used by nodes that don't host their own storage, but need to query the storage of other nodes.
Index ¶
- type Consensus
- func (p *Consensus) AddObserver(context.Context, *v1.StoragePeer) error
- func (p *Consensus) AddVoter(context.Context, *v1.StoragePeer) error
- func (p *Consensus) DemoteVoter(context.Context, *v1.StoragePeer) error
- func (p *Consensus) GetLeader(context.Context) (*v1.StoragePeer, error)
- func (p *Consensus) GetPeer(context.Context, string) (*v1.StoragePeer, error)
- func (p *Consensus) GetPeers(context.Context) ([]*v1.StoragePeer, error)
- func (p *Consensus) IsLeader() bool
- func (p *Consensus) IsMember() bool
- func (p *Consensus) RemovePeer(ctx context.Context, peer *v1.StoragePeer, wait bool) error
- type GraphStore
- func (g *GraphStore) AddEdge(sourceNode, targetNode types.NodeID, edge graph.Edge[types.NodeID]) error
- func (g *GraphStore) AddVertex(nodeID types.NodeID, node types.MeshNode, props graph.VertexProperties) error
- func (g *GraphStore) Edge(sourceNode, targetNode types.NodeID) (edge graph.Edge[types.NodeID], err error)
- func (g *GraphStore) ListEdges() ([]graph.Edge[types.NodeID], error)
- func (g *GraphStore) ListVertices() ([]types.NodeID, error)
- func (g *GraphStore) RemoveEdge(sourceNode, targetNode types.NodeID) error
- func (g *GraphStore) RemoveVertex(nodeID types.NodeID) error
- func (g *GraphStore) Subscribe(ctx context.Context, fn storage.PeerSubscribeFunc) (context.CancelFunc, error)
- func (g *GraphStore) UpdateEdge(sourceNode, targetNode types.NodeID, edge graph.Edge[types.NodeID]) error
- func (g *GraphStore) Vertex(nodeID types.NodeID) (node types.MeshNode, props graph.VertexProperties, err error)
- func (g *GraphStore) VertexCount() (int, error)
- type MeshDataStore
- type NetworkingStore
- func (nw *NetworkingStore) DeleteNetworkACL(ctx context.Context, name string) error
- func (nw *NetworkingStore) DeleteRoute(ctx context.Context, name string) error
- func (nw *NetworkingStore) GetNetworkACL(ctx context.Context, name string) (types.NetworkACL, error)
- func (nw *NetworkingStore) GetRoute(ctx context.Context, name string) (types.Route, error)
- func (nw *NetworkingStore) GetRoutesByCIDR(ctx context.Context, cidr netip.Prefix) (types.Routes, error)
- func (nw *NetworkingStore) GetRoutesByNode(ctx context.Context, nodeID types.NodeID) (types.Routes, error)
- func (nw *NetworkingStore) ListNetworkACLs(ctx context.Context) (types.NetworkACLs, error)
- func (nw *NetworkingStore) ListRoutes(ctx context.Context) (types.Routes, error)
- func (nw *NetworkingStore) PutNetworkACL(ctx context.Context, acl types.NetworkACL) error
- func (nw *NetworkingStore) PutRoute(ctx context.Context, route types.Route) error
- type Options
- type Provider
- func (p *Provider) Bootstrap(ctx context.Context) error
- func (p *Provider) Close() error
- func (p *Provider) Consensus() storage.Consensus
- func (p *Provider) ListenPort() uint16
- func (p *Provider) MeshDB() storage.MeshDB
- func (p *Provider) MeshStorage() storage.MeshStorage
- func (p *Provider) Start(ctx context.Context) error
- func (p *Provider) Status() *v1.StorageStatus
- type RBACStore
- func (r *RBACStore) DeleteGroup(ctx context.Context, name string) error
- func (r *RBACStore) DeleteRole(ctx context.Context, name string) error
- func (r *RBACStore) DeleteRoleBinding(ctx context.Context, name string) error
- func (r *RBACStore) GetEnabled(ctx context.Context) (bool, error)
- func (r *RBACStore) GetGroup(ctx context.Context, name string) (types.Group, error)
- func (r *RBACStore) GetRole(ctx context.Context, name string) (types.Role, error)
- func (r *RBACStore) GetRoleBinding(ctx context.Context, name string) (types.RoleBinding, error)
- func (r *RBACStore) ListGroups(ctx context.Context) ([]types.Group, error)
- func (r *RBACStore) ListNodeRoles(ctx context.Context, nodeID types.NodeID) (types.RolesList, error)
- func (r *RBACStore) ListRoleBindings(ctx context.Context) ([]types.RoleBinding, error)
- func (r *RBACStore) ListRoles(ctx context.Context) (types.RolesList, error)
- func (r *RBACStore) ListUserRoles(ctx context.Context, user types.NodeID) (types.RolesList, error)
- func (r *RBACStore) PutGroup(ctx context.Context, group types.Group) error
- func (r *RBACStore) PutRole(ctx context.Context, role types.Role) error
- func (r *RBACStore) PutRoleBinding(ctx context.Context, rolebinding types.RoleBinding) error
- func (r *RBACStore) SetEnabled(ctx context.Context, enabled bool) error
- type StateStore
- func (st *StateStore) GetIPv4Prefix(ctx context.Context) (netip.Prefix, error)
- func (st *StateStore) GetIPv6Prefix(ctx context.Context) (netip.Prefix, error)
- func (st *StateStore) GetMeshDomain(ctx context.Context) (string, error)
- func (st *StateStore) GetMeshState(ctx context.Context) (types.NetworkState, error)
- func (st *StateStore) SetIPv4Prefix(ctx context.Context, prefix netip.Prefix) error
- func (st *StateStore) SetIPv6Prefix(ctx context.Context, prefix netip.Prefix) error
- func (st *StateStore) SetMeshDomain(ctx context.Context, domain string) error
- type Storage
- func (p *Storage) Close() error
- func (p *Storage) Delete(ctx context.Context, key []byte) error
- func (p *Storage) GetValue(ctx context.Context, key []byte) ([]byte, error)
- func (p *Storage) IterPrefix(ctx context.Context, prefix []byte, fn storage.PrefixIterator) error
- func (p *Storage) ListKeys(ctx context.Context, prefix []byte) ([][]byte, error)
- func (p *Storage) PutValue(ctx context.Context, key, value []byte, ttl time.Duration) error
- func (p *Storage) Subscribe(ctx context.Context, prefix []byte, fn storage.KVSubscribeFunc) (context.CancelFunc, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consensus ¶
type Consensus struct {
*Provider
}
PassthroughConsensus is a consensus provider that returns an error for all write operations.
func (*Consensus) AddObserver ¶
AddObserver adds an observer to the consensus group.
func (*Consensus) DemoteVoter ¶
DemoteVoter demotes a voter to an observer.
func (*Consensus) RemovePeer ¶
RemovePeer removes a peer from the consensus group. If wait is true, the function will wait for the peer to be removed.
type GraphStore ¶ added in v0.12.0
type GraphStore struct {
*MeshDataStore
}
GraphStore is a passthrough graph store that uses the storage API to field read requests.
func (*GraphStore) AddVertex ¶ added in v0.12.0
func (g *GraphStore) AddVertex(nodeID types.NodeID, node types.MeshNode, props graph.VertexProperties) error
func (*GraphStore) ListVertices ¶ added in v0.12.0
func (g *GraphStore) ListVertices() ([]types.NodeID, error)
func (*GraphStore) RemoveEdge ¶ added in v0.12.0
func (g *GraphStore) RemoveEdge(sourceNode, targetNode types.NodeID) error
func (*GraphStore) RemoveVertex ¶ added in v0.12.0
func (g *GraphStore) RemoveVertex(nodeID types.NodeID) error
func (*GraphStore) Subscribe ¶ added in v0.12.0
func (g *GraphStore) Subscribe(ctx context.Context, fn storage.PeerSubscribeFunc) (context.CancelFunc, error)
func (*GraphStore) UpdateEdge ¶ added in v0.12.0
func (*GraphStore) Vertex ¶ added in v0.12.0
func (g *GraphStore) Vertex(nodeID types.NodeID) (node types.MeshNode, props graph.VertexProperties, err error)
func (*GraphStore) VertexCount ¶ added in v0.12.0
func (g *GraphStore) VertexCount() (int, error)
type MeshDataStore ¶ added in v0.12.0
type MeshDataStore struct {
// contains filtered or unexported fields
}
MeshDataStore is a passthrough data store that uses the storage API to field read requests.
func NewMeshDataStore ¶ added in v0.12.0
func NewMeshDataStore(dialer transport.NodeDialer) *MeshDataStore
NewMeshDataStore creates a new passthrough data store.
func (*MeshDataStore) GraphStore ¶ added in v0.12.0
func (mdb *MeshDataStore) GraphStore() storage.GraphStore
GraphStore returns the interface for managing network topology and data about peers.
func (*MeshDataStore) MeshState ¶ added in v0.12.0
func (mdb *MeshDataStore) MeshState() storage.MeshState
MeshState returns the interface for querying mesh state.
func (*MeshDataStore) Networking ¶ added in v0.12.0
func (mdb *MeshDataStore) Networking() storage.Networking
Networking returns the interface for managing networking in the mesh.
func (*MeshDataStore) RBAC ¶ added in v0.12.0
func (mdb *MeshDataStore) RBAC() storage.RBAC
RBAC returns the interface for managing RBAC policies in the mesh.
type NetworkingStore ¶ added in v0.12.0
type NetworkingStore struct {
*MeshDataStore
}
NetworkingStore is a passthrough networking store that uses the storage API to field read requests.
func (*NetworkingStore) DeleteNetworkACL ¶ added in v0.12.0
func (nw *NetworkingStore) DeleteNetworkACL(ctx context.Context, name string) error
func (*NetworkingStore) DeleteRoute ¶ added in v0.12.0
func (nw *NetworkingStore) DeleteRoute(ctx context.Context, name string) error
func (*NetworkingStore) GetNetworkACL ¶ added in v0.12.0
func (nw *NetworkingStore) GetNetworkACL(ctx context.Context, name string) (types.NetworkACL, error)
func (*NetworkingStore) GetRoutesByCIDR ¶ added in v0.12.0
func (*NetworkingStore) GetRoutesByNode ¶ added in v0.12.0
func (*NetworkingStore) ListNetworkACLs ¶ added in v0.12.0
func (nw *NetworkingStore) ListNetworkACLs(ctx context.Context) (types.NetworkACLs, error)
func (*NetworkingStore) ListRoutes ¶ added in v0.12.0
func (*NetworkingStore) PutNetworkACL ¶ added in v0.12.0
func (nw *NetworkingStore) PutNetworkACL(ctx context.Context, acl types.NetworkACL) error
type Options ¶
type Options struct { // NodeID is the ID of the node. NodeID string // Dialer is the dialer to use for connecting to other nodes. Dialer transport.NodeDialer // LogLevel is the log level to use. LogLevel string // LogFormat is the log format to use. LogFormat string }
Options are the passthrough options.
type Provider ¶
type Provider struct { Options // contains filtered or unexported fields }
Provider is a storage provider that passes through all storage operations to another node in the cluster.
func NewProvider ¶
NewProvider returns a new passthrough storage provider.
func (*Provider) ListenPort ¶
func (*Provider) MeshStorage ¶
func (p *Provider) MeshStorage() storage.MeshStorage
func (*Provider) Status ¶
func (p *Provider) Status() *v1.StorageStatus
type RBACStore ¶ added in v0.12.0
type RBACStore struct {
*MeshDataStore
}
RBACStore is a passthrough RBAC store that uses the storage API to field read requests.
func (*RBACStore) DeleteGroup ¶ added in v0.12.0
func (*RBACStore) DeleteRole ¶ added in v0.12.0
func (*RBACStore) DeleteRoleBinding ¶ added in v0.12.0
func (*RBACStore) GetEnabled ¶ added in v0.12.0
func (*RBACStore) GetRoleBinding ¶ added in v0.12.0
func (*RBACStore) ListGroups ¶ added in v0.12.0
func (*RBACStore) ListNodeRoles ¶ added in v0.12.0
func (*RBACStore) ListRoleBindings ¶ added in v0.12.0
func (*RBACStore) ListUserRoles ¶ added in v0.12.0
func (*RBACStore) PutRoleBinding ¶ added in v0.12.0
type StateStore ¶ added in v0.12.0
type StateStore struct {
*MeshDataStore
}
StateStore is a passthrough state store that uses the storage API to field read requests.
func (*StateStore) GetIPv4Prefix ¶ added in v0.12.0
func (*StateStore) GetIPv6Prefix ¶ added in v0.12.0
func (*StateStore) GetMeshDomain ¶ added in v0.12.0
func (st *StateStore) GetMeshDomain(ctx context.Context) (string, error)
func (*StateStore) GetMeshState ¶ added in v0.12.0
func (st *StateStore) GetMeshState(ctx context.Context) (types.NetworkState, error)
func (*StateStore) SetIPv4Prefix ¶ added in v0.12.0
func (*StateStore) SetIPv6Prefix ¶ added in v0.12.0
func (*StateStore) SetMeshDomain ¶ added in v0.12.0
func (st *StateStore) SetMeshDomain(ctx context.Context, domain string) error
type Storage ¶
type Storage struct {
*Provider
}
func (*Storage) IterPrefix ¶
IterPrefix iterates over all keys with a given prefix. It is important that the iterator not attempt any write operations as this will cause a deadlock.