Documentation ¶
Overview ¶
Package batch batches multiple operations into batch files and stores the batch files in a distributed content-addressable storage (DCAS or CAS). A reference to the main batch file (core index) is then anchored on the anchoring system as Sidetree transaction.
Batch Writer basic flow:
1) accept operations being delivered via Add method 2) 'cut' configurable number of operations into batch files 3) store batch files into CAS (content addressable storage) 4) write the anchor string referencing core index file URI to the underlying anchoring system
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnchorWriter ¶ added in v0.6.0
type AnchorWriter interface { // WriteAnchor writes the anchor string as a transaction to anchoring system WriteAnchor(anchor string, artifacts []*protocol.AnchorDocument, ops []*operation.Reference, protocolVersion uint64) error // Read ledger transaction Read(sinceTransactionNumber int) (bool, *txn.SidetreeTxn) }
AnchorWriter defines an interface to access the underlying anchoring system.
type CompressionProvider ¶ added in v0.1.4
type CompressionProvider interface { // Compress will compress data using specified algorithm. Compress(alg string, data []byte) ([]byte, error) }
CompressionProvider defines an interface for handling different types of compression.
type Context ¶
type Context interface { Protocol() protocol.Client Anchor() AnchorWriter OperationQueue() cutter.OperationQueue }
Context contains batch writer context. 1) protocol information client 2) content addressable storage client 3) anchor writer.
type Option ¶
Option defines Writer options such as batch timeout.
func WithBatchTimeout ¶
WithBatchTimeout allows for specifying batch timeout.
func WithMonitorInterval ¶ added in v1.0.0
WithMonitorInterval specifies the interval in which the operation queue is monitored in order to see if the maximum batch size has been reached.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements batch writer.
func New ¶
New creates a new Writer with the given namespace. Writer accepts operations being delivered via Add, orders them, and then uses the batch cutter to form the operations batch files. The URI of main batch file (index core) will be written as part of anchor string to the given ledger.
func (*Writer) Add ¶
func (r *Writer) Add(op *operation.QueuedOperation, protocolVersion uint64) error
Add the given operation to a queue of operations to be batched and anchored on anchoring system.
func (*Writer) Start ¶
func (r *Writer) Start()
Start periodic anchoring of operation batches to anchoring system.