cluster

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0, MIT Imports: 19 Imported by: 0

README

most of the code here has been borrowed from rqlite project which is under MIT
license. LICENSE file is included to roughly cover all rqlite code seen in this
or sub directoris

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CredentialsFor

func CredentialsFor(credStr *auth.CredentialsStore, username string) *v1.Credentials

CredentialsFor returns a Credentials instance for the given username, or nil if the given CredentialsStore is nil, or the username is not found.

Types

type Client

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

Client allows communicating with a remote node.

func NewClient

func NewClient(mgr *connections.Manager) *Client

NewClient returns a client instance for talking to a remote node. Clients will retry certain commands if they fail, to allow for remote node restarts. Cluster management operations such as joining and removing nodes are not retried, to make it clear to the operator that the operation failed. In addition, higher-level code will usually retry these operations.

func (*Client) Aggregate

func (c *Client) Aggregate(ctx context.Context, req *v1.Aggregate_Request, nodeAddr string, creds *v1.Credentials) (*v1.Aggregate_Response, error)

func (*Client) Backup

func (c *Client) Backup(ctx context.Context, w io.Writer, req *v1.Backup_Request, nodeAddr string, creds *v1.Credentials) error

func (*Client) Breakdown

func (c *Client) Breakdown(ctx context.Context, req *v1.BreakDown_Request, nodeAddr string, creds *v1.Credentials) (*v1.BreakDown_Response, error)

func (*Client) GetNodeAPIAddr

func (c *Client) GetNodeAPIAddr(ctx context.Context, nodeAddr string) (string, error)

GetNodeAPIAddr retrieves the API Address for the node at nodeAddr

func (*Client) Join

func (c *Client) Join(ctx context.Context, req *v1.Join_Request, nodeAddr string, creds *v1.Credentials) error

func (*Client) Load

func (c *Client) Load(ctx context.Context, req *v1.Load_Request, nodeAddr string, creds *v1.Credentials) error

func (*Client) Notify

func (c *Client) Notify(ctx context.Context, req *v1.Notify_Request, nodeAddr string, creds *v1.Credentials) error

func (*Client) Realtime

func (c *Client) Realtime(ctx context.Context, req *v1.Realtime_Request, nodeAddr string, creds *v1.Credentials) (*v1.Realtime_Response, error)

func (*Client) RemoveNode

func (c *Client) RemoveNode(ctx context.Context, req *v1.RemoveNode_Request, nodeAddr string, creds *v1.Credentials) error

func (*Client) SendData

func (c *Client) SendData(ctx context.Context, req *v1.Data, nodeAddr string, creds *v1.Credentials) error

func (*Client) Status

func (c *Client) Status() *v1.Status_Cluster

Stats returns stats on the Client instance

func (*Client) Timeseries

func (c *Client) Timeseries(ctx context.Context, req *v1.Timeseries_Request, nodeAddr string, creds *v1.Credentials) (*v1.Timeseries_Response, error)

type CredentialStore

type CredentialStore interface {
	// AA authenticates and checks authorization for the given perm.
	AA(username, password string, perm v1.Credential_Permission) bool
}

CredentialStore is the interface credential stores must support.

type Interceptor

type Interceptor struct {
	CredentialStore
}

func (*Interceptor) Stream

func (c *Interceptor) Stream(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*Interceptor) Unary

func (c *Interceptor) Unary(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

type Klient

type Klient struct {
	*grpc.ClientConn
	v1.InternalCLusterClient
}

type Service

type Service struct {
	v1.UnsafeInternalCLusterServer
	// contains filtered or unexported fields
}

Service provides information about the node and cluster.

func New

func New(db store.Storage) *Service

New returns a new instance of the cluster service

func (*Service) Addr

func (s *Service) Addr() string

Addr returns the address the service is listening on.

func (*Service) Aggregate

func (s *Service) Aggregate(ctx context.Context, req *v1.Aggregate_Request) (*v1.Aggregate_Response, error)

func (*Service) Backup

func (*Service) BreakDown

func (s *Service) BreakDown(ctx context.Context, req *v1.BreakDown_Request) (*v1.BreakDown_Response, error)

func (*Service) Close

func (s *Service) Close() error

Close closes the service.

func (*Service) EnableHTTPS

func (s *Service) EnableHTTPS(b bool)

EnableHTTPS tells the cluster service the API serves HTTPS.

func (*Service) GetAPIAddr

func (s *Service) GetAPIAddr() string

GetAPIAddr returns the previously-set API address

func (*Service) GetNodeAPIURL

func (s *Service) GetNodeAPIURL() string

GetNodeAPIURL returns fully-specified HTTP(S) API URL for the node running this service.

func (*Service) Join

func (s *Service) Join(ctx context.Context, req *v1.Join_Request) (*v1.Join_Response, error)

func (*Service) Load

func (s *Service) Load(ctx context.Context, req *v1.Load_Request) (*emptypb.Empty, error)

func (*Service) NodeAPI

func (s *Service) NodeAPI(ctx context.Context, req *v1.NodeAPIRequest) (*v1.NodeMeta, error)

func (*Service) Notify

func (s *Service) Notify(ctx context.Context, req *v1.Notify_Request) (*emptypb.Empty, error)

func (*Service) Realtime

func (s *Service) Realtime(ctx context.Context, req *v1.Realtime_Request) (*v1.Realtime_Response, error)

func (*Service) RemoveNode

func (s *Service) RemoveNode(ctx context.Context, req *v1.RemoveNode_Request) (*emptypb.Empty, error)

func (*Service) SendData

func (s *Service) SendData(ctx context.Context, req *v1.Data) (*emptypb.Empty, error)

func (*Service) SetAPIAddr

func (s *Service) SetAPIAddr(addr string)

SetAPIAddr sets the API address the cluster service returns.

func (*Service) Timeseries

func (s *Service) Timeseries(ctx context.Context, req *v1.Timeseries_Request) (*v1.Timeseries_Response, error)

Directories

Path Synopsis
Package auth is a lightweight credential store.
Package auth is a lightweight credential store.
url
Package transport provides a Transport for github.com/hashicorp/raft over gRPC.
Package transport provides a Transport for github.com/hashicorp/raft over gRPC.

Jump to

Keyboard shortcuts

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