node

package
v0.0.0-...-b73c172 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPhysicalNode

func GetPhysicalNode(vn string) (int, error)

Find physical node int from virtual node string

func Start

func Start(nodeID int)

Start is the main function that starts the entire program

Types

type MonitorInfo

type MonitorInfo struct {
	VirtualNodes         []string
	VirtualNodesLocation map[string]int
	VirtualNodesCapacity map[string]int
	HeartbeatTable       map[int]bool
}

type Node

type Node struct {
	IsCoordinator       bool           `validate:"required"`
	Pid                 int            `validate:"gte=0"`    // Node ID
	Ring                []int          `validate:"required"` // Ring structure of nodes
	RpcMap              map[int]string `validate:"required"` // Map node ID to their receiving address
	HeartBeatTable      map[int]bool
	VirtualNodeLocation []int
	VirtualNodeMap      map[int]string
	Router              *echo.Echo
	KillSignal          chan os.Signal // For signalling shutdown of router server
}

Node contains all the variables that are necessary to manage a node

func (*Node) AssignCoordinator

func (n *Node) AssignCoordinator(request *message.Request, reply *message.Reply) error

AssignCoordinator assigns the current node to be the coordinator and starts the router

func (*Node) DeleteSecret

func (n *Node) DeleteSecret(request *message.Request, reply *message.Reply) error

func (*Node) GetAllSecrets

func (n *Node) GetAllSecrets(request *message.Request, reply *message.Reply) error

func (*Node) GetData

func (n *Node) GetData(request *message.Request, reply *message.Reply) error

func (*Node) GetSecrets

func (n *Node) GetSecrets(request *message.Request, reply *message.Reply) error

GetSecrets gets the secrets from given range and send back

func (*Node) OwnerNodeDown

func (n *Node) OwnerNodeDown(request *message.Request, reply *message.Reply) error

receives the message from Coordinator and do what is on the board REMEMBER to capitalize the function name Strict Consistency with R = 2. Send ACK directly to coordinator

func (*Node) PerformEventualReplication

func (n *Node) PerformEventualReplication(request *message.Request, reply *message.Reply) error

Performed by rf=1

func (*Node) PerformStrictDown

func (n *Node) PerformStrictDown(request *message.Request, reply *message.Reply) error

func (*Node) RelayDeleteSecret

func (n *Node) RelayDeleteSecret(request *message.Request, reply *message.Reply) error

RelayDeleteSecret deletes a copy of the secret

func (*Node) RemoveCoordinator

func (n *Node) RemoveCoordinator(request *message.Request, reply *message.Reply) error

RemoveCoordinator removes the coordinator flag from this node and stop its router

func (*Node) StoreAndReplicate

func (n *Node) StoreAndReplicate(request *message.Request, reply *message.Reply) error

Take in list from Coordinator and trigger Store and Replicate processes. Store data to itself and send message to next data on the list to conduct strict consistency

func (*Node) StrictReplication

func (n *Node) StrictReplication(request *message.Request, reply *message.Reply) error

func (*Node) UpdateHeartbeatTable

func (n *Node) UpdateHeartbeatTable(request *message.Request, reply *message.Reply) error

UpdateHeartbeatTable updates the Heartbeat Table that the node has

func (*Node) UpdateRpcMap

func (n *Node) UpdateRpcMap(request *message.Request, reply *message.Reply) error

UpdateRpcMap updates node's RPC Map

func (*Node) UpdateVirtualNodes

func (n *Node) UpdateVirtualNodes(request *message.Request, reply *message.Reply) error

UpdateVirtualNodes updates the node's virtual node location and map

type RouterBuilder

type RouterBuilder struct{}

func (*RouterBuilder) New

func (rb *RouterBuilder) New() *echo.Echo

Jump to

Keyboard shortcuts

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