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 blockchain 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 blockchain
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockchainClient ¶
type BlockchainClient interface { // WriteAnchor writes the anchor string as a transaction to blockchain WriteAnchor(anchor string, protocolGenesisTime uint64) error // Read ledger transaction Read(sinceTransactionNumber int) (bool, *txn.SidetreeTxn) }
BlockchainClient defines an interface to access the underlying blockchain.
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 Blockchain() BlockchainClient OperationQueue() cutter.OperationQueue }
Context contains batch writer context. 1) protocol information client 2) content addressable storage client 3) blockchain client.
type Option ¶
Option defines Writer options such as batch timeout.
func WithBatchTimeout ¶
WithBatchTimeout allows for specifying batch timeout.
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, protocolGenesisTime uint64) error
Add the given operation to a queue of operations to be batched and anchored on blockchain.
func (*Writer) Start ¶
func (r *Writer) Start()
Start periodic anchoring of operation batches to blockchain.