Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) AddReplica(ctx context.Context, keygroup string, nodeID string, expiry int64) (*fredClients.StatusResponse, error)
- func (c *Client) AddTrigger(ctx context.Context, keygroup string, triggerID string, triggerHost string) (*fredClients.StatusResponse, error)
- func (c *Client) AddUser(ctx context.Context, user, keygroup string, role fredClients.UserRole) (*fredClients.StatusResponse, error)
- func (c *Client) Append(ctx context.Context, keygroup string, data string) (*fredClients.AppendResponse, error)
- func (c *Client) CreateKeygroup(ctx context.Context, keygroup string, mutable bool, expiry int64) (*fredClients.StatusResponse, error)
- func (c *Client) Delete(ctx context.Context, keygroup string, id string) (*fredClients.StatusResponse, error)
- func (c *Client) DeleteKeygroup(ctx context.Context, keygroup string) (*fredClients.StatusResponse, error)
- func (c *Client) GetAllReplica(ctx context.Context) (*fredClients.GetAllReplicaResponse, error)
- func (c *Client) GetKeygroupReplica(ctx context.Context, keygroup string) (*fredClients.GetKeygroupReplicaResponse, error)
- func (c *Client) GetKeygroupTriggers(ctx context.Context, keygroup string) (*fredClients.GetKeygroupTriggerResponse, error)
- func (c *Client) GetReplica(ctx context.Context, nodeID string) (*fredClients.GetReplicaResponse, error)
- func (c *Client) Read(ctx context.Context, keygroup string, id string) (*fredClients.ReadResponse, error)
- func (c *Client) RemoveReplica(ctx context.Context, keygroup string, nodeID string) (*fredClients.StatusResponse, error)
- func (c *Client) RemoveTrigger(ctx context.Context, keygroup, triggerID string) (*fredClients.StatusResponse, error)
- func (c *Client) RemoveUser(ctx context.Context, user, keygroup string, role fredClients.UserRole) (*fredClients.StatusResponse, error)
- func (c *Client) Update(ctx context.Context, keygroup string, id string, data string) (*fredClients.StatusResponse, error)
- type ClientsMgr
- func (m *ClientsMgr) GetClientTo(host string) (client *Client)
- func (m *ClientsMgr) GetFastestClient() (client *Client)
- func (m *ClientsMgr) GetFastestClientWithKeygroup(keygroup string, expiry int64) (client *Client, err error)
- func (m *ClientsMgr) GetRandomClientWithKeygroup(keygroup string, expiry int64) (client *Client, err error)
- func (m *ClientsMgr) ReadFromAnywhere(ctx context.Context, request *alexandraProto.ReadRequest) (*alexandraProto.ReadResponse, error)
- type Server
- func (s *Server) AddReplica(ctx context.Context, request *alexandraProto.AddReplicaRequest) (*alexandraProto.Empty, error)
- func (s *Server) AddTrigger(ctx context.Context, request *alexandraProto.AddTriggerRequest) (*alexandraProto.Empty, error)
- func (s *Server) AddUser(ctx context.Context, request *alexandraProto.UserRequest) (*alexandraProto.Empty, error)
- func (s *Server) Append(ctx context.Context, request *alexandraProto.AppendRequest) (*alexandraProto.AppendResponse, error)
- func (s *Server) CreateKeygroup(ctx context.Context, request *alexandraProto.CreateKeygroupRequest) (*alexandraProto.Empty, error)
- func (s *Server) Delete(ctx context.Context, request *alexandraProto.DeleteRequest) (*alexandraProto.Empty, error)
- func (s *Server) DeleteKeygroup(ctx context.Context, request *alexandraProto.DeleteKeygroupRequest) (*alexandraProto.Empty, error)
- func (s *Server) GetAllReplica(ctx context.Context, request *alexandraProto.GetAllReplicaRequest) (*alexandraProto.GetAllReplicaResponse, error)
- func (s *Server) GetKeygroupReplica(ctx context.Context, request *alexandraProto.GetKeygroupReplicaRequest) (*alexandraProto.GetKeygroupReplicaResponse, error)
- func (s *Server) GetKeygroupTriggers(ctx context.Context, request *alexandraProto.GetKeygroupTriggerRequest) (*alexandraProto.GetKeygroupTriggerResponse, error)
- func (s *Server) GetReplica(ctx context.Context, request *alexandraProto.GetReplicaRequest) (*alexandraProto.GetReplicaResponse, error)
- func (s *Server) Read(ctx context.Context, request *alexandraProto.ReadRequest) (*alexandraProto.ReadResponse, error)
- func (s *Server) RemoveReplica(ctx context.Context, request *alexandraProto.RemoveReplicaRequest) (*alexandraProto.Empty, error)
- func (s *Server) RemoveTrigger(ctx context.Context, request *alexandraProto.RemoveTriggerRequest) (*alexandraProto.Empty, error)
- func (s *Server) RemoveUser(ctx context.Context, request *alexandraProto.UserRequest) (*alexandraProto.Empty, error)
- func (s *Server) Scan(ctx context.Context, request *alexandraProto.ScanRequest) (*alexandraProto.ScanResponse, error)
- func (s *Server) ServeBlocking()
- func (s *Server) Update(ctx context.Context, request *alexandraProto.UpdateRequest) (*alexandraProto.Empty, error)
Constants ¶
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 (*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)
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 ¶
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, request *alexandraProto.AddReplicaRequest) (*alexandraProto.Empty, error)
func (*Server) AddTrigger ¶
func (s *Server) AddTrigger(ctx context.Context, request *alexandraProto.AddTriggerRequest) (*alexandraProto.Empty, error)
func (*Server) AddUser ¶
func (s *Server) AddUser(ctx context.Context, request *alexandraProto.UserRequest) (*alexandraProto.Empty, error)
func (*Server) Append ¶
func (s *Server) Append(ctx context.Context, request *alexandraProto.AppendRequest) (*alexandraProto.AppendResponse, error)
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 (s *Server) Delete(ctx context.Context, request *alexandraProto.DeleteRequest) (*alexandraProto.Empty, error)
func (*Server) DeleteKeygroup ¶
func (s *Server) DeleteKeygroup(ctx context.Context, request *alexandraProto.DeleteKeygroupRequest) (*alexandraProto.Empty, error)
func (*Server) GetAllReplica ¶
func (s *Server) GetAllReplica(ctx context.Context, request *alexandraProto.GetAllReplicaRequest) (*alexandraProto.GetAllReplicaResponse, error)
func (*Server) GetKeygroupReplica ¶
func (s *Server) GetKeygroupReplica(ctx context.Context, request *alexandraProto.GetKeygroupReplicaRequest) (*alexandraProto.GetKeygroupReplicaResponse, error)
func (*Server) GetKeygroupTriggers ¶
func (s *Server) GetKeygroupTriggers(ctx context.Context, request *alexandraProto.GetKeygroupTriggerRequest) (*alexandraProto.GetKeygroupTriggerResponse, error)
func (*Server) GetReplica ¶
func (s *Server) GetReplica(ctx context.Context, request *alexandraProto.GetReplicaRequest) (*alexandraProto.GetReplicaResponse, error)
func (*Server) Read ¶
func (s *Server) Read(ctx context.Context, request *alexandraProto.ReadRequest) (*alexandraProto.ReadResponse, error)
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 (s *Server) Scan(ctx context.Context, request *alexandraProto.ScanRequest) (*alexandraProto.ScanResponse, error)
func (*Server) ServeBlocking ¶
func (s *Server) ServeBlocking()
func (*Server) Update ¶
func (s *Server) Update(ctx context.Context, request *alexandraProto.UpdateRequest) (*alexandraProto.Empty, error)