Documentation
¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Index ¶
- Variables
- func OpenTranslateStore(path, index, field string, partitionID, partitionN int, fsyncEnabled bool) (pilosa.TranslateStore, error)
- type TranslateEntryReader
- type TranslateStore
- func (s *TranslateStore) Close() (err error)
- func (s *TranslateStore) CreateKeys(keys ...string) (map[string]uint64, error)
- func (s *TranslateStore) Delete(records *roaring.Bitmap) (pilosa.Commitor, error)
- func (s *TranslateStore) EntryReader(ctx context.Context, offset uint64) (pilosa.TranslateEntryReader, error)
- func (s *TranslateStore) FindKeys(keys ...string) (map[string]uint64, error)
- func (s *TranslateStore) ForceSet(id uint64, key string) error
- func (s *TranslateStore) FreeIDs() (*roaring.Bitmap, error)
- func (s *TranslateStore) Match(filter func([]byte) bool) ([]uint64, error)
- func (s *TranslateStore) MaxID() (max uint64, err error)
- func (s *TranslateStore) MergeFree(tx *bolt.Tx, newIDs *roaring.Bitmap) error
- func (s *TranslateStore) Open() (err error)
- func (s *TranslateStore) PartitionID() int
- func (s *TranslateStore) ReadFrom(r io.Reader) (n int64, err error)
- func (s *TranslateStore) ReadOnly() bool
- func (s *TranslateStore) SetReadOnly(v bool)
- func (s *TranslateStore) Size() int64
- func (s *TranslateStore) TranslateID(id uint64) (string, error)
- func (s *TranslateStore) TranslateIDs(ids []uint64) ([]string, error)
- func (s *TranslateStore) WriteNotify() <-chan struct{}
- func (s *TranslateStore) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTranslateStoreClosed is returned when reading from an TranslateEntryReader // and the underlying store is closed. ErrTranslateStoreClosed = errors.New("boltdb: translate store closing") // ErrTranslateKeyNotFound is returned when translating key // and the underlying store returns an empty set ErrTranslateKeyNotFound = errors.New("boltdb: translating key returned empty set") )
Functions ¶
func OpenTranslateStore ¶
func OpenTranslateStore(path, index, field string, partitionID, partitionN int, fsyncEnabled bool) (pilosa.TranslateStore, error)
OpenTranslateStore opens and initializes a boltdb translation store.
Types ¶
type TranslateEntryReader ¶
type TranslateEntryReader struct {
// contains filtered or unexported fields
}
func (*TranslateEntryReader) Close ¶
func (r *TranslateEntryReader) Close() error
Close closes the reader.
func (*TranslateEntryReader) ReadEntry ¶
func (r *TranslateEntryReader) ReadEntry(entry *pilosa.TranslateEntry) error
ReadEntry reads the next entry from the underlying translate store.
type TranslateStore ¶
type TranslateStore struct {
// File path to database file.
Path string
// contains filtered or unexported fields
}
TranslateStore is an on-disk storage engine for translating string-to-uint64 values. An empty string will be converted into the sentinel byte slice:
var emptyKey = []byte{
0x00, 0x00, 0x00,
0x4d, 0x54, 0x4d, 0x54, // MTMT
0x00,
0xc2, 0xa0, // NO-BREAK SPACE
0x00,
}
func NewTranslateStore ¶
func NewTranslateStore(index, field string, partitionID, partitionN int, fsyncEnabled bool) *TranslateStore
NewTranslateStore returns a new instance of TranslateStore.
func (*TranslateStore) Close ¶
func (s *TranslateStore) Close() (err error)
Close closes the underlying database.
func (*TranslateStore) CreateKeys ¶
func (s *TranslateStore) CreateKeys(keys ...string) (map[string]uint64, error)
CreateKeys maps all keys to IDs, creating the IDs if they do not exist. If the translator is read-only, this will return an error.
func (*TranslateStore) Delete ¶
Delete removes the lookeup pairs in order to make avialble for reuse but doesn't commit the transaction for that is tied to the associated rbf transaction being successful
func (*TranslateStore) EntryReader ¶
func (s *TranslateStore) EntryReader(ctx context.Context, offset uint64) (pilosa.TranslateEntryReader, error)
EntryReader returns a reader that streams the underlying data file.
func (*TranslateStore) FindKeys ¶
func (s *TranslateStore) FindKeys(keys ...string) (map[string]uint64, error)
FindKeys looks up the ID for each key. Keys are not created if they do not exist. Missing keys are not considered errors, so the length of the result may be less than that of the input.
func (*TranslateStore) ForceSet ¶
func (s *TranslateStore) ForceSet(id uint64, key string) error
ForceSet writes the id/key pair to the store even if read only. Used by replication.
func (*TranslateStore) Match ¶
func (s *TranslateStore) Match(filter func([]byte) bool) ([]uint64, error)
Match finds the IDs of all keys matching a filter.
func (*TranslateStore) MaxID ¶
func (s *TranslateStore) MaxID() (max uint64, err error)
MaxID returns the highest id in the store.
func (*TranslateStore) Open ¶
func (s *TranslateStore) Open() (err error)
Open opens the translate file.
func (*TranslateStore) PartitionID ¶
func (s *TranslateStore) PartitionID() int
PartitionID returns the partition id the store was initialized with.
func (*TranslateStore) ReadFrom ¶
func (s *TranslateStore) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom reads the content and overwrites the existing store.
func (*TranslateStore) ReadOnly ¶
func (s *TranslateStore) ReadOnly() bool
ReadOnly returns true if the store is in read-only mode.
func (*TranslateStore) SetReadOnly ¶
func (s *TranslateStore) SetReadOnly(v bool)
SetReadOnly toggles whether store is in read-only mode.
func (*TranslateStore) Size ¶
func (s *TranslateStore) Size() int64
Size returns the number of bytes in the data file.
func (*TranslateStore) TranslateID ¶
func (s *TranslateStore) TranslateID(id uint64) (string, error)
TranslateID converts an integer ID to a string key. Returns a blank string if ID does not exist.
func (*TranslateStore) TranslateIDs ¶
func (s *TranslateStore) TranslateIDs(ids []uint64) ([]string, error)
TranslateIDs converts a list of integer IDs to a list of string keys.
func (*TranslateStore) WriteNotify ¶
func (s *TranslateStore) WriteNotify() <-chan struct{}
WriteNotify returns a channel that is closed when a new entry is written.