Documentation ¶
Index ¶
- Constants
- Variables
- func Diag(addr string) (*rpc.Client, error)
- func Hash(str string) big.Int
- func LogInit()
- func Ping(addr string) error
- type AddrType
- type BoolStrPair
- type ClosestList
- type DataType
- func (this *DataType) Copy() map[string]string
- func (this *DataType) Delete(key string) (founded bool)
- func (this *DataType) Expire()
- func (this *DataType) Init()
- func (this DataType) Load(key string) (founded bool, ret string)
- func (this *DataType) RePublishList() (republishList []string)
- func (this *DataType) Store(key string, val string)
- type FindNodeArg
- type FindValueArg
- type FindValueRet
- type KBucketType
- type NodeType
- func (this *NodeType) Create()
- func (this *NodeType) Display()
- func (this *NodeType) FindNode(tarID *big.Int) (closestList ClosestList)
- func (this *NodeType) FindValue(key string, hash *big.Int) FindValueRet
- func (this *NodeType) Get(key string) (founded bool, value string)
- func (this *NodeType) Join(ip string) bool
- func (this *NodeType) NodeLookup(tarID *big.Int) (closestList ClosestList)
- func (this *NodeType) Put(key string, value string) bool
- func (this *NodeType) Quit()
- func (this *NodeType) RePublish()
- type ReceiverType
- type StoreArg
- type StrPair
Constants ¶
View Source
const ( NeedRePublishTime = 120 * time.Second ExpiredTime = 960 * time.Second )
View Source
const ( M = 16 K = 10 Alpha = 3 UpdateInterval = 25 * time.Millisecond RemoteTryTime = 3 RemoteTryInterval = 25 * time.Millisecond RePublishInterval = 100 * time.Millisecond )
Variables ¶
View Source
var Log = logrus.New()
Functions ¶
Types ¶
type BoolStrPair ¶
type ClosestList ¶
func (*ClosestList) Insert ¶
func (this *ClosestList) Insert(addr AddrType) (updated bool)
func (*ClosestList) Remove ¶
func (this *ClosestList) Remove(addr AddrType) bool
type DataType ¶
type DataType struct {
// contains filtered or unexported fields
}
func (*DataType) RePublishList ¶
type FindValueRet ¶
type FindValueRet struct { First ClosestList Second string }
type KBucketType ¶
type KBucketType struct {
// contains filtered or unexported fields
}
func (*KBucketType) Reflesh ¶
func (this *KBucketType) Reflesh()
func (*KBucketType) Update ¶
func (this *KBucketType) Update(addr AddrType)
type NodeType ¶
func (*NodeType) FindNode ¶
func (this *NodeType) FindNode(tarID *big.Int) (closestList ClosestList)
func (*NodeType) FindValue ¶
func (this *NodeType) FindValue(key string, hash *big.Int) FindValueRet
FindValue return value or K-closest nodes
func (*NodeType) NodeLookup ¶
func (this *NodeType) NodeLookup(tarID *big.Int) (closestList ClosestList)
type ReceiverType ¶
func NewReceiver ¶
func NewReceiver(ip string) *ReceiverType
func (*ReceiverType) FindNode ¶
func (this *ReceiverType) FindNode(args *FindNodeArg, reply *ClosestList) error
func (*ReceiverType) FindValue ¶
func (this *ReceiverType) FindValue(args *FindValueArg, reply *FindValueRet) error
Click to show internal directories.
Click to hide internal directories.