util

package
v0.0.0-...-3c05ffe Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(x string) error

CreateDir creates directory

func CreateEmptyFile

func CreateEmptyFile(filepath string)

CreateEmptyFile creates empty file

func DefaultHash

func DefaultHash(s string) uint32

DefaultHash hashes string with default seed = 0 into uint32

func DeleteDir

func DeleteDir(x string) error

DeleteDir delete directory

func Exists

func Exists(path string) (bool, error)

Exists check if dir/file exists

func GetByteOrder

func GetByteOrder() binary.ByteOrder

GetByteOrder returns byte order of running machine

func Hash32Seed

func Hash32Seed(s string, seed uint32) uint32

Hash32Seed hashes string with seed into uint32

func ListDirectory

func ListDirectory(dir string) ([]string, error)

ListDirectory returns file list in directory

Types

type BloomFilter

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

BloomFilter host data about probabilistic data structure

func NewBloomFilter

func NewBloomFilter(elements uint32, falsePositive float32) BloomFilter

NewBloomFilter returns new BloomFilter

func NewBloomFilterFromByteStream

func NewBloomFilterFromByteStream(bs *ByteStream) (BloomFilter, error)

NewBloomFilterFromByteStream convert ByteStream to BloomFilter

func (*BloomFilter) Add

func (bf *BloomFilter) Add(key string)

Add adds key to BloomFilter

func (*BloomFilter) ByteStream

func (bf *BloomFilter) ByteStream() (*ByteStream, error)

ByteStream returns byte stream of bloom filter data

func (*BloomFilter) Contains

func (bf *BloomFilter) Contains(key string) bool

Contains checks if perhaps BloomFilter contains the key

type ByteStream

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

ByteStream holds []byte definition

func NewByteStream

func NewByteStream() *ByteStream

NewByteStream returns new ByteStream

func NewByteStreamFromBytes

func NewByteStreamFromBytes(buf []byte) *ByteStream

NewByteStreamFromBytes returns new ByteStream

func (*ByteStream) Bytes

func (bs *ByteStream) Bytes() []byte

Bytes returns the current []byte

func (*ByteStream) GetBytes

func (bs *ByteStream) GetBytes() []byte

GetBytes returns []byte from ByteStream

func (*ByteStream) GetString

func (bs *ByteStream) GetString() string

GetString returns string from ByteStream

func (*ByteStream) GetUInt16

func (bs *ByteStream) GetUInt16() uint16

GetUInt16 returns uint16 from ByteStream

func (*ByteStream) GetUInt32

func (bs *ByteStream) GetUInt32() uint32

GetUInt32 returns uint32 from ByteStream

func (*ByteStream) GetUInt64

func (bs *ByteStream) GetUInt64() uint64

GetUInt64 returns uint64 from ByteStream

func (*ByteStream) PutBytes

func (bs *ByteStream) PutBytes(x []byte)

PutBytes append []byte to ByteStream

func (*ByteStream) PutString

func (bs *ByteStream) PutString(x string)

PutString append string to ByteStream

func (*ByteStream) PutUInt16

func (bs *ByteStream) PutUInt16(x uint16)

PutUInt16 append uint16 to ByteStream

func (*ByteStream) PutUInt32

func (bs *ByteStream) PutUInt32(x uint32)

PutUInt32 append uint32 to ByteStream

func (*ByteStream) PutUInt64

func (bs *ByteStream) PutUInt64(x uint64)

PutUInt64 append uint64 to ByteStream

func (*ByteStream) Reset

func (bs *ByteStream) Reset()

Reset put the current cur at the beginning of []byte

func (*ByteStream) Size

func (bs *ByteStream) Size() int

Size returns ByteStream size

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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