Versions in this module Expand all Collapse all v0 v0.0.1 Sep 27, 2022 Changes in this version + func GetHashStrategies() map[string]hash.Hash + func NumNodes(node *Node) int + type Bucket struct + Content *bytes.Buffer + ID string + Timestamp time.Time + Topic string + func NewBucket(size uint64, topic string) (b *Bucket) + func (b *Bucket) Size() uint64 + func (b *Bucket) Used() bool + func (b *Bucket) WriteContent(bs []byte) bool + func (b Bucket) CalculateHash() ([]byte, error) + func (b Bucket) Equals(other Content) (bool, error) + type BucketPool struct + Topic string + func NewBucketPool(maxNum uint64, size uint64, topic string) (bp *BucketPool) + func (bp *BucketPool) Get() (b Bucket, err error) + func (bp *BucketPool) Len() int + func (bp *BucketPool) Put(b Bucket) bool + type ByteContent struct + Content []byte + func (bc ByteContent) CalculateHash() ([]byte, error) + func (bc ByteContent) Equals(other Content) (bool, error) + func (bc ByteContent) MarshalJSON() ([]byte, error) + type Content interface + CalculateHash func() ([]byte, error) + Equals func(other Content) (bool, error) + type MerkleTree struct + HashStrategy string + Leafs []*Node + MerkleRoot []byte + Root *Node + func ForestToTree(trees []MerkleTree) (*MerkleTree, error) + func MakeTree(bp *BucketPool) (*MerkleTree, error) + func NewTree(cs []Content) (*MerkleTree, error) + func NewTreeWithHashStrategy(cs []Content, hashStrategy string) (*MerkleTree, error) + func (m *MerkleTree) ExtendTree(cs []Content) error + func (m *MerkleTree) GetMerklePath(content Content) ([][]byte, []int64, error) + func (m *MerkleTree) Isempty() bool + func (m *MerkleTree) RebuildTree() error + func (m *MerkleTree) RebuildTreeWith(cs []Content) error + func (m *MerkleTree) String() string + func (m *MerkleTree) VerifyContent(content Content) (bool, error) + func (m *MerkleTree) VerifyTree() (bool, error) + type Node struct + C Content + Dup bool + Hash []byte + Left *Node + Right *Node + func (n *Node) String() string + func (n *Node) UnmarshalJSON(byteData []byte) error + type StorageBucket struct + Content []byte + ID string + Size uint64 + Timestamp time.Time + Topic string + func DataInStorageTree(data []byte, tree MerkleTree) (bool, StorageBucket, error) + func (sb *StorageBucket) ReadContent() (data [][]byte, err error) + func (sb StorageBucket) CalculateHash() ([]byte, error) + func (sb StorageBucket) Equals(other Content) (bool, error) + func (sb StorageBucket) MarshalJSON() ([]byte, error)