chord

package
v0.0.0-...-10b4495 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

new create a new chord overlay structure.

Types

type Chord

type Chord struct {
	// contains filtered or unexported fields
}

Chord represents a Chord overlay local (for each node) structure.

func (*Chord) Create

func (c *Chord) Create(ctx context.Context, appNode overlay.LocalNode) error

func (*Chord) Join

func (c *Chord) Join(ctx context.Context, overlayNodeIP string, overlayNodePort int, appNode overlay.LocalNode) error

func (*Chord) Leave

func (c *Chord) Leave(ctx context.Context) error

func (*Chord) Lookup

func (c *Chord) Lookup(ctx context.Context, key []byte) ([]*overlay.OverlayNode, error)

func (*Chord) Neighbors

func (c *Chord) Neighbors(ctx context.Context, nodeID []byte) ([]*overlay.OverlayNode, error)

func (*Chord) NodeID

func (c *Chord) NodeID(ctx context.Context) ([]byte, error)

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Used to handle events fired by the chord overlay. The listener let the important events bubble up into Node layer using a provided interface called LocalNode.

func (*Listener) Leaving

func (l *Listener) Leaving(local, predecessor, successor *chord.Vnode)

Fired when the local node is leaving the chord overlay.

func (*Listener) NewPredecessor

func (l *Listener) NewPredecessor(local, newPredecessor, previousPredecessor *chord.Vnode)

Fired when the a new predecessor of the local node appears in the overlay.

func (*Listener) PredecessorLeaving

func (l *Listener) PredecessorLeaving(local, remote *chord.Vnode)

Fired when the current predecessor of the local node is leaving the chord overlay.

func (*Listener) Shutdown

func (l *Listener) Shutdown()

Fired when when one node decided to shutdown the chord ring system. Do the shutdown message propagates to all the nodes ??

func (*Listener) SuccessorLeaving

func (l *Listener) SuccessorLeaving(local, remote *chord.Vnode)

Fired when a current successor of the local node is leaving the chord overlay.

type ResourcesHash

type ResourcesHash struct {
	// contains filtered or unexported fields
}

It is used to pass to the Chord implementation and it does a pass-through hash because we generate our hash in the node layer depending on the resources for a request.

func NewResourcesHash

func NewResourcesHash(bytesSize int, hostname string) *ResourcesHash

NewResourcesHash creates a new hash.

func (*ResourcesHash) BlockSize

func (r *ResourcesHash) BlockSize() int

func (*ResourcesHash) Reset

func (r *ResourcesHash) Reset()

func (*ResourcesHash) Size

func (r *ResourcesHash) Size() int

func (*ResourcesHash) Sum

func (r *ResourcesHash) Sum(b []byte) []byte

func (*ResourcesHash) Write

func (r *ResourcesHash) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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