Documentation ¶
Index ¶
- Variables
- func NewAttrStore(path string) pilosa.AttrStore
- func OpenTranslateStore(path, index, field string, partitionID, partitionN int) (pilosa.TranslateStore, error)
- type BeforeAfterIDChange
- type BeforeAfterKeyChange
- type TranslateEntryReader
- type TranslateStore
- func (s *TranslateStore) Close() (err error)
- func (s *TranslateStore) ComputeTranslatorSummaryCols(partitionID int, topo *pilosa.Topology) (sum *pilosa.TranslatorSummary, err error)
- func (s *TranslateStore) ComputeTranslatorSummaryRows() (sum *pilosa.TranslatorSummary, err error)
- func (s *TranslateStore) CreateKeys(keys ...string) (map[string]uint64, error)
- func (s *TranslateStore) DumpBolt(label string)
- 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) GetFwdRevMaps(tx *bolt.Tx) (fwd map[string]uint64, rev map[uint64]string, err error)
- func (s *TranslateStore) GetStorePath() string
- func (s *TranslateStore) IDWalker(walk func(key string, col uint64)) error
- func (s *TranslateStore) KeyWalker(walk func(key string, col uint64)) 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) RepairKeys(topo *pilosa.Topology, verbose, applyKeyRepairs bool) (changed bool, err error)
- func (s *TranslateStore) SetFwdRevMaps(tx *bolt.Tx, fwd map[string]uint64, rev map[uint64]string) (err error)
- 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 BeforeAfterIDChange ¶ added in v2.3.0
type BeforeAfterKeyChange ¶ added in v2.3.0
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) ComputeTranslatorSummaryCols ¶ added in v2.3.0
func (s *TranslateStore) ComputeTranslatorSummaryCols(partitionID int, topo *pilosa.Topology) (sum *pilosa.TranslatorSummary, err error)
func (*TranslateStore) ComputeTranslatorSummaryRows ¶ added in v2.3.0
func (s *TranslateStore) ComputeTranslatorSummaryRows() (sum *pilosa.TranslatorSummary, err error)
func (*TranslateStore) CreateKeys ¶ added in v2.1.8
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) DumpBolt ¶ added in v2.3.0
func (s *TranslateStore) DumpBolt(label string)
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 ¶ added in v2.1.8
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) GetFwdRevMaps ¶ added in v2.3.0
func (*TranslateStore) GetStorePath ¶ added in v2.3.0
func (s *TranslateStore) GetStorePath() string
func (*TranslateStore) IDWalker ¶ added in v2.3.0
func (s *TranslateStore) IDWalker(walk func(key string, col uint64)) error
func (*TranslateStore) KeyWalker ¶ added in v2.3.0
func (s *TranslateStore) KeyWalker(walk func(key string, col uint64)) error
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) RepairKeys ¶ added in v2.3.0
func (s *TranslateStore) RepairKeys(topo *pilosa.Topology, verbose, applyKeyRepairs bool) (changed bool, err error)
only actually apply the fixes if applyKeyRepairs is true. if anything changed, return changed == true.
func (*TranslateStore) SetFwdRevMaps ¶ added in v2.3.0
func (s *TranslateStore) SetFwdRevMaps(tx *bolt.Tx, fwd map[string]uint64, rev map[uint64]string) (err error)
call s.notifyWrite() when done
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.