Documentation ¶
Overview ¶
Package utils p2p utils
Index ¶
- func CalcChannelVersion(channel, version int32) int32
- func DecodeChannelVersion(channelVersion int32) (channel int32, version int32)
- type Filterdata
- func (f *Filterdata) Add(key string, val interface{}) bool
- func (f *Filterdata) AddWithCheckAtomic(key string, val interface{}) (exist bool)
- func (f *Filterdata) Close()
- func (f *Filterdata) Contains(key string) bool
- func (f *Filterdata) Get(key string) (interface{}, bool)
- func (f *Filterdata) GetAtomicLock()
- func (f *Filterdata) ManageRecvFilter(tickTime time.Duration)
- func (f *Filterdata) ReleaseAtomicLock()
- func (f *Filterdata) Remove(key string)
- type SpaceLimitCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalcChannelVersion ¶
CalcChannelVersion calc channel version
func DecodeChannelVersion ¶
DecodeChannelVersion decode channel version
Types ¶
type Filterdata ¶
type Filterdata struct {
// contains filtered or unexported fields
}
Filterdata filter data attribute
func (*Filterdata) AddWithCheckAtomic ¶
func (f *Filterdata) AddWithCheckAtomic(key string, val interface{}) (exist bool)
AddWithCheckAtomic add key if key not exist with atomic lock, return true if exist
func (*Filterdata) Contains ¶
func (f *Filterdata) Contains(key string) bool
Contains query receive data by key
func (*Filterdata) ManageRecvFilter ¶
func (f *Filterdata) ManageRecvFilter(tickTime time.Duration)
ManageRecvFilter manager receive filter
func (*Filterdata) ReleaseAtomicLock ¶
func (f *Filterdata) ReleaseAtomicLock()
ReleaseAtomicLock release lock
func (*Filterdata) Remove ¶
func (f *Filterdata) Remove(key string)
Remove remove receive data by key
type SpaceLimitCache ¶
type SpaceLimitCache struct {
// contains filtered or unexported fields
}
SpaceLimitCache lru缓存封装, 控制占用空间大小
func NewSpaceLimitCache ¶
func NewSpaceLimitCache(num, maxByteSize int) *SpaceLimitCache
NewSpaceLimitCache new space limit cache
func (*SpaceLimitCache) Add ¶
func (c *SpaceLimitCache) Add(key interface{}, val interface{}, size int) bool
Add add key val
func (*SpaceLimitCache) Contains ¶
func (c *SpaceLimitCache) Contains(key interface{}) bool
Contains check if exist
func (*SpaceLimitCache) Get ¶
func (c *SpaceLimitCache) Get(key interface{}) interface{}
Get get key
func (*SpaceLimitCache) Remove ¶
func (c *SpaceLimitCache) Remove(key interface{}) (interface{}, bool)
Remove remove key
Click to show internal directories.
Click to hide internal directories.