mem

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

In-Memory

In-Memory implementations of the storage interface

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BTreeFactory

func BTreeFactory() store.Storage

BTreeFactory generates a Cache storage implementation

func CacheFactory

func CacheFactory() store.Storage

CacheFactory generates a Cache storage implementation

func SyncBTreeFactory

func SyncBTreeFactory() store.Storage

SyncBTreeFactory generates a concurrently safe BTree storage implementation

func SyncCacheFactory

func SyncCacheFactory() store.Storage

SyncCacheFactory generates a SyncCache storage implementation

func SyncTrieFactory

func SyncTrieFactory() store.Storage

SyncTrieFactory generates a SyncTrie storage implementation

func TrieFactory

func TrieFactory() store.Storage

TrieFactory generates a Trie storage implementation

Types

type Btree

type Btree struct {
	*btree.BTree
}

Btree is a btree storage implementation

func (*Btree) Close

func (b *Btree) Close() error

Close shuts down the storage and performs any needed cleanup operations

func (*Btree) Get

func (b *Btree) Get(key store.Key) (store.Element, error)

Get retrieves an element based on the given key

func (*Btree) Metadata

func (b *Btree) Metadata() store.Metadata

Metadata returns the metadata for the given storage

func (*Btree) Put

func (b *Btree) Put(element store.Element) error

Put stores an element in the storage based on the given key

type Cache

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

Cache is an in memory struct implementing the storage interface it s the most efficient one in terms of performance and is used for a baseline regarding tests

func NewCache

func NewCache() *Cache

NewCache creates a new Cache instance

func (*Cache) Close

func (c *Cache) Close() error

Close will run any maintenance operations for the store

func (*Cache) Get

func (c *Cache) Get(key store.Key) (store.Element, error)

Get retrieves and element from the cache

func (*Cache) Metadata

func (c *Cache) Metadata() store.Metadata

Metadata returns internal statistics about the storage It s not meant to serve anny functionality, but used only for testing

func (*Cache) Put

func (c *Cache) Put(element store.Element) error

Put adds an element to the cache

type SyncBTree

type SyncBTree struct {
	*btree.BTree
}

SyncBTree implements a storage based on a Btree data struct

func (*SyncBTree) Close

func (s *SyncBTree) Close() error

Close shuts down the storage and performs any needed cleanup

func (*SyncBTree) Get

func (s *SyncBTree) Get(key store.Key) (store.Element, error)

Get returns an element based on the given key

func (*SyncBTree) Metadata

func (s *SyncBTree) Metadata() store.Metadata

Metadata returns the metadata of the given storage

func (*SyncBTree) Put

func (s *SyncBTree) Put(element store.Element) error

Put stores an element in the storage for the given key

type SyncCache

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

SyncCache is an in memory struct implementing the storage interface this implementation is thread-safe

func NewSyncCache

func NewSyncCache() *SyncCache

NewSyncCache creates a new Cache instance

func (*SyncCache) Close

func (sc *SyncCache) Close() error

Close will run any maintenance operations

func (*SyncCache) Get

func (sc *SyncCache) Get(key store.Key) (store.Element, error)

Get retrieves and element from the cache

func (*SyncCache) Metadata

func (sc *SyncCache) Metadata() store.Metadata

Metadata returns internal statistics about the storage It s not meant to serve anny functionality, but used only for testing

func (*SyncCache) Put

func (sc *SyncCache) Put(element store.Element) error

Put adds an element to the cache

type SyncTrie

type SyncTrie struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SyncTrie is an in memory struct implementing the storage interface it s the most efficient one in terms of performance and is used for a baseline regarding tests

func NewSyncTrie

func NewSyncTrie() *SyncTrie

NewSyncTrie creates a new Cache instance

func (*SyncTrie) Close

func (st *SyncTrie) Close() error

Close will run any maintainance operations

func (*SyncTrie) Get

func (st *SyncTrie) Get(key store.Key) (store.Element, error)

Get retrieves and element from the trie

func (*SyncTrie) Metadata

func (st *SyncTrie) Metadata() store.Metadata

Metadata returns internal statistics about the storage It s not meant to serve anny functionality, but used only for testing

func (*SyncTrie) Put

func (st *SyncTrie) Put(element store.Element) error

Put adds an element to the trie

type Trie

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

Trie is an in memory struct implementing the storage interface

func NewTrie

func NewTrie() *Trie

NewTrie creates a new Cache instance

func (*Trie) Close

func (t *Trie) Close() error

Close will run any maintenance operations

func (*Trie) Get

func (t *Trie) Get(key store.Key) (store.Element, error)

Get retrieves and element from the trie

func (*Trie) Metadata

func (t *Trie) Metadata() store.Metadata

Metadata returns internal statistics about the storage It s not meant to serve anny functionality, but used only for testing

func (*Trie) Put

func (t *Trie) Put(element store.Element) error

Put adds an element to the trie

Jump to

Keyboard shortcuts

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