manyrocks

package
v0.0.0-...-f5d5260 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManyRocks

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

ManyRocks implements the storage.StoreManager interface

func New

func New(opts *Opts, log bark.Logger) (*ManyRocks, error)

New creates and initializes a ManyRocks object

func (*ManyRocks) GetExtentInfo

func (t *ManyRocks) GetExtentInfo(id s.ExtentUUID) (info *s.ExtentInfo, err error)

GetExtentInfo returns information about an extent

func (*ManyRocks) ListExtents

func (t *ManyRocks) ListExtents() (extents []s.ExtentUUID, err error)

ListExtents returns a list of extents available on the store

func (*ManyRocks) OpenExtent

func (t *ManyRocks) OpenExtent(id s.ExtentUUID, keyPattern s.KeyPattern, notify s.NotifyFunc, failIfNotExist bool) (s.ExtentStore, error)

OpenExtent opens an extent, adhering to the storage.ExtentStore interface

type Opts

type Opts struct {
	BaseDir string
}

Opts are the options passed into creating a new instance of ManyRocks

type Rock

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

Rock implements the storage.ExtentStore interface; it uses a separate RocksDB instance for each extent.

func OpenExtentDB

func OpenExtentDB(id s.ExtentUUID, path string) (*Rock, error)

OpenExtentDB gets a handle to the raw extent DB

func (*Rock) Close

func (t *Rock) Close()

Close cleans up this interface. Deregisters the notification channel automatically.

func (*Rock) CloseExtentDB

func (t *Rock) CloseExtentDB()

CloseExtentDB closes the handle to the raw extent DB

func (*Rock) DeleteExtent

func (t *Rock) DeleteExtent()

DeleteExtent marks the extent store for deletion. When the handle is closed this would delete the entire extent.

func (*Rock) Get

func (t *Rock) Get(addr s.Address) (key s.Key, val s.Value, nextAddr s.Address, nextKey s.Key, err error)

Get retrieves the message corresponding to the given address

func (*Rock) GetKey

func (t *Rock) GetKey(getKeyAddr s.Address) (key s.Key, err error)

GetKey returns the key of the message at the given address. In a sense, it is the inverse

func (*Rock) GetMany

func (t *Rock) GetMany(addr s.Address, numMsgs int32, endAddr s.Address) (msgs []s.KeyValue, nextAddr s.Address, nextKey s.Key, err error)

GetMany is like Get, but returns a batch of max 'numMsgs' between [addr, endAddr)

func (*Rock) Next

func (t *Rock) Next(addr s.Address) (nextAddr s.Address, nextKey s.Key, err error)

Next returns the address of the the message immediately following the one at the given address

func (*Rock) Purge

func (t *Rock) Purge(purgeAddr s.Address) (nextAddr s.Address, nextKey s.Key, err error)

Purge deletes all messages whose address is less than or equal to the given address.

func (*Rock) Put

func (t *Rock) Put(key s.Key, val s.Value) (addr s.Address, err error)

Put inserts message into the extent against the given 'key' and returns its 'address'

func (*Rock) SeekCeiling

func (t *Rock) SeekCeiling(ceilKey s.Key) (addr s.Address, key s.Key, err error)

SeekCeiling returns the address of the message for the given 'key' or the one following it

func (*Rock) SeekFirst

func (t *Rock) SeekFirst() (addr s.Address, key s.Key, err error)

SeekFirst returns the address and key of the first message available

func (*Rock) SeekFloor

func (t *Rock) SeekFloor(floorKey s.Key) (addr s.Address, key s.Key, err error)

SeekFloor returns the address of the message less than or equal to the given key

func (*Rock) SeekLast

func (t *Rock) SeekLast() (addr s.Address, key s.Key, err error)

SeekLast returns the address and key of the last message available

func (*Rock) Sync

func (t *Rock) Sync()

Sync ensures the latest key is flushed to disk.

Jump to

Keyboard shortcuts

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