rpcdb

package
v0.15.15 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package rpcdb provides a meshdb that operates over RPC.

Package rpcdb provides a meshdb that operates over RPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(q Querier) storage.MeshDB

Open opens a new mesh database over a Querier interface.

func OpenKV

func OpenKV(q Querier) storage.MeshStorage

OpenKV opens a new key-value store connection over a Querier interface.

func OpenKVServer

func OpenKVServer(s QueryServer) storage.MeshStorage

OpenKVServer opens a new key-value store connection over a QueryServer interface.

func OpenServer

func OpenServer(s QueryServer) storage.MeshDB

OpenServer opens a new mesh database over a QueryServer interface.

Types

type GraphStore

type GraphStore struct {
	*RPCDataStore
}

GraphStore implements a mesh graph store over a plugin query stream.

func (*GraphStore) AddEdge

func (g *GraphStore) AddEdge(sourceNode, targetNode types.NodeID, edge graph.Edge[types.NodeID]) error

func (*GraphStore) AddVertex

func (g *GraphStore) AddVertex(nodeID types.NodeID, node types.MeshNode, props graph.VertexProperties) error

func (*GraphStore) Edge

func (g *GraphStore) Edge(sourceNode, targetNode types.NodeID) (edge graph.Edge[types.NodeID], err error)

func (*GraphStore) ListEdges

func (g *GraphStore) ListEdges() ([]graph.Edge[types.NodeID], error)

func (*GraphStore) ListVertices

func (g *GraphStore) ListVertices() ([]types.NodeID, error)

func (*GraphStore) RemoveEdge

func (g *GraphStore) RemoveEdge(sourceNode, targetNode types.NodeID) error

func (*GraphStore) RemoveVertex

func (g *GraphStore) RemoveVertex(nodeID types.NodeID) error

func (*GraphStore) Subscribe

func (*GraphStore) UpdateEdge

func (g *GraphStore) UpdateEdge(sourceNode, targetNode types.NodeID, edge graph.Edge[types.NodeID]) error

func (*GraphStore) Vertex

func (g *GraphStore) Vertex(nodeID types.NodeID) (node types.MeshNode, props graph.VertexProperties, err error)

func (*GraphStore) VertexCount

func (g *GraphStore) VertexCount() (int, error)

type KVStorage

type KVStorage struct {
	Querier
}

KVStorage implements a mesh key-value store over a plugin query stream.

func (*KVStorage) Close

func (p *KVStorage) Close() error

func (*KVStorage) Delete

func (p *KVStorage) Delete(ctx context.Context, key []byte) error

func (*KVStorage) GetValue

func (p *KVStorage) GetValue(ctx context.Context, key []byte) ([]byte, error)

GetValue returns the value of a key.

func (*KVStorage) IterPrefix

func (p *KVStorage) IterPrefix(ctx context.Context, prefix []byte, fn storage.PrefixIterator) error

func (*KVStorage) ListKeys

func (p *KVStorage) ListKeys(ctx context.Context, prefix []byte) ([][]byte, error)

func (*KVStorage) PutValue

func (p *KVStorage) PutValue(ctx context.Context, key, value []byte, ttl time.Duration) error

func (*KVStorage) Subscribe

func (p *KVStorage) Subscribe(ctx context.Context, prefix []byte, fn storage.KVSubscribeFunc) (context.CancelFunc, error)

type MeshStateStore

type MeshStateStore struct {
	*RPCDataStore
}

MeshStateStore implements a mesh state store over a plugin query stream.

func (*MeshStateStore) GetMeshState

func (st *MeshStateStore) GetMeshState(ctx context.Context) (types.NetworkState, error)

func (*MeshStateStore) SetMeshState

func (st *MeshStateStore) SetMeshState(ctx context.Context, state types.NetworkState) error

type NetworkingStore

type NetworkingStore struct {
	*RPCDataStore
}

NetworkingStore implements a mesh networking store over a plugin query stream.

func (*NetworkingStore) DeleteNetworkACL

func (nw *NetworkingStore) DeleteNetworkACL(ctx context.Context, name string) error

func (*NetworkingStore) DeleteRoute

func (nw *NetworkingStore) DeleteRoute(ctx context.Context, name string) error

func (*NetworkingStore) GetNetworkACL

func (nw *NetworkingStore) GetNetworkACL(ctx context.Context, name string) (types.NetworkACL, error)

func (*NetworkingStore) GetRoute

func (nw *NetworkingStore) GetRoute(ctx context.Context, name string) (types.Route, error)

func (*NetworkingStore) GetRoutesByCIDR

func (nw *NetworkingStore) GetRoutesByCIDR(ctx context.Context, cidr netip.Prefix) (types.Routes, error)

func (*NetworkingStore) GetRoutesByNode

