Commit 8ee32480 authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: ΔTail += Data()

This gives access to raw data stored in ΔTail. We'll need this in the
next commit, as well as going through raw δtail data is also generally
useful.
parent 60682993
......@@ -87,6 +87,13 @@ func (δtail *ΔTail) Len() int {
return len(δtail.tailv)
}
// Data returns slice with δtail data.
//
// The caller must not modify returned slice.
func (δtail *ΔTail) Data() /*readonly*/ []ΔRevEntry {
return δtail.tailv
}
// Head returns newest database state for which δtail has history coverage.
//
// Head is ↑ on Append, in particular it does not ↓ on Forget even if δtail becomes empty.
......
......@@ -61,6 +61,10 @@ func TestΔTail(t *testing.T) {
t.Fatalf("tailv:\nhave: %v\nwant: %v", δtail.tailv, tailv)
}
if d := δtail.Data(); !tailvEqual(d, tailv) {
t.Fatalf("Data():\nhave: %v\nwant: %v", d, tailv)
}
if l := δtail.Len(); l != len(tailv) {
t.Fatalf("Len() -> %d ; want %d", l, len(tailv))
}
......
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