Documentation ¶
Index ¶
- func IDToFilename(id uint64) string
- func NewFilename(id uint64, dir string) string
- func ParseFileID(name string) (uint64, bool)
- type Builder
- type ConcatIterator
- type Iterator
- 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
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 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) error
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 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