ghost

package
v0.0.0-...-7bcfc8b Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2016 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Collection is just wrapper around hashmap. Storage could contain multiple collections.

Implementation of FNV-1a hash alghorithm

Implementation of Striped Hashmap data structure.

Storage is a heart of ghost. Storage contains all collections and interaction methods. Storage is singleton.

Index

Constants

View Source
const (
	INIT_SIZE uint32  = 64   // Default number of buckets
	THRESHOLD float32 = 0.75 // Threshold load factor to rehash table
	LOCKS_NUM         = 1024 // Size of the lock array
)

Variables

This section is empty.

Functions

func Bsr

func Bsr(i uint32) uint32

func ByteArrayToUint64

func ByteArrayToUint64(bytes []byte) (uint64, int)

func FNV1a_32

func FNV1a_32(data []byte) uint32

func NewHashMap

func NewHashMap() *hashMap

func UintToByteArray

func UintToByteArray(val uint64) []byte

Types

type Collection

type Collection struct {
	Name string
	// contains filtered or unexported fields
}

func (*Collection) Del

func (c *Collection) Del(key string)

func (*Collection) Get

func (c *Collection) Get(key string) (string, error)

func (*Collection) Set

func (c *Collection) Set(key, val string)

type Storage

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

func GetStorage

func GetStorage() *Storage

Return Storage instance.

func (*Storage) AddCollection

func (s *Storage) AddCollection(name string) (*Collection, error)

Add new collection to the Storage.

func (*Storage) DelCollection

func (s *Storage) DelCollection(name string)

Delete collection from the Storage.

func (*Storage) GetCollection

func (s *Storage) GetCollection(name string) *Collection

Get collection from the Storage. Return *colleciton or nil.

Jump to

Keyboard shortcuts

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