locksmith

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start()

Start is the main function that starts the entire program

Types

type LockSmith

type LockSmith struct {
	Pid                 int            // Node ID
	Ring                []int          // Ring structure of nodes
	Coordinator         int            // Indicate the coordinator node number
	RpcMap              map[int]string // Map node ID to their receiving address
	HeartBeatTable      map[int]bool
	VirtualNodeLocation []int
	VirtualNodeMap      map[int]string
	RequestQueue        []int // Request queue for granting lock for accessing user.json, an array of nodeID
}

func (*LockSmith) AcquireUserLock

func (locksmith *LockSmith) AcquireUserLock(request *message.Request, reply *message.Reply) error

AcquireUserLock puts the request into the queue and serves the request one by one in FIFO order

func (*LockSmith) CreateVirtualNodes

func (locksmith *LockSmith) CreateVirtualNodes(request *message.Request, reply *message.Reply) error

GetHeartbeatTable returns the heartbeat table as a RPC reply

func (*LockSmith) ReleaseUserLock

func (locksmith *LockSmith) ReleaseUserLock(request *message.Request, reply *message.Reply) error

ReleaseUserLock pop the top request from the queue

func (*LockSmith) SignalStart

func (locksmith *LockSmith) SignalStart(request *message.Request, reply *message.Reply) error

SignalStart receives the signal from sending node and return RPC map to the node

Jump to

Keyboard shortcuts

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