Documentation ¶
Overview ¶
Package lru implements an LRU cache.
保存网络中各个节点公钥对应的域名
Index ¶
- Variables
- func AddAddressInName(nameStr string, name *Name)
- func AddBuildName(name string) (ok bool)
- func AddForeverName(name *Name)
- func AddKeyName(key []byte, name string)
- func AddSyncMulticastKey(key []byte, endTime int64)
- func AddSyncMulticastName(name []byte, endTime int64)
- func AgreeTempName(name []byte, replyMd5 string)
- func FindKeyName(key string) (name string, ok bool)
- func FindNameInTemp(name string) (ok bool)
- func GetAddressInName(name string) *nodeStore.TempId
- func NoticeNameNotExist(name string)
- func SwitchNameForForever(name string)
- type Cache
- type FlashName
- type Key
- type Name
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OutFlashTempName = make(chan *FlashName, 100) //存放需要确认构建的临时域名 OutFlashName = make(chan *FlashName, 100) //存放需要更新的域名 OutMulticastName = make(chan []byte, 100) //广播需要同步的域名 VoteAgree = utils.NewPollManager() //投赞成票 VoteDisagree = utils.NewPollManager() //投反对票 Root *Name = NewName(config.C_root_name, []*nodeStore.TempId{}, config.Root_publicKeyStr) //根节点域名 NameSelf = "" //保存自己的域名,"" = 未查询;"." = 还未注册域名 )
View Source
var (
OutFindName = make(chan string, 100)
)
View Source
var (
OutMulticastPKeyName = make(chan []byte, 100) //需要广播同步的公钥
)
Functions ¶
Types ¶
type Cache ¶
type Cache struct { // MaxEntries is the maximum number of cache entries before // an item is evicted. Zero means no limit. MaxEntries int // OnEvicted optionally specificies a callback function to be // executed when an entry is purged from the cache. OnEvicted func(key Key, value interface{}) // contains filtered or unexported fields }
Cache is an LRU cache. It is not safe for concurrent access.
func NewCache ¶
New creates a new Cache. If maxEntries is zero, the cache has no limit and it's assumed that eviction is done by the caller.
func (*Cache) RemoveOldest ¶
func (c *Cache) RemoveOldest()
RemoveOldest removes the oldest item from the cache.
type Key ¶
type Key interface{}
A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators
type Name ¶
type Name struct { Name string `json:"name"` //域名字符串 // Ids [][]byte `json:"ids"` //所有临时id // UpdateTime int64 `json:"updatetime"` //更新在线时间 Ids []*nodeStore.TempId `json:"ids"` //所有临时id PublicKey []byte `json:"publickey"` //公钥 Exist bool `json:"exist"` //这个域名是否存在,查找域名的时候返回不存在的域名 // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.