Tracks metadata for an in-progress transaction during direct fragment-to-storage streaming of changes.
When a consumer streams transaction fragments directly to storage (for shapes without subquery dependencies), this struct tracks the transaction metadata until commit is received.
This is an antipod module to Electric.Replication.TransactionBuilder. This module only tracks metadata related to the current transaction for which txn fragments are processed as the fragments themselves are written to strorage and are discarded from memory immediately, while the TransactionBuilder module accumulates all changes in memory and returns a complete transaction after seeing a Commit.
Summary
Functions
Create a new pending transaction tracker.
Update the pending transaction with changes that were written to storage.
Types
@type t() :: %Electric.Shapes.Consumer.PendingTxn{ consider_flushed?: boolean(), num_changes: non_neg_integer(), storage_duration: term(), total_bytes: non_neg_integer(), xid: pos_integer() }
Functions
@spec new(pos_integer()) :: t()
Create a new pending transaction tracker.
@spec update_with_changes( t(), non_neg_integer(), non_neg_integer(), non_neg_integer() ) :: t()
Update the pending transaction with changes that were written to storage.