Documentation ¶
Index ¶
- Constants
- func CalHash(str string) (result *big.Int)
- func GenerateClient(address string) (*rpc.Client, error)
- func GetLocalIP() string
- func IfOnline(address string) bool
- func PingAndCheckOnline(self *Node, addr *AddrType) bool
- func PrefixLen(Id *big.Int) int
- func RemoteCall(self *Node, targetAddr *AddrType, serviceMethod string, args interface{}, ...) error
- func Sort(dataSet *[]ClosestListNode)
- func WrappedAccept(server *rpc.Server, lis net.Listener, ptr *Node)
- func Xor(node, other *big.Int) (result *big.Int)
- type AddrType
- type ClosestListNode
- type Datamanager
- type FindNodeArg
- type FindNodeRep
- type FindValueArg
- type FindValueRep
- type Node
- func (ptr *Node) Background()
- func (ptr *Node) Create()
- func (ptr *Node) Delete(key string) bool
- func (ptr *Node) Duplicate()
- func (ptr *Node) Expire()
- func (ptr *Node) FindClosestNode(target AddrType) []ClosestListNode
- func (ptr *Node) ForceQuit()
- func (ptr *Node) Get(key string) (bool, string)
- func (ptr *Node) Init(port int)
- func (ptr *Node) Join(address string) bool
- func (ptr *Node) Ping(requester string) bool
- func (ptr *Node) Put(key string, value string) bool
- func (ptr *Node) Quit()
- func (ptr *Node) RangePut(request StoreArg)
- func (ptr *Node) Refresh()
- func (ptr *Node) Republic()
- func (ptr *Node) Run()
- type RoutingTable
- type RpcNode
- type StoreArg
- type WrapNode
Constants ¶
View Source
const IDlength int = 160
View Source
const K int = 48 // buckets size
View Source
const SleepTime time.Duration = 20 * time.Millisecond
View Source
const WaitTime time.Duration = 250 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
func GetLocalIP ¶
func GetLocalIP() string
func PingAndCheckOnline ¶
func RemoteCall ¶
func Sort ¶
func Sort(dataSet *[]ClosestListNode)
Types ¶
type AddrType ¶
func GenerateAddr ¶
type ClosestListNode ¶
type Datamanager ¶
type Datamanager struct {
// contains filtered or unexported fields
}
type FindNodeArg ¶
type FindNodeRep ¶
type FindNodeRep struct { ReqAddr AddrType RepAddr AddrType Content []ClosestListNode }
type FindValueArg ¶
type FindValueRep ¶
type FindValueRep struct { ReqAddr AddrType RepAddr AddrType Content []ClosestListNode IfFind bool Value string }
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) Background ¶
func (ptr *Node) Background()
func (*Node) FindClosestNode ¶
func (ptr *Node) FindClosestNode(target AddrType) []ClosestListNode
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
func (*RoutingTable) FindClosest ¶
func (ptr *RoutingTable) FindClosest(targetID *big.Int, count int) []ClosestListNode
func (*RoutingTable) InitRoutingTable ¶
func (ptr *RoutingTable) InitRoutingTable(nodeAddr AddrType)
func (*RoutingTable) Update ¶
func (ptr *RoutingTable) Update(contact *AddrType)
type RpcNode ¶
type RpcNode struct {
// contains filtered or unexported fields
}
func (*RpcNode) FindNode ¶
func (ptr *RpcNode) FindNode(arg FindNodeArg, result *FindNodeRep) error
func (*RpcNode) FindValue ¶
func (ptr *RpcNode) FindValue(input FindValueArg, result *FindValueRep) error
type WrapNode ¶
type WrapNode struct {
// contains filtered or unexported fields
}
func GenerateWrapNode ¶
func (*WrapNode) FindNode ¶
func (ptr *WrapNode) FindNode(arg *FindNodeArg, rep *FindNodeRep) error
func (*WrapNode) FindValue ¶
func (ptr *WrapNode) FindValue(arg *FindValueArg, rep *FindValueRep) error
Click to show internal directories.
Click to hide internal directories.