Documentation ¶
Overview ¶
Copyright 2017 Pilosa Corp.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func NewAttrStore(path string) pilosa.AttrStore
- func OpenTranslateStore(path, index, field string) (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) 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) (id uint64, _ error)
- func (s *TranslateStore) TranslateKeys(keys []string) (ids []uint64, _ error)
- func (s *TranslateStore) WriteNotify() <-chan struct{}
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") )
Functions ¶
func NewAttrStore ¶
func NewAttrStore(path string) pilosa.AttrStore
NewAttrStore returns a new instance of AttrStore.
func OpenTranslateStore ¶
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.
func NewTranslateStore ¶
func NewTranslateStore(index, field string) *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)
Reader 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) 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) (id uint64, _ error)
TranslateKeys converts a string key to an integer ID. If key does not have an associated id then one is created.
func (*TranslateStore) TranslateKeys ¶
func (s *TranslateStore) TranslateKeys(keys []string) (ids []uint64, _ error)
TranslateKeys converts a string key to an integer ID. If key does not have an associated id then one is created.
func (*TranslateStore) WriteNotify ¶
func (s *TranslateStore) WriteNotify() <-chan struct{}
WriteNotify returns a channel that is closed when a new entry is written.