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 Node
- func (ln *Node) AddDParentRPC(bctx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (ln *Node) BootStarpRPC(bctx context.Context, bootstrapPacket *rpc.BootStrapPacket) (*rpc.BootStrapReply, error)
- func (ln *Node) BroadCast(thing interface{}) error
- func (ln *Node) BroadCastRPC(ctx context.Context, b *rpc.BroadCastPacket) (*rpc.Empty, error)
- func (n *Node) DGetBlocks(ctx context.Context, e *rpc.Empty) (*rpc.BlocksPacket, error)
- func (n *Node) DGetID(ctx context.Context, e *rpc.Empty) (*rpc.PeerPacket, error)
- func (n *Node) DGetPointers(ctx context.Context, e *rpc.Empty) (*rpc.Pointers, error)
- func (n *Node) DJoin(ctx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (n *Node) DLKup(ctx context.Context, p *rpc.PeerPacket) (*rpc.PeerPacket, error)
- func (n *Node) DSetD(ctx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (n *Node) DSetSuccessor(ctx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (ln *Node) GetPredecessorRPC(ctx context.Context, e *rpc.Empty) (*rpc.PeerPacket, error)
- func (ln *Node) GetSuccessorRPC(ctx context.Context, e *rpc.Empty) (*rpc.PeerPacket, error)
- func (ln *Node) Init(port int) error
- func (n *Node) InitBroadCastRPC(ctx context.Context, b *rpc.BroadCastPacket) (*rpc.Empty, error)
- func (ln *Node) Join(nodeAddr *net.TCPAddr, port int) error
- func (ln *Node) Lookup(k ID) (*Peer, error)
- func (ln *Node) LookupRPC(bctx context.Context, lookupPacket *rpc.LookupPacket) (*rpc.PeerPacket, error)
- func (ln *Node) NotifyRPC(ctx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (ln *Node) RemoveDParentRPC(btcx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (ln *Node) UrpcateDPointerRPC(bctx context.Context, p *rpc.PeerPacket) (*rpc.Empty, error)
- func (ln *Node) UrpcatePredecessorRPC(bctx context.Context, p *rpc.PeerPacket) (*rpc.PeerPacket, error)
- func (ln *Node) UrpcateSuccessorRPC(bctx context.Context, p *rpc.PeerListPacket) (*rpc.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 Node ¶
type Node struct { // RPC stuff rpc.UnimplementedKoordeServer Peer D *Peer DParents []*Peer Successor *Peer Predecessor *Peer NodeShutdown chan bool // communication ChanNetBlock chan<- data.Block ChanNetTransaction chan<- data.Transaction ChanConsBlock <-chan data.Block ChanConsTransaction <-chan data.Transaction // contains filtered or unexported fields }
func New ¶
func New(c *communication.CommunNetwCons) *Node
New() constructs a new network node, and it setups the communication channels with the Consensus Module
func (*Node) AddDParentRPC ¶
func (*Node) BootStarpRPC ¶
func (ln *Node) BootStarpRPC(bctx context.Context, bootstrapPacket *rpc.BootStrapPacket) (*rpc.BootStrapReply, error)
func (*Node) BroadCastRPC ¶
func (*Node) DGetBlocks ¶
func (*Node) DGetPointers ¶
func (*Node) DLKup ¶
func (n *Node) DLKup(ctx context.Context, p *rpc.PeerPacket) (*rpc.PeerPacket, error)
func (*Node) DSetSuccessor ¶
func (*Node) GetPredecessorRPC ¶
func (*Node) GetSuccessorRPC ¶
func (*Node) Init ¶
Init initializes the first node in the network It inits the Successor, D pointers with default values (node itslef)
func (*Node) InitBroadCastRPC ¶
func (*Node) Join ¶
Join initializes the node by executing Chord Join Algorithm It inits the Successor, D pointers
func (*Node) LookupRPC ¶
func (ln *Node) LookupRPC(bctx context.Context, lookupPacket *rpc.LookupPacket) (*rpc.PeerPacket, error)
func (*Node) RemoveDParentRPC ¶
func (*Node) UrpcateDPointerRPC ¶
func (*Node) UrpcatePredecessorRPC ¶
func (ln *Node) UrpcatePredecessorRPC(bctx context.Context, p *rpc.PeerPacket) (*rpc.PeerPacket, error)
func (*Node) UrpcateSuccessorRPC ¶
func (ln *Node) UrpcateSuccessorRPC(bctx context.Context, p *rpc.PeerListPacket) (*rpc.PeerListPacket, error)
Click to show internal directories.
Click to hide internal directories.