utils

package
v6.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Copyright Fuzamei Corp. 2018 All Rights Reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package utils p2p utils

Copyright Fuzamei Corp. 2018 All Rights Reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcChannelVersion

func CalcChannelVersion(channel, version int32) int32

CalcChannelVersion calc channel version

func DecodeChannelVersion

func DecodeChannelVersion(channelVersion int32) (channel int32, version int32)

DecodeChannelVersion decode channel version

Types

type Filterdata

type Filterdata struct {
	// contains filtered or unexported fields
}

Filterdata filter data attribute

func NewFilter

func NewFilter(num int) *Filterdata

NewFilter produce a filter object

func (*Filterdata) Add

func (f *Filterdata) Add(key string, val interface{}) bool

Add add val

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) Close

func (f *Filterdata) Close()

Close the filter object

func (*Filterdata) Contains

func (f *Filterdata) Contains(key string) bool

Contains query receive data by key

func (*Filterdata) Get

func (f *Filterdata) Get(key string) (interface{}, bool)

Get get val

func (*Filterdata) GetAtomicLock

func (f *Filterdata) GetAtomicLock()

GetAtomicLock get lock

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
}

lru缓存封装, 控制占用空间大小

func NewSpaceLimitCache

func NewSpaceLimitCache(num int, maxByteSize int64) *SpaceLimitCache

NewSpaceLimitCache new space limit cache

func (*SpaceLimitCache) Add

func (c *SpaceLimitCache) Add(key interface{}, val interface{}, size int64) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL