|
|
@ -9,6 +9,7 @@ import ( |
|
|
|
|
|
|
|
"go.vocdoni.io/dvote/censustree" |
|
|
|
"go.vocdoni.io/dvote/log" |
|
|
|
"go.vocdoni.io/proto/build/go/models" |
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/go-bare" |
|
|
|
"github.com/p4u/asmt/db" |
|
|
@ -31,6 +32,9 @@ type Tree struct { |
|
|
|
snapshotSize uint64 |
|
|
|
} |
|
|
|
|
|
|
|
// check that censustree.Tree interface is matched by Tree
|
|
|
|
var _ censustree.Tree = (*Tree)(nil) |
|
|
|
|
|
|
|
type Proof struct { |
|
|
|
Bitmap []byte |
|
|
|
Length int |
|
|
@ -114,6 +118,16 @@ func (t *Tree) IsPublic() bool { |
|
|
|
return atomic.LoadUint32(&t.public) == 1 |
|
|
|
} |
|
|
|
|
|
|
|
// Type returns the numeric identifier for the censusTree implementation
|
|
|
|
func (t *Tree) Type() models.Census_Type { |
|
|
|
return models.Census_UNKNOWN |
|
|
|
} |
|
|
|
|
|
|
|
// TypeString returns the name identifying the censustree implementation
|
|
|
|
func (t *Tree) TypeString() string { |
|
|
|
return models.Census_Type_name[int32(t.Type())] // reuse the naming generated by protobuf
|
|
|
|
} |
|
|
|
|
|
|
|
// Commit saves permanently the tree on disk
|
|
|
|
func (t *Tree) Commit() error { |
|
|
|
if t.snapshotRoot != nil { |
|
|
|