Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrIndexNotFound = errors.New("index file not found") ErrIndexExpired = errors.New("index file out of date") )
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB provides a simple key-value-store-like interface using bsearch.Searcher, returning the first value from path for a given key (if you need more control you're encouraged to use bsearch.Searcher directly).
func NewDB ¶
NewDB returns a new DB for the file at path. The caller is responsible for calling DB.Close() when finished (e.g. via defer).
func (*DB) Close ¶
func (db *DB) Close()
Close closes our Searcher's underlying reader (if applicable)
type Index ¶
type Index struct {
Delimiter []byte `yaml:"delim"`
Epoch int64 `yaml:"epoch"`
Filepath string `yaml:"filepath"`
Header bool `yaml:"header"`
List []IndexEntry `yaml:"list"`
}
Index provides index metadata for Filepath
func LoadIndex ¶
LoadIndex loads Index from the associated index file for path. Returns ErrNotFound if no index file exists. Returns ErrIndexExpired if path is newer than the index file.
func NewIndexOptions ¶
func NewIndexOptions(path string, opt IndexOptions) (*Index, error)
NewIndex creates a new Index for path with delim as the delimiter
type IndexEntry ¶
type IndexOptions ¶
type Searcher ¶
type Searcher struct {
Index *Index // bsearch index
// contains filtered or unexported fields
}
Searcher provides binary search functionality on byte-ordered CSV-style delimited text files.
func NewSearcher ¶
NewSearcher returns a new Searcher for path using default options. The caller is responsible for calling *Searcher.Close() when finished.
func NewSearcherOptions ¶
func NewSearcherOptions(path string, opt SearcherOptions) (*Searcher, error)
NewSearcherOptions returns a new Searcher for path using opt. The caller is responsible for calling *Searcher.Close() when finished.
func (*Searcher) Close ¶
func (s *Searcher) Close()
Close closes the searcher's reader (if applicable)
func (*Searcher) Line ¶
Line returns the first line in the reader that begins with the key k, using a binary search (data must be bytewise-ordered).
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
bsearch
command
|
|
|
bsearch_compress
command
|
|
|
bsearch_index
command
|
|
|
bsearch_lint_index
command
|
|