Commit bc44049f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6b6f98c5
......@@ -48,7 +48,7 @@ import (
// tracked set.
// .Update(δZ) -> δF - update files δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
// .SliceByRev(lo, hi) -> []δF - query for all changes with rev ∈ (lo, hi]
// .SliceByRev(lo, hi) -> []δF - query for all files changes with rev ∈ (lo, hi]
// .SliceByFileRev(file, lo, hi) -> []δfile - query for changes of file with rev ∈ (lo, hi]
// .LastBlkRev(file, #blk, at) - query for what is last revision that changed
// file[#blk] as of @at database state.
......@@ -58,6 +58,8 @@ import (
// []blk
//
// XXX concurrent use
//
// XXX see also zodb.ΔTail
type ΔFtail struct {
// ΔFtail merge btree.ΔTail with history of ZBlk
δBtail *xbtree.ΔTail
......@@ -66,11 +68,14 @@ type ΔFtail struct {
// ΔF represents a change in files space.
type ΔF struct {
Rev zodb.Tid
Change map[*BigFile]SetI64 // file -> δfile (= {}#blk)
Rev zodb.Tid
Change map[*BigFile]SetI64 // file -> δfile (= {}#blk)
}
func NewΔFTail(at0 zodb.Tid) *ΔFtail {
// NewΔFtail creates new ΔFtail object.
//
// Initial coverage of created ΔFtail is (at₀, at₀].
func NewΔFtail(at0 zodb.Tid) *ΔFtail {
return &ΔFtail{
δBtail: xbtree.NewΔTail(at0),
fileIdx: make(map[*btree.LOBTree]SetBigFile),
......@@ -84,6 +89,8 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { panic("TODO") }
// Track adds tree path to tracked set and associates path root with file.
//
// XXX text
//
// A root can be associated with several files (each provided on different Track call).
func (δFtail *ΔFtail) Track(file *BigFile, path []btree.LONode) {
δFtail.δBtail.Track(path)
......@@ -95,6 +102,8 @@ func (δFtail *ΔFtail) Track(file *BigFile, path []btree.LONode) {
}
files.Add(file)
// XXX mark something dirty so that LastBlkRev and Slice* know what to rebuild?
// XXX debug
/*
leaf := path[len(path)-1].(*btree.LOBucket)
......@@ -106,7 +115,7 @@ func (δFtail *ΔFtail) Track(file *BigFile, path []btree.LONode) {
// Update updates δFtail given raw ZODB changes.
//
// It returns corresponding change in files space.
// It returns change in files space that corresponds to δZ.
func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) ΔF {
δB := δFtail.δBtail.Update(δZ)
δF := ΔF{Rev: δB.Rev, Change: make(map[*BigFile]SetI64)}
......@@ -132,7 +141,10 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) ΔF {
return δF
}
// XXX ForgetPast
// ForgetPast discards all δFtail entries with rev ≤ revCut.
func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
panic("TODO")
}
// LastBlkRev returns last revision that changed file[blk] as of @at database state.
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment