Documentation ¶
Index ¶
- Variables
- func NewAttrStore(path string) pilosa.AttrStore
- func OpenTranslateStore(path, index, field string, partitionID, partitionN int) (pilosa.TranslateStore, error)
- type TranslateEntryReader
- type TranslateStore
- func (s *TranslateStore) Close() (err error)
- func (s *TranslateStore) EntryReader(ctx context.Context, offset uint64) (pilosa.TranslateEntryReader, error)
- func (s *TranslateStore) ForceSet(id uint64, key string) error
- func (s *TranslateStore) MaxID() (max uint64, err 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) TranslateKey(key string, writable bool) (uint64, error)
- func (s *TranslateStore) TranslateKeys(keys []string, writable bool) ([]uint64, 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 NewAttrStore ¶
func NewAttrStore(path string) pilosa.AttrStore
NewAttrStore returns a new instance of AttrStore.
func OpenTranslateStore ¶
func OpenTranslateStore(path, index, field string, partitionID, partitionN int) (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) *TranslateStore
NewTranslateStore returns a new instance of TranslateStore.
func (*TranslateStore) Close ¶
func (s *TranslateStore) Close() (err error)
Close closes the underlying database.
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) 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) 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) TranslateKey ¶
func (s *TranslateStore) TranslateKey(key string, writable bool) (uint64, error)
TranslateKey converts a string key to an integer ID. If key does not have an associated id then one is created, unless writable is false, then the function will return the error pilosa.ErrTranslatingKeyNotFound.
func (*TranslateStore) TranslateKeys ¶
func (s *TranslateStore) TranslateKeys(keys []string, writable bool) ([]uint64, error)
TranslateKeys converts a slice of string keys to a slice of integer IDs. If a key does not have an associated id then one is created, unless writable is false, then the function will return the error pilosa.ErrTranslatingKeyNotFound.
func (*TranslateStore) WriteNotify ¶
func (s *TranslateStore) WriteNotify() <-chan struct{}
WriteNotify returns a channel that is closed when a new entry is written.