Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogSegCompare ¶
func LogSegCompare(a, b LogSegment) int
func SortLogSegments ¶
func SortLogSegments(segments []*LogSegment)
SortLogSegments sorts a slice of LogSegment pointers by commit count, then tx.
func StoreIndex ¶
StoreIndex persists the index to the given path. It writes to a temporary file first and then atomically renames it to the target path.
Types ¶
type Index ¶
type Index struct {
sync.RWMutex
Name string // eg "" for root
Commits *Tree[LogSegment]
Children map[string]*Index // map from subdir names to sub indices
}
func Build ¶
Build reconstructs the index from the filesystem rooted at root. extract is a closure that takes a filesystem path and returns a LogSegment if the file represents one. If extract returns nil, the file is ignored.
func (*Index) Add ¶
func (i *Index) Add(seg *LogSegment)
func (*Index) GobEncode ¶
GobEncode implements the gob.GobEncoder interface. It flattens the Index into a list of LogSegments for serialization.
func (*Index) List ¶
List returns the immediate child names at this index level. Returns the keys of the Children map.
func (*Index) LookupRange ¶
func (i *Index) LookupRange(vp string, from, to *int64) []LogSegment
func (*Index) Remove ¶
func (i *Index) Remove(seg *LogSegment) bool
type LogSegment ¶
type LogSegment struct {
StartCommit int64
StartTx int64
EndCommit int64
EndTx int64
RelPath string
}
func PointLogSegment ¶
func PointLogSegment(c, tx int64, p string) *LogSegment
func (*LogSegment) IsPoint ¶
func (s *LogSegment) IsPoint() bool
type Tree ¶
func (*Tree[T]) All ¶
All applies f to all elements in T in ascending order until f returns false. All returns whether or not f returns false