Skip to content

Commit

Permalink
Add more godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
dimartiro committed Sep 6, 2024
1 parent 384ce38 commit 286c878
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/mmr/mmr.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ var (
errorNotEnoughPeeks = errors.New("not enough peaks")
)

// MMRStorage is an interface that defines the necessary methods for a
// storage mechanism in a Merkle Mountain Range (MMR). It allows for
// retrieving, appending, and committing elements to the MMR structure.
type MMRStorage[T any] interface {
getElement(pos uint64) (*T, error)
append(pos uint64, elements []T) error
commit() error
}

// MergeFunc defines a function type used to merge two elements in the MMR.
// It takes two elements, `left` and `right`, and returns a pointer to the
// merged result or an error if the merge operation fails.
type MergeFunc[T any] func(left, right T) (*T, error)

// MMR represents a Merkle Mountain Range (MMR) which is a persistent,
Expand Down

0 comments on commit 286c878

Please sign in to comment.