func (nw *NetworkingStore) GetRoutesByNode(ctx context.Context, nodeID types.NodeID) (types.Routes, error)

func (*NetworkingStore) ListNetworkACLs

func (nw *NetworkingStore) ListNetworkACLs(ctx context.Context) (types.NetworkACLs, error)

func (*NetworkingStore) ListRoutes

func (nw *NetworkingStore) ListRoutes(ctx context.Context) (types.Routes, error)

func (*NetworkingStore) PutNetworkACL

func (nw *NetworkingStore) PutNetworkACL(ctx context.Context, acl types.NetworkACL) error

func (*NetworkingStore) PutRoute

func (nw *NetworkingStore) PutRoute(ctx context.Context, route types.Route) error

type Querier

type Querier interface {
	// Query invokes the query RPC.
	Query(ctx context.Context, query *v1.QueryRequest) (*v1.QueryResponse, error)
}

Querier is an interface for invoking the query RPC.

func QuerierFromServer

func QuerierFromServer(s QueryServer) Querier

QuerierFromServer returns a Querier from a QueryServer.

type QuerierFunc

type QuerierFunc func(ctx context.Context, query *v1.QueryRequest) (*v1.QueryResponse, error)

QuerierFunc is a function that implements the Querier interface.

func (QuerierFunc) Query

func (f QuerierFunc) Query(ctx context.Context, query *v1.QueryRequest) (*v1.QueryResponse, error)

Query invokes the query RPC.

type QueryServer

type QueryServer interface {
	// The underlying gRPC stream.
	grpc.ServerStream
	// Send sends a query request to the plugin.
	Send(*v1.QueryRequest) error
	// Recv receives a query result from the plugin.
	Recv() (*v1.QueryResponse, error)
}

QueryServer is a generic streaming querier interface.

type RBACStore

type RBACStore struct {
	*RPCDataStore
}

RBACStore implements a mesh rbac store over a plugin query stream.

func (*RBACStore) DeleteGroup

func (r *RBACStore) DeleteGroup(ctx context.Context, name string) error

func (*RBACStore) DeleteRole

func (r *RBACStore) DeleteRole(ctx context.Context, name string) error

func (*RBACStore) DeleteRoleBinding

func (r *RBACStore) DeleteRoleBinding(ctx context.Context, name string) error

func (*RBACStore) GetEnabled

func (r *RBACStore) GetEnabled(ctx context.Context) (bool, error)

func (*RBACStore) GetGroup

func (r *RBACStore) GetGroup(ctx context.Context, name string) (types.Group, error)

func (*RBACStore) GetRole

func (r *RBACStore) GetRole(ctx context.Context, name string) (types.Role, error)

func (*RBACStore) GetRoleBinding

func (r *RBACStore) GetRoleBinding(ctx context.Context, name string) (types.RoleBinding, error)

func (*RBACStore) ListGroups

func (r *RBACStore) ListGroups(ctx context.Context) ([]types.Group, error)

func (*RBACStore) ListNodeRoles

func (r *RBACStore) ListNodeRoles(ctx context.Context, nodeID types.NodeID) (types.RolesList, error)

func (*RBACStore) ListRoleBindings

func (r *RBACStore) ListRoleBindings(ctx context.Context) ([]types.RoleBinding, error)

func (*RBACStore) ListRoles

func (r *RBACStore) ListRoles(ctx context.Context) (types.RolesList, error)

func (*RBACStore) ListUserRoles

func (r *RBACStore) ListUserRoles(ctx context.Context, user types.NodeID) (types.RolesList, error)

func (*RBACStore) PutGroup

func (r *RBACStore) PutGroup(ctx context.Context, group types.Group) error

func (*RBACStore) PutRole

func (r *RBACStore) PutRole(ctx context.Context, role types.Role) error

func (*RBACStore) PutRoleBinding

func (r *RBACStore) PutRoleBinding(ctx context.Context, rolebinding types.RoleBinding) error

func (*RBACStore) SetEnabled

func (r *RBACStore) SetEnabled(ctx context.Context, enabled bool) error

type RPCDataStore

type RPCDataStore struct {
	Querier
}

RPCDataStore is a MeshDataStore that operates over RPC.

func (*RPCDataStore) GraphStore

func (pdb *RPCDataStore) GraphStore() storage.GraphStore

GraphStore returns the interface for managing network topology and data about peers.

func (*RPCDataStore) MeshState

func (pdb *RPCDataStore) MeshState() storage.MeshState

MeshState returns the interface for querying mesh state.

func (*RPCDataStore) Networking

func (pdb *RPCDataStore) Networking() storage.Networking

Networking returns the interface for managing networking in the mesh.

func (*RPCDataStore) RBAC

func (pdb *RPCDataStore) RBAC() storage.RBAC

RBAC returns the interface for managing RBAC policies in the mesh.

Jump to

Keyboard shortcuts

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