batchfossilizer

package
v0.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 13 Imported by: 4

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

View Source
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"
)
View Source
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

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

func ConfigFromFlags(version string, commit string) *Config

ConfigFromFlags builds the configuration from command-line flags.

func (Config) GetInterval

func (c Config) GetInterval() time.Duration

GetInterval returns the configuration's interval or the default value.

func (Config) GetMaxLeaves

func (c Config) GetMaxLeaves() int

GetMaxLeaves returns the configuration's maximum number of leaves of a Merkle tree or the default value.

func (Config) GetMaxSimBatches

func (c Config) GetMaxSimBatches() int

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.

func (*Fossilizer) Fossilize

func (a *Fossilizer) Fossilize(ctx context.Context, data []byte, meta []byte) error

Fossilize adds to the fossilizing queue.

func (*Fossilizer) GetInfo

func (a *Fossilizer) GetInfo(ctx context.Context) (interface{}, error)

GetInfo returns the fossilizer info.

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).

Directories

Path Synopsis
Package evidences defines batchfossilizer evidence types.
Package evidences defines batchfossilizer evidence types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL