Documentation ¶
Index ¶
- Constants
- type ID
- func (id ID) AddOne(from int) ID
- func (id ID) Equal(a ID) bool
- func (id ID) InLRXRange(a, b ID) bool
- func (id ID) InLXRange(a, b ID) bool
- func (id ID) LeftShift() (ID, byte)
- func (id ID) Less(a ID) bool
- func (id ID) MaskLowerWith(x ID, i int) ID
- func (id ID) String() string
- func (id ID) TopShift(a ID) ID
- type Localnode
- func (ln *Localnode) AddDParentRPC(bctx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (ln *Localnode) BootStarpRPC(bctx context.Context, bootstrapPacket *pd.BootStrapPacket) (*pd.BootStrapReply, error)
- func (ln *Localnode) BroadCast(info string) error
- func (ln *Localnode) BroadCastRPC(ctx context.Context, b *pd.BlockPacket) (*pd.Empty, error)
- func (n *Localnode) DGetBlocks(ctx context.Context, e *pd.Empty) (*pd.BlocksPacket, error)
- func (n *Localnode) DGetID(ctx context.Context, e *pd.Empty) (*pd.PeerPacket, error)
- func (n *Localnode) DGetPointers(ctx context.Context, e *pd.Empty) (*pd.Pointers, error)
- func (n *Localnode) DJoin(ctx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (n *Localnode) DLKup(ctx context.Context, p *pd.PeerPacket) (*pd.PeerPacket, error)
- func (n *Localnode) DSetD(ctx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (n *Localnode) DSetSuccessor(ctx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (ln *Localnode) GetID() string
- func (ln *Localnode) GetLocalBlocks() []mock.Block
- func (ln *Localnode) GetPredecessorRPC(ctx context.Context, e *pd.Empty) (*pd.PeerPacket, error)
- func (ln *Localnode) GetSuccessorRPC(ctx context.Context, e *pd.Empty) (*pd.PeerPacket, error)
- func (ln *Localnode) Init(cxt context.Context) error
- func (n *Localnode) InitBroadCastRPC(ctx context.Context, b *pd.BlockPacket) (*pd.Empty, error)
- func (ln *Localnode) Join(nodeAddr *net.TCPAddr, port int) error
- func (ln *Localnode) Lookup(k ID) (*Peer, int32, error)
- func (ln *Localnode) LookupRPC(bctx context.Context, lookupPacket *pd.LookupPacket) (*pd.PeerPacket, error)
- func (ln *Localnode) NotifyRPC(ctx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (ln *Localnode) RemoveDParentRPC(btcx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (ln *Localnode) UpdateDPointerRPC(bctx context.Context, p *pd.PeerPacket) (*pd.Empty, error)
- func (ln *Localnode) UpdatePredecessorRPC(bctx context.Context, p *pd.PeerPacket) (*pd.PeerPacket, error)
- func (ln *Localnode) UpdateSuccessorRPC(bctx context.Context, p *pd.PeerListPacket) (*pd.PeerListPacket, error)
- type Peer
Constants ¶
View Source
const (
MAX_REQ_TIME = 20 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID []byte
var ( MAX_ID ID = []byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255} ZERO_ID ID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} )
Fixed Identifer space of 160 bits * [Note] this works for hex base ids the identifier is a []byte each entry contains 2 digits TODO make it works for generic id radixes
func (ID) InLRXRange ¶
func (ID) InLXRange ¶
function checks if the id is in left execlusive range id is in the range (a, b]
func (ID) MaskLowerWith ¶
changes the lower i bits of id with the heighest i bits of x
type Localnode ¶
type Localnode struct { pd.UnimplementedKoordeServer Peer D *Peer DParents []*Peer Successor *Peer Predecessor *Peer NodeShutdown chan bool // mock consensus ConsensusAPI *mock.Consensus // dsever DClient client.Client // contains filtered or unexported fields }
func (*Localnode) AddDParentRPC ¶
func (*Localnode) BootStarpRPC ¶
func (ln *Localnode) BootStarpRPC(bctx context.Context, bootstrapPacket *pd.BootStrapPacket) (*pd.BootStrapReply, error)
func (*Localnode) BroadCastRPC ¶
func (*Localnode) DGetBlocks ¶
func (*Localnode) DGetPointers ¶
func (*Localnode) DLKup ¶
func (n *Localnode) DLKup(ctx context.Context, p *pd.PeerPacket) (*pd.PeerPacket, error)
func (*Localnode) DSetSuccessor ¶
func (*Localnode) GetLocalBlocks ¶
func (*Localnode) GetPredecessorRPC ¶
func (*Localnode) GetSuccessorRPC ¶
func (*Localnode) Init ¶
Init initializes the first node in the network It inits the Successor, D pointers with default values (node itslef)
func (*Localnode) InitBroadCastRPC ¶
func (*Localnode) Join ¶
Join initializes the node by executing Chord Join Algorithm It inits the Successor, D pointers
func (*Localnode) LookupRPC ¶
func (ln *Localnode) LookupRPC(bctx context.Context, lookupPacket *pd.LookupPacket) (*pd.PeerPacket, error)
func (*Localnode) RemoveDParentRPC ¶
func (*Localnode) UpdateDPointerRPC ¶
func (*Localnode) UpdatePredecessorRPC ¶
func (ln *Localnode) UpdatePredecessorRPC(bctx context.Context, p *pd.PeerPacket) (*pd.PeerPacket, error)
func (*Localnode) UpdateSuccessorRPC ¶
func (ln *Localnode) UpdateSuccessorRPC(bctx context.Context, p *pd.PeerListPacket) (*pd.PeerListPacket, error)
Click to show internal directories.
Click to hide internal directories.