server

package
v0.0.0-...-1d3766d Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TICK_STABILISE   = 1000 * time.Millisecond
	TICK_FIX_FINGERS = 1000 * time.Millisecond

	// M as it is used in the paper. M specifies the size of the identifier ring,
	// which is 2^M in size (M specifies the amount of bits in an identifier).
	// It is chosen to be the amount of bits we receive from the hashing function.
	M uint = hash.Size * 8
	// R is supposed to be log_2(N) where N is the number of nodes.
	// however, we don't know the number of nodes...
	R uint = 5
)

Variables

View Source
var IntelligentFixFingers bool

IntelligentFixFingers specifies whether we try to smartly fix fingers

View Source
var LearnNodes bool

LearnNodes specifies whether we want to aggresively learn new nodes for finger table

View Source
var LogHopCounts bool

LogHopCounts determines whether we should the amount of hops it takes to find a predecessor

Functions

func CreatePerfectFingertable

func CreatePerfectFingertable(forNodeAddr string, otherNodes []string) (fingerTable [M]string)

func CreatePerfectSuccessorList

func CreatePerfectSuccessorList(forNodeAddr string, otherNodes []string) (successors []string)

func GetGRPCConnection

func GetGRPCConnection(addr string) (conn *grpc.ClientConn)

Types

type ChordServer

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

func New

func New(myAddress string) (server ChordServer)

Create a new instance of ChordServer

func (*ChordServer) Address

func (s *ChordServer) Address() string

func (*ChordServer) Delete

func (s *ChordServer) Delete(key string) error

func (*ChordServer) Get

func (s *ChordServer) Get(key string) (value string, err error)

func (*ChordServer) Join

func (s *ChordServer) Join(otherNode *string)

func (*ChordServer) ListenAndServe

func (s *ChordServer) ListenAndServe() error

func (*ChordServer) Set

func (s *ChordServer) Set(key string, value string) error

func (*ChordServer) Stop

func (s *ChordServer) Stop()

Jump to

Keyboard shortcuts

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