Documentation ¶
Index ¶
- func IDToFilename(id uint64) string
- func NewFilename(id uint64, dir string) string
- func NewMergeIterator(iters []y.Iterator, reverse bool) y.Iterator
- func ParseFileID(name string) (uint64, bool)
- type Builder
- type ConcatIterator
- type Iterator
- type MergeIterator
- type Table
- func (t *Table) Biggest() []byte
- func (t *Table) Close() error
- func (t *Table) DecrRef() error
- func (t *Table) DoesNotHave(key []byte) bool
- func (t *Table) Filename() string
- func (t *Table) ID() uint64
- func (t *Table) IncrRef()
- func (t *Table) NewIterator(reversed bool) *Iterator
- func (t *Table) Size() int64
- func (t *Table) Smallest() []byte
- type TableInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IDToFilename ¶
IDToFilename does the inverse of ParseFileID
func NewFilename ¶
NewFilename should be named TableFilepath -- it combines the dir with the ID to make a table filepath.
func NewMergeIterator ¶ added in v1.6.1
NewMergeIterator creates a merge iterator.
func ParseFileID ¶
ParseFileID reads the file id out of a filename.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is used in building a table.
func (*Builder) Add ¶
func (b *Builder) Add(key []byte, value y.ValueStruct)
Add adds a key-value pair to the block. If doNotRestart is true, we will not restart even if b.counter >= restartInterval.
func (*Builder) ReachedCapacity ¶
ReachedCapacity returns true if we... roughly (?) reached capacity?
type ConcatIterator ¶
type ConcatIterator struct {
// contains filtered or unexported fields
}
ConcatIterator concatenates the sequences defined by several iterators. (It only works with TableIterators, probably just because it's faster to not be so generic.)
func NewConcatIterator ¶
func NewConcatIterator(tbls []*Table, reversed bool) *ConcatIterator
NewConcatIterator creates a new concatenated iterator
func (*ConcatIterator) Seek ¶
func (s *ConcatIterator) Seek(key []byte)
Seek brings us to element >= key if reversed is false. Otherwise, <= key.
func (*ConcatIterator) Value ¶
func (s *ConcatIterator) Value() y.ValueStruct
Value implements y.Interface
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is an iterator for a Table.
func (*Iterator) Value ¶
func (itr *Iterator) Value() (ret y.ValueStruct)
Value follows the y.Iterator interface
type MergeIterator ¶ added in v1.6.1
type MergeIterator struct {
// contains filtered or unexported fields
}
MergeIterator merges multiple iterators. NOTE: MergeIterator owns the array of iterators and is responsible for closing them.
func (*MergeIterator) Close ¶ added in v1.6.1
func (mi *MergeIterator) Close() error
Close implements y.Iterator.
func (*MergeIterator) Key ¶ added in v1.6.1
func (mi *MergeIterator) Key() []byte
Key returns the key associated with the current iterator.
func (*MergeIterator) Next ¶ added in v1.6.1
func (mi *MergeIterator) Next()
Next returns the next element. If it is the same as the current key, ignore it.
func (*MergeIterator) Rewind ¶ added in v1.6.1
func (mi *MergeIterator) Rewind()
Rewind seeks to first element (or last element for reverse iterator).
func (*MergeIterator) Seek ¶ added in v1.6.1
func (mi *MergeIterator) Seek(key []byte)
Seek brings us to element with key >= given key.
func (*MergeIterator) Valid ¶ added in v1.6.1
func (mi *MergeIterator) Valid() bool
Valid returns whether the MergeIterator is at a valid element.
func (*MergeIterator) Value ¶ added in v1.6.1
func (mi *MergeIterator) Value() y.ValueStruct
Value returns the value associated with the iterator.
type Table ¶
Table represents a loaded table file with the info we have about it
func OpenTable ¶
OpenTable assumes file has only one table and opens it. Takes ownership of fd upon function entry. Returns a table with one reference count on it (decrementing which may delete the file! -- consider t.Close() instead). The fd has to writeable because we call Truncate on it before deleting.
func (*Table) DoesNotHave ¶
DoesNotHave returns true if (but not "only if") the table does not have the key. It does a bloom filter lookup.
func (*Table) IncrRef ¶
func (t *Table) IncrRef()
IncrRef increments the refcount (having to do with whether the file should be deleted)
func (*Table) NewIterator ¶
NewIterator returns a new iterator of the Table