Documentation ¶
Index ¶
- Constants
- Variables
- func AppendToWal(forNodeId string, a Action, collection string, key []byte, value []byte, ...) error
- func DbGarbageCollector(db *badger.DB)
- func DecodeValue(content []byte, writeTo interface{}) error
- func EncodeValue(data interface{}) ([]byte, error)
- func FromBytes(i []byte, t interface{}) (err error)
- func FromString(content string, writeTo interface{}) error
- func ToBytes(i interface{}) (k []byte, err error)
- func ToString(data interface{}) (string, error)
- type Action
- type Collection
- func (c *Collection) BackUp()
- func (c *Collection) Close()
- func (c *Collection) Delete(k interface{}) error
- func (c *Collection) DeleteCollection() error
- func (c *Collection) DeleteKeys(keys [][]byte, updateStats func([]byte)) error
- func (c *Collection) DeleteRaw(k []byte) error
- func (c *Collection) Exists(key []byte) (bool, error)
- func (c *Collection) Get(k interface{}, v interface{}) error
- func (c *Collection) GetFilteredIterator(from interface{}, till interface{}) (*Iterator, error)
- func (c *Collection) GetIterator() (*Iterator, error)
- func (c *Collection) GetIteratorFrom(from interface{}) (*Iterator, error)
- func (c *Collection) GetIteratorFromRaw(from []byte) (*Iterator, error)
- func (c *Collection) GetRaw(k []byte) ([]byte, error)
- func (c *Collection) LoadBackUp()
- func (c *Collection) Set(k interface{}, v interface{}) error
- func (c *Collection) SetRaw(k []byte, v []byte) error
- func (c *Collection) UpsertFromStreaming(data []stream.StreamEntry, skip func(string, []byte) bool, updateStats func())
- type DbValue
- type Entry
- type Iterator
- type StorageManager
- type Wal
- type WalIterator
Constants ¶
View Source
const NODE_STATS_DB_NAME = "_node"
View Source
const STATUS_FILE = "status"
View Source
const SYNC_DELETES_COLLECTION_NAME = "_sync_deletes"
View Source
const SYSTEM_DB_NAME = "_system"
View Source
const WAL_DIR = "wal"
Variables ¶
View Source
var ( ErrKeyNotFound = badger.ErrKeyNotFound ErrCollectionNameReserved = errors.New("this collection name cannot be used") ErrCollectionNotFound = errors.New("collection not found") )
Functions ¶
func AppendToWal ¶
func DbGarbageCollector ¶
func DbGarbageCollector(db *badger.DB)
func DecodeValue ¶
func EncodeValue ¶
func FromString ¶
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
func OpenCollection ¶
func OpenCollection(collectionName string) (*Collection, error)
func (*Collection) BackUp ¶
func (c *Collection) BackUp()
func (*Collection) Close ¶
func (c *Collection) Close()
func (*Collection) Delete ¶
func (c *Collection) Delete(k interface{}) error
func (*Collection) DeleteCollection ¶
func (c *Collection) DeleteCollection() error
func (*Collection) DeleteKeys ¶
func (c *Collection) DeleteKeys(keys [][]byte, updateStats func([]byte)) error
func (*Collection) DeleteRaw ¶
func (c *Collection) DeleteRaw(k []byte) error
func (*Collection) Get ¶
func (c *Collection) Get(k interface{}, v interface{}) error
func (*Collection) GetFilteredIterator ¶
func (c *Collection) GetFilteredIterator(from interface{}, till interface{}) (*Iterator, error)
func (*Collection) GetIterator ¶
func (c *Collection) GetIterator() (*Iterator, error)
func (*Collection) GetIteratorFrom ¶
func (c *Collection) GetIteratorFrom(from interface{}) (*Iterator, error)
func (*Collection) GetIteratorFromRaw ¶
func (c *Collection) GetIteratorFromRaw(from []byte) (*Iterator, error)
func (*Collection) LoadBackUp ¶
func (c *Collection) LoadBackUp()
func (*Collection) Set ¶
func (c *Collection) Set(k interface{}, v interface{}) error
func (*Collection) UpsertFromStreaming ¶
func (c *Collection) UpsertFromStreaming(data []stream.StreamEntry, skip func(string, []byte) bool, updateStats func())
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Usage:
test, err := storage.OpenCollection("test")
if err != nil { panic(err) } for i := 0; i < 10; i++ { fmt.Println(i) test.Set(i, "test") } it, err := test.GetFilteredIterator(2, 7) if err != nil { panic(err) } for it.HasMore() { var v string var k int err := it.Next(&k, &v) if err != nil { panic(err) } fmt.Println(k, "=", v) } it, err := test.GetIterator() if err != nil { panic(err) } for it.HasMore() { var v string var k int err := it.Next(&k, &v) if err != nil { panic(err) } fmt.Println(k, "=", v) } it.Close()
func GetFilteredIterator ¶
func GetIterator ¶
func GetIteratorFrom ¶
func GetIteratorFromRaw ¶
func (*Iterator) HasMoreWithPrefix ¶
type StorageManager ¶
type StorageManager struct {
// contains filtered or unexported fields
}
func InitStorageManager ¶
func InitStorageManager() *StorageManager
func (*StorageManager) DeleteCollection ¶
func (db *StorageManager) DeleteCollection(collectionName string) (err error)
func (*StorageManager) GetCollection ¶
func (db *StorageManager) GetCollection(collectionName string) (*Collection, error)
func (*StorageManager) Shutdown ¶
func (db *StorageManager) Shutdown()
type Wal ¶
type Wal struct {
// contains filtered or unexported fields
}
func (*Wal) GetIterator ¶
func (w *Wal) GetIterator() *WalIterator
func (*Wal) TruncateFront ¶
type WalIterator ¶
type WalIterator struct {
// contains filtered or unexported fields
}
func StartScan ¶
func StartScan(nodeId string) (*WalIterator, error)
func (*WalIterator) AllStreamed ¶
func (it *WalIterator) AllStreamed()
WARNING, it will delete the wal for the node
func (*WalIterator) HasMore ¶
func (it *WalIterator) HasMore() bool
func (*WalIterator) Next ¶
func (it *WalIterator) Next() (Entry, error)
func (*WalIterator) PullNext ¶
func (it *WalIterator) PullNext() (Entry, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.