Documentation ¶
Overview ¶
Package batchfossilizer implements a fossilizer that fossilize batches of data using a Merkle tree. The evidence will contain the Merkle root, the Merkle path, and a timestamp.
Index ¶
- Constants
- type Config
- type Fossilizer
- func (a *Fossilizer) AddFossilizerEventChan(fossilizerEventChan chan *fossilizer.Event)
- func (a *Fossilizer) Fossilize(ctx context.Context, data []byte, meta []byte) error
- func (a *Fossilizer) GetInfo(ctx context.Context) (interface{}, error)
- func (a *Fossilizer) SetTransformer(t Transformer)
- func (a *Fossilizer) Start(ctx context.Context) error
- func (a *Fossilizer) Started() <-chan struct{}
- type Info
- type Transformer
Constants ¶
const ( // Name is the name set in the fossilizer's information. Name = "batch" // Description is the description set in the fossilizer's information. Description = "Stratumn Batch Fossilizer" // 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 // DefaultArchive is whether to archive completed batches by default. DefaultArchive = true // DefaultStopBatch is whether to do a batch on stop by default. DefaultStopBatch = true // DefaultFSync is whether to fsync after saving a hash to disk by // default. DefaultFSync = false // PendingExt is the pending hashes filename extension. PendingExt = "pending" // DirPerm is the directory's permissions. DirPerm = 0600 // FilePerm is the files's permissions. FilePerm = 0600 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // A version string that will be set in the store's information. Version string // A git commit sha 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 // Where to store pending hashes. // If empty, pending hashes are not saved and will be lost if stopped // abruptly. Path string // Whether to archive completed batches. Archive bool // Whether to do a batch on stop. StopBatch bool // Whether to fsync after saving a hash to disk. FSync bool }
Config contains configuration options for the fossilizer.
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-indigocore/fossilizer.Adapter.
func (*Fossilizer) AddFossilizerEventChan ¶
func (a *Fossilizer) AddFossilizerEventChan(fossilizerEventChan chan *fossilizer.Event)
AddFossilizerEventChan implements github.com/stratumn/go-indigocore/fossilizer.Adapter.AddFossilizerEventChan.
func (*Fossilizer) Fossilize ¶
Fossilize implements github.com/stratumn/go-indigocore/fossilizer.Adapter.Fossilize.
func (*Fossilizer) GetInfo ¶
func (a *Fossilizer) GetInfo(ctx context.Context) (interface{}, error)
GetInfo implements github.com/stratumn/go-indigocore/fossilizer.Adapter.GetInfo.
func (*Fossilizer) SetTransformer ¶
func (a *Fossilizer) SetTransformer(t Transformer)
SetTransformer sets a transformer.
func (*Fossilizer) Start ¶
func (a *Fossilizer) Start(ctx context.Context) error
Start starts the fossilizer.
func (*Fossilizer) Started ¶
func (a *Fossilizer) Started() <-chan struct{}
Started return a channel that will receive once the fossilizer has started.
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 Transformer ¶
Transformer is the type of a function to transform results.