chordnode

package
v0.0.0-...-2e37a5a Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddress

func GetAddress(directory map[uint32]string, id string) string

Types

type ChordNode

type ChordNode struct {
	ID          uint32
	Predecessor *uint32
	Successor   *uint32
	Table       [32](*uint32)
	Address     string
	Port        int
	InRing      bool
	Data        map[string]string
	Directory   *map[uint32]string

	SecondNode bool // This is a janky way for node that created the ring to take
	// contains filtered or unexported fields
}

A node capable of joining and operating a Chord ring

func GenerateRandomNode

func GenerateRandomNode(directory *map[uint32]string) *ChordNode

*

  • Try to find an open port.

func New

func New(address string, port int, directory *map[uint32]string) *ChordNode

Returns a new ChordNode

func (ChordNode) AddNodeToDirectory

func (n ChordNode) AddNodeToDirectory()

func (*ChordNode) CheckPredecessor

func (n *ChordNode) CheckPredecessor()

func (*ChordNode) ChordWorker

func (n *ChordNode) ChordWorker()

func (*ChordNode) ClosestPrecedingNode

func (n *ChordNode) ClosestPrecedingNode(id uint32) uint32

func (*ChordNode) CreateRing

func (n *ChordNode) CreateRing(msg *gabs.Container) string

Respond to an instruction to join a chord ring

func (*ChordNode) FindRingPredecessor

func (n *ChordNode) FindRingPredecessor() string

func (*ChordNode) FindRingSuccessor

func (n *ChordNode) FindRingSuccessor(id uint32) (uint32, bool, error)

{"do": "find-ring-successor", "id": id, "reply-to": address}

func (*ChordNode) FixRingFingers

func (n *ChordNode) FixRingFingers() string

func (ChordNode) Get

func (n ChordNode) Get(key string) string

func (*ChordNode) GetOwnAddress

func (n *ChordNode) GetOwnAddress() string

func (ChordNode) GetRingFingers

func (n ChordNode) GetRingFingers() string

func (ChordNode) GetSocketAddress

func (n ChordNode) GetSocketAddress() (string, bool)

func (ChordNode) InitRingFingers

func (n ChordNode) InitRingFingers() string

func (*ChordNode) JoinRing

func (n *ChordNode) JoinRing(msg *gabs.Container) string

Respond to an instruction to join a chord ring

func (*ChordNode) LeaveRing

func (n *ChordNode) LeaveRing(msg *gabs.Container) string

func (ChordNode) ListItems

func (n ChordNode) ListItems() string

func (ChordNode) Print

func (n ChordNode) Print()

func (*ChordNode) ProcessIncomingCommand

func (n *ChordNode) ProcessIncomingCommand(msg string) (string, error)

func (*ChordNode) ProcessOrderlyLeave

func (n *ChordNode) ProcessOrderlyLeave(jsonParsed *gabs.Container) string

func (ChordNode) Put

func (n ChordNode) Put(key string, value string) (string, error)

func (ChordNode) Remove

func (n ChordNode) Remove(key string) string

func (*ChordNode) RingNotify

func (n *ChordNode) RingNotify(id uint32, replyTo string) string

func (*ChordNode) Run

func (n *ChordNode) Run()

func (*ChordNode) StabilizeRing

func (n *ChordNode) StabilizeRing() string

Jump to

Keyboard shortcuts

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