Documentation ¶
Overview ¶
Package batchfossilizer implements a fossilizer that fossilizes batches of data using a merkle tree. The evidence will contain the merkle root, the merkle path, and a timestamp.
Index ¶
Constants ¶
const ( // Name is the name set in the fossilizer's information. Name = "batchfossilizer" // Description is the description set in the fossilizer's information. Description = "Stratumn Batch Fossilizer" )
const ( // DefaultInterval is the default interval between batches. DefaultInterval = 10 * time.Minute // DefaultMaxLeaves if the default maximum number of leaves of a Merkle // tree. DefaultMaxLeaves = 32 * 1024 // DefaultMaxSimBatches is the default maximum number of simultaneous // batches. DefaultMaxSimBatches = 1 )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(ctx context.Context, config *Config, f fossilizer.Adapter, q fossilizer.FossilsQueue) fossilizer.Adapter
New creates an instance of a batch Fossilizer by wrapping an existing fossilizer. You should cancel the input context to properly free internal go routines when you don't need the fossilizer.
func RegisterFlags ¶ added in v0.3.1
func RegisterFlags()
RegisterFlags registers the flags used by batch fossilizers.
Types ¶
type Config ¶
type Config struct { // A version string that will be set in the store's information. Version string // A git commit hash that will be set in the store's information. Commit string // Interval between batches. Interval time.Duration // Maximum number of leaves of a Merkle tree. MaxLeaves int // Maximum number of simultaneous batches. MaxSimBatches int }
Config contains configuration options for the fossilizer.
func ConfigFromFlags ¶ added in v0.3.1
ConfigFromFlags builds the configuration from command-line flags.
func (Config) GetInterval ¶
GetInterval returns the configuration's interval or the default value.
func (Config) GetMaxLeaves ¶
GetMaxLeaves returns the configuration's maximum number of leaves of a Merkle tree or the default value.
func (Config) GetMaxSimBatches ¶
GetMaxSimBatches returns the configuration's maximum number of simultaneous batches or the default value.
type Fossilizer ¶
type Fossilizer struct {
// contains filtered or unexported fields
}
Fossilizer is the type that implements github.com/stratumn/go-core/fossilizer.Adapter.
func (*Fossilizer) AddFossilizerEventChan ¶
func (a *Fossilizer) AddFossilizerEventChan(fossilizerEventChan chan *fossilizer.Event)
AddFossilizerEventChan adds a new listener.
type Info ¶
type Info struct { Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` Commit string `json:"commit"` }
Info is the info returned by GetInfo.
type PendingProof ¶ added in v0.3.1
type PendingProof struct {
// contains filtered or unexported fields
}
PendingProof is used to store an incomplete proof (waiting for the proof of the wrapped fossilizer).