utils

package
v0.0.0-...-25c693f Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 13 Imported by: 0

README

UTILS

Utils provides frequently used but arguably implemented functions.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BFSerializer ...
	BFSerializer = NewBloomFilterSerializer()
)
View Source
var (
	Logger *log.Logger
)

Logger ...

Functions

func CurrentTimeMillis

func CurrentTimeMillis() int64

CurrentTimeMillis ...

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

GetBytes Convert any type data into bytes

func Hash

func Hash(key interface{}) uint64

Hash Convert key into an integer

func LoggerInstance

func LoggerInstance() *log.Logger

LoggerInstance ...

Types

type APHash

type APHash struct{}

APHash ...

type BKDRHash

type BKDRHash struct{}

BKDRHash ...

type BPHash

type BPHash struct{}

BPHash ...

type BloomFilter

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

BloomFilter provides an approach to quickly check whether a key is stored inside some file

func NewBloomFilter

func NewBloomFilter(numElements, bitsPerElement int) *BloomFilter

NewBloomFilter gives out a new instance of bf

func NewBloomFilterDS

func NewBloomFilterDS(hashes int32, filter *bitset.BitSet) *BloomFilter

NewBloomFilterDS creates a bf deserialized from data

func NewBloomFilterS

func NewBloomFilterS(count, hashes, bitsize int32, bs *bitset.BitSet) *BloomFilter

NewBloomFilterS creates a bf deserialized from data

func (*BloomFilter) Fill

func (b *BloomFilter) Fill(key string)

Fill insert a key to bf

func (*BloomFilter) IsPresent

func (b *BloomFilter) IsPresent(key string) bool

IsPresent checks whether a key exists

func (*BloomFilter) ToByteArray

func (b *BloomFilter) ToByteArray() []byte

ToByteArray serializes this bf

type BloomFilterSerializer

type BloomFilterSerializer struct{}

BloomFilterSerializer ...

func NewBloomFilterSerializer

func NewBloomFilterSerializer() *BloomFilterSerializer

NewBloomFilterSerializer ...

func (*BloomFilterSerializer) Deserialize

func (b *BloomFilterSerializer) Deserialize(dis *os.File) *BloomFilter

Deserialize ...

func (*BloomFilterSerializer) DeserializeB

func (b *BloomFilterSerializer) DeserializeB(dis []byte) *BloomFilter

DeserializeB deserialize bloom filter from bytes

func (*BloomFilterSerializer) Serialize

func (b *BloomFilterSerializer) Serialize(bf *BloomFilter, dos *os.File)

Serialize ...

func (*BloomFilterSerializer) SerializeB

func (b *BloomFilterSerializer) SerializeB(bf *BloomFilter, dos []byte)

SerializeB serialize bloom filter to byte slice

type BoundedStatsDeque

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

BoundedStatsDeque ...

func NewBoundedStatsDeque

func NewBoundedStatsDeque(size int) *BoundedStatsDeque

NewBoundedStatsDeque ...

func (*BoundedStatsDeque) Add

func (p *BoundedStatsDeque) Add(o float64)

Add ...

func (*BoundedStatsDeque) Clear

func (p *BoundedStatsDeque) Clear()

Clear ...

func (*BoundedStatsDeque) Mean

func (p *BoundedStatsDeque) Mean() float64

Mean ...

func (*BoundedStatsDeque) Size

func (p *BoundedStatsDeque) Size() int

Size ...

func (*BoundedStatsDeque) Stdev

func (p *BoundedStatsDeque) Stdev() float64

Stdev ...

func (*BoundedStatsDeque) Sum

func (p *BoundedStatsDeque) Sum() float64

Sum ...

func (*BoundedStatsDeque) SumOfDeviations

func (p *BoundedStatsDeque) SumOfDeviations() float64

SumOfDeviations ...

func (*BoundedStatsDeque) Variance

func (p *BoundedStatsDeque) Variance() float64

Variance ...

type DEKHash

type DEKHash struct{}

DEKHash ...

type DJBHash

type DJBHash struct{}

DJBHash ...

type ELFHash

type ELFHash struct{}

ELFHash ...

type FNVHash

type FNVHash struct{}

FNVHash ...

type ISimpleHash

type ISimpleHash interface {
	// contains filtered or unexported methods
}

ISimpleHash provides an interface for hash functions

type JSHash

type JSHash struct{}

JSHash ...

type PJWHash

type PJWHash struct{}

PJWHash ...

type RSHash

type RSHash struct{}

RSHash ...

type SDBMHash

type SDBMHash struct{}

SDBMHash ...

Jump to

Keyboard shortcuts

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