alexandra

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// UseSlowerNodeProb In how many percent of the cases: instead of using the fastest client, use a random client to update its readSpeed
	// only used for Read,Write,Delete,Append (since these are the only operations that update the readSpeed)
	UseSlowerNodeProb = 0.089
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client fredClients.ClientClient

	ReadSpeed float32
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host, certFile, keyFile string) *Client

func (*Client) AddReplica

func (c *Client) AddReplica(ctx context.Context, keygroup string, nodeID string, expiry int64) (*fredClients.StatusResponse, error)

func (*Client) AddTrigger

func (c *Client) AddTrigger(ctx context.Context, keygroup string, triggerID string, triggerHost string) (*fredClients.StatusResponse, error)

func (*Client) AddUser

func (c *Client) AddUser(ctx context.Context, user, keygroup string, role fredClients.UserRole) (*fredClients.StatusResponse, error)

func (*Client) Append

func (c *Client) Append(ctx context.Context, keygroup string, data string) (*fredClients.AppendResponse, error)

Append also updates the moving average item speed

func (*Client) CreateKeygroup

func (c *Client) CreateKeygroup(ctx context.Context, keygroup string, mutable bool, expiry int64) (*fredClients.StatusResponse, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, keygroup string, id string) (*fredClients.StatusResponse, error)

Delete also updates the moving average item speed

func (*Client) DeleteKeygroup

func (c *Client) DeleteKeygroup(ctx context.Context, keygroup string) (*fredClients.StatusResponse, error)

func (*Client) GetAllReplica

func (c *Client) GetAllReplica(ctx context.Context) (*fredClients.GetAllReplicaResponse, error)

func (*Client) GetKeygroupReplica

func (c *Client) GetKeygroupReplica(ctx context.Context, keygroup string) (*fredClients.GetKeygroupReplicaResponse, error)

func (*Client) GetKeygroupTriggers

func (c *Client) GetKeygroupTriggers(ctx context.Context, keygroup string) (*fredClients.GetKeygroupTriggerResponse, error)

func (*Client) GetReplica

func (c *Client) GetReplica(ctx context.Context, nodeID string) (*fredClients.GetReplicaResponse, error)

func (*Client) Read

func (c *Client) Read(ctx context.Context, keygroup string, id string) (*fredClients.ReadResponse, error)

Read also updates the moving average item speed

func (*Client) RemoveReplica

func (c *Client) RemoveReplica(ctx context.Context, keygroup string, nodeID string) (*fredClients.StatusResponse, error)

func (*Client) RemoveTrigger

func (c *Client) RemoveTrigger(ctx context.Context, keygroup, triggerID string) (*fredClients.StatusResponse, error)

func (*Client) RemoveUser

func (c *Client) RemoveUser(ctx context.Context, user, keygroup string, role fredClients.UserRole) (*fredClients.StatusResponse, error)

func (*Client) Update

func (c *Client) Update(ctx context.Context, keygroup string, id string, data string) (*fredClients.StatusResponse, error)

Update also updates the moving average item speed

type ClientsMgr

type ClientsMgr struct {
	// Mutex for the keygroups map, because it might be changed while iterated over
	sync.Mutex
	// contains filtered or unexported fields
}

ClientsMgr manages all Clients to Fred that Alexandra has. Is used to get fastest clients to keygroups etc. and to read from anywhere there are 3 variables important for this configuration: keygruopTimeout, otherNodesToAsk, getSlowerNodeProb. Please see their documentation.

func NewClientsManager

func NewClientsManager(clientsCert, clientsKey, lighthouse string) *ClientsMgr

func (*ClientsMgr) GetClientTo

func (m *ClientsMgr) GetClientTo(host string) (client *Client)

GetClientTo returns a client with this address

func (*ClientsMgr) GetFastestClient

func (m *ClientsMgr) GetFastestClient() (client *Client)

GetFastestClient searches for the fastest of the already existing clients

func (*ClientsMgr) GetFastestClientWithKeygroup

func (m *ClientsMgr) GetFastestClientWithKeygroup(keygroup string, expiry int64) (client *Client, err error)

GetFastestClientWithKeygroup returns the fastest client that has the keygroup with an expiry bigger than the parameter set expiry to 1 to get any client, 0=no expiry

func (*ClientsMgr) GetRandomClientWithKeygroup

func (m *ClientsMgr) GetRandomClientWithKeygroup(keygroup string, expiry int64) (client *Client, err error)

func (*ClientsMgr) ReadFromAnywhere

func (m *ClientsMgr) ReadFromAnywhere(ctx context.Context, request *alexandraProto.ReadRequest) (*alexandraProto.ReadResponse, error)

type Server

type Server struct {
	*grpc.Server
	// contains filtered or unexported fields
}

Server listens to GRPC requests from clients (and sends them to the relevant Fred Node etc.) The implementation is split up into different files in this folder.

func NewServer

func NewServer(host string, caCert string, serverCert string, serverKey string, nodesCert string, nodesKey string, lighthouse string, isProxied bool, proxyHost string) *Server

NewServer creates a new Server for requests from Alexandra Clients

func (*Server) AddReplica

func (*Server) AddTrigger

func (*Server) AddUser

func (s *Server) AddUser(ctx context.Context, request *alexandraProto.UserRequest) (*alexandraProto.Empty, error)

func (*Server) Append

func (*Server) CreateKeygroup

func (s *Server) CreateKeygroup(ctx context.Context, request *alexandraProto.CreateKeygroupRequest) (*alexandraProto.Empty, error)

CreateKeygroup creates the keygroup and also adds the first node (This is two operations in the eye of FReD: CreateKeygroup and AddReplica)

func (*Server) Delete

func (*Server) DeleteKeygroup

func (s *Server) DeleteKeygroup(ctx context.Context, request *alexandraProto.DeleteKeygroupRequest) (*alexandraProto.Empty, error)

func (*Server) Read

func (*Server) RemoveReplica

func (s *Server) RemoveReplica(ctx context.Context, request *alexandraProto.RemoveReplicaRequest) (*alexandraProto.Empty, error)

func (*Server) RemoveTrigger

func (s *Server) RemoveTrigger(ctx context.Context, request *alexandraProto.RemoveTriggerRequest) (*alexandraProto.Empty, error)

func (*Server) RemoveUser

func (s *Server) RemoveUser(ctx context.Context, request *alexandraProto.UserRequest) (*alexandraProto.Empty, error)

func (*Server) Scan

func (*Server) ServeBlocking

func (s *Server) ServeBlocking()

func (*Server) Update

Jump to

Keyboard shortcuts

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