etcdnase

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NameService

type NameService struct {
	NodeID string
	// contains filtered or unexported fields
}

NameService is the interface to the etcd server that serves as NaSe It is used by the replservice to sync updates to keygroups with other nodes and thereby makes sure that ReplicationStorage always has up to date information

func NewNameService

func NewNameService(nodeID string, endpoints []string, certFile string, keyFile string, caFile string, skipVerfiy bool, cached bool) (*NameService, error)

NewNameService creates a new NameService

func (*NameService) AddUserPermissions

func (n *NameService) AddUserPermissions(user string, method fred.Method, kg fred.KeygroupName) error

AddUserPermissions adds user's permission to perform method on kg by adding the key to etcd. It will not return an error if the user already has the permission.

func (*NameService) CreateKeygroup

func (n *NameService) CreateKeygroup(kg fred.KeygroupName, mutable bool, expiry int) error

CreateKeygroup created the keygroup status and joins the keygroup

func (*NameService) DeleteKeygroup

func (n *NameService) DeleteKeygroup(kg fred.KeygroupName) error

DeleteKeygroup marks the keygroup as "deleted" in the NaSe

func (*NameService) ExistsKeygroup

func (n *NameService) ExistsKeygroup(kg fred.KeygroupName) (bool, error)

ExistsKeygroup checks whether a Keygroup exists by checking whether there are keys with the prefix "kg|[kgname]|

func (*NameService) ExitOtherNodeFromKeygroup

func (n *NameService) ExitOtherNodeFromKeygroup(kg fred.KeygroupName, nodeID fred.NodeID) error

ExitOtherNodeFromKeygroup deletes the node from the NaSe

func (*NameService) GetAllNodes

func (n *NameService) GetAllNodes() (nodes []fred.Node, err error)

GetAllNodes returns all nodes that are stored in the NaSe in the way they can be reached by other nodes

func (*NameService) GetAllNodesExternal

func (n *NameService) GetAllNodesExternal() (nodes []fred.Node, err error)

GetAllNodesExternal returns all nodes with the port that the exthandler is running on

func (*NameService) GetExpiry

func (n *NameService) GetExpiry(kg fred.KeygroupName) (int, error)

GetExpiry checks the expiration time for items of the keygroup on a replica.

func (*NameService) GetKeygroupMembers

func (n *NameService) GetKeygroupMembers(kg fred.KeygroupName, excludeSelf bool) (ids map[fred.NodeID]int, err error)

GetKeygroupMembers returns all IDs of the Members of a Keygroup by iterating over all saved keys that start with the keygroup name. The value of the map is the expiry in seconds.

func (*NameService) GetNodeAddress

func (n *NameService) GetNodeAddress(nodeID fred.NodeID) (addr string, err error)

GetNodeAddress returns the ip and port of a node

func (*NameService) GetNodeAddressExternal

func (n *NameService) GetNodeAddressExternal(nodeID fred.NodeID) (addr string, err error)

GetNodeAddressExternal returns the ip and port of a node, the one accesable from the outside

func (*NameService) GetNodeID

func (n *NameService) GetNodeID() fred.NodeID

GetNodeID returns the ID of this node.

func (*NameService) GetNodeWithBiggerExpiry

func (n *NameService) GetNodeWithBiggerExpiry(kg fred.KeygroupName) (nodeID fred.NodeID, addr string)

GetNodeWithBiggerExpiry if this node has to get an item because it has missed it, it has to get it from a node with a bigger expiry if there is no node with a bigger expiry then it returns the node with the highest expiry

func (*NameService) GetUserPermissions

func (n *NameService) GetUserPermissions(user string, kg fred.KeygroupName) (map[fred.Method]struct{}, error)

GetUserPermissions returns a set of all of the user's permissions on kg from etcd.

func (*NameService) IsMutable

func (n *NameService) IsMutable(kg fred.KeygroupName) (bool, error)

IsMutable checks whether a Keygroup is mutable.

func (*NameService) JoinNodeIntoKeygroup

func (n *NameService) JoinNodeIntoKeygroup(kg fred.KeygroupName, nodeID fred.NodeID, expiry int) error

JoinNodeIntoKeygroup joins the node into an already existing keygroup

func (*NameService) RegisterSelf

func (n *NameService) RegisterSelf(host string, externalHost string) error

RegisterSelf stores information about this node

func (*NameService) ReportFailedNode

func (n *NameService) ReportFailedNode(nodeID fred.NodeID, kg fred.KeygroupName, id string) error

ReportFailedNode saves that a node has missed an update to a keygroup that it will get another time

func (*NameService) RequestNodeStatus

func (n *NameService) RequestNodeStatus(nodeID fred.NodeID) (kgs []fred.Item)

RequestNodeStatus request a list of items that the node has missed while it was offline

func (*NameService) RevokeUserPermissions

func (n *NameService) RevokeUserPermissions(user string, method fred.Method, kg fred.KeygroupName) error

RevokeUserPermissions removes user's permission to perform method on kg by deleting the key in etcd. It will not return an error if the user does not have the permission.

Jump to

Keyboard shortcuts

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