Documentation ¶
Index ¶
- func CreateDir(x string) error
- func CreateEmptyFile(filepath string)
- func DefaultHash(s string) uint32
- func DeleteDir(x string) error
- func Exists(path string) (bool, error)
- func GetByteOrder() binary.ByteOrder
- func Hash32Seed(s string, seed uint32) uint32
- func ListDirectory(dir string) ([]string, error)
- type BloomFilter
- type ByteStream
- func (bs *ByteStream) Bytes() []byte
- func (bs *ByteStream) GetBytes() []byte
- func (bs *ByteStream) GetString() string
- func (bs *ByteStream) GetUInt16() uint16
- func (bs *ByteStream) GetUInt32() uint32
- func (bs *ByteStream) GetUInt64() uint64
- func (bs *ByteStream) PutBytes(x []byte)
- func (bs *ByteStream) PutString(x string)
- func (bs *ByteStream) PutUInt16(x uint16)
- func (bs *ByteStream) PutUInt32(x uint32)
- func (bs *ByteStream) PutUInt64(x uint64)
- func (bs *ByteStream) Reset()
- func (bs *ByteStream) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHash ¶
DefaultHash hashes string with default seed = 0 into uint32
func GetByteOrder ¶
GetByteOrder returns byte order of running machine
func Hash32Seed ¶
Hash32Seed hashes string with seed into uint32
func ListDirectory ¶
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) 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 NewByteStreamFromBytes ¶
func NewByteStreamFromBytes(buf []byte) *ByteStream
NewByteStreamFromBytes returns new ByteStream
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