alexandra

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 13 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 Middleware added in v0.2.3

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

Middleware 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 NewMiddleware added in v0.2.3

func NewMiddleware(nodesCert string, nodesKey string, caCert string, lighthouse string, isProxied bool, proxyHost string, experimental bool, skipVerify bool) *Middleware

NewMiddleware creates a new Middleware for requests from Alexandra Clients

func (*Middleware) AddReplica added in v0.2.3

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

func (*Middleware) AddTrigger added in v0.2.3

AddTrigger adds a new trigger to a keygroup.

func (*Middleware) AddUser added in v0.2.3

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

func (*Middleware) Append added in v0.2.3

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 (*Middleware) ChooseReplica added in v0.2.3

ChooseReplica allows a client to choose a particular note to send requests to for a keygroup. This will override the fastest node if exists

func (*Middleware) CreateKeygroup added in v0.2.3

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

func (*Middleware) Delete added in v0.2.3

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 (*Middleware) DeleteKeygroup added in v0.2.3

DeleteKeygroup deletes a keygroup from FReD.

func (*Middleware) GetAllReplica added in v0.2.3

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

func (*Middleware) GetKeygroupInfo added in v0.2.3

GetKeygroupInfo 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 (*Middleware) GetKeygroupTriggers added in v0.2.3

GetKeygroupTriggers returns a list of trigger nodes for a keygroup.

func (*Middleware) GetReplica added in v0.2.3

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

func (*Middleware) Notify added in v0.2.3

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 (*Middleware) Read added in v0.2.3

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 (*Middleware) RemoveReplica added in v0.2.3

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

func (*Middleware) RemoveTrigger added in v0.2.3

RemoveTrigger removes a trigger node for a keygroup.

func (*Middleware) RemoveUser added in v0.2.3

func (m *Middleware) RemoveUser(ctx context.Context, req *middleware.UserRequest) (*middleware.Empty, error)

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

func (*Middleware) Scan added in v0.2.3

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 (*Middleware) Update added in v0.2.3

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