alexandra

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 17 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 api.ClientClient

	ReadSpeed float32
	// contains filtered or unexported fields
}

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: keygroupTimeout, otherNodesToAsk, getSlowerNodeProb. Please see their documentation.

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 (s *Server) AddReplica(ctx context.Context, req *middleware.AddReplicaRequest) (*middleware.Empty, error)

AddReplica lets the client explicitly add a new replica for a keygroup. In the future, this should happen automatically.

func (*Server) AddTrigger

func (s *Server) AddTrigger(ctx context.Context, req *middleware.AddTriggerRequest) (*middleware.Empty, error)

AddTrigger adds a new trigger to a keygroup.

func (*Server) AddUser

func (s *Server) AddUser(ctx context.Context, req *middleware.UserRequest) (*middleware.Empty, error)

AddUser adds permissions to access a keygroup for a particular user to FReD.

func (*Server) Append

Append appends a new datum to an immutable keygroup in FReD. As data cannot be changed, no versions are necessary. Thus, the request is only passed through to FReD without caching it. FReD's append endpoint requires a unique ID for a datum. ALExANDRA automatically uses a Unix nanosecond timestamp for this.

func (*Server) CreateKeygroup

func (s *Server) CreateKeygroup(ctx context.Context, req *middleware.CreateKeygroupRequest) (*middleware.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

Delete deletes a datum in FReD (it is actually only tombstoned, but this is irrelevant to the middleware or client). This could either be a value that has previously been read (if the datum is in cache) or a spontaneous delete.

If write-follows-read (i.e., datum can be found in cache), all versions of that datum are superseded by the write. The assumption is that the client has merged conflicting values.

If spontaneous delete (i.e., datum cannot be found in cache), we assume an empty vector clock in the cache and send that to FReD. If there is a newer (any) data item in FReD already, this will fail.

func (*Server) DeleteKeygroup

func (s *Server) DeleteKeygroup(ctx context.Context, req *middleware.DeleteKeygroupRequest) (*middleware.Empty, error)

DeleteKeygroup deletes a keygroup from FReD.

func (*Server) GetAllReplica

GetAllReplica returns a list of all FReD nodes. In the future, this API will be removed as ALExANDRA handles data // replication.

func (*Server) GetKeygroupReplica

GetKeygroupReplica returns a list of all FReD nodes that replicate a given keygroup. In the future, this API will be removed as ALExANDRA handles data replication.

func (*Server) GetKeygroupTriggers

GetKeygroupTriggers returns a list of trigger nodes for a keygroup.

func (*Server) GetReplica

GetReplica returns information about a specific FReD node. In the future, this API will be removed as ALExANDRA handles data replication.

func (*Server) Notify added in v0.2.1

Notify notifies the middleware about a version of a datum that the client has seen by bypassing the middleware. This is required to capture external causality.

func (*Server) Read

Read reads a datum from FReD. Read data are placed in cache (if not in there already). If multiple versions of a datum exist, all versions will be returned to the client so that it can choose one. If the read data is outdated compared to seen versions, an error is returned.

func (*Server) RemoveReplica

func (s *Server) RemoveReplica(ctx context.Context, req *middleware.RemoveReplicaRequest) (*middleware.Empty, error)

RemoveReplica lets the client explicitly remove a new replica for a keygroup. In the future, this should happen automatically.

func (*Server) RemoveTrigger

func (s *Server) RemoveTrigger(ctx context.Context, req *middleware.RemoveTriggerRequest) (*middleware.Empty, error)

RemoveTrigger removes a trigger node for a keygroup.

func (*Server) RemoveUser

func (s *Server) RemoveUser(ctx context.Context, req *middleware.UserRequest) (*middleware.Empty, error)

RemoveUser removes permissions to access a keygroup for a particular user from FReD.

func (*Server) Scan

Scan issues a scan request from the client to the middleware. The request is forwarded to FReD and incoming items are checked for their versions by comparing locally cached versions (if any). The local cache is also updated (if applicable).

func (*Server) ServeBlocking

func (s *Server) ServeBlocking()

func (*Server) Update

Update updates a datum in FReD. This could either be a value that has previously been read (if the datum is in cache) or a spontaneous write.

If write-follows-read (i.e., datum can be found in cache), all versions of that datum THAT ARE KNOWN AT THE POINT OF THE UPDATE are superseded by the write. The assumption is that the client has merged conflicting values.

If spontaneous write (i.e., datum cannot be found in cache), we assume an empty vector clock in the cache and send that to FReD. If there is a newer (any) data item in FReD already, this will fail.

Jump to

Keyboard shortcuts

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