pub trait DataStreamingClient {
    fn get_all_accounts<'life0, 'async_trait>(
        &'life0 self,
        version: Version,
        start_index: Option<u64>
    ) -> Pin<Box<dyn Future<Output = Result<DataStreamListener, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn get_all_epoch_ending_ledger_infos<'life0, 'async_trait>(
        &'life0 self,
        start_epoch: Epoch
    ) -> Pin<Box<dyn Future<Output = Result<DataStreamListener, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn get_all_transaction_outputs<'life0, 'async_trait>(
        &'life0 self,
        start_version: Version,
        end_version: Version,
        proof_version: Version
    ) -> Pin<Box<dyn Future<Output = Result<DataStreamListener, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn get_all_transactions<'life0, 'async_trait>(
        &'life0 self,
        start_version: Version,
        end_version: Version,
        proof_version: Version,
        include_events: bool
    ) -> Pin<Box<dyn Future<Output = Result<DataStreamListener, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn continuously_stream_transaction_outputs<'life0, 'async_trait>(
        &'life0 self,
        known_version: u64,
        known_epoch: u64,
        target: Option<LedgerInfoWithSignatures>
    ) -> Pin<Box<dyn Future<Output = Result<DataStreamListener, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn continuously_stream_transactions<'life0, 'async_trait>(
        &'life0 self,
        start_version: Version,
        start_epoch: Epoch,
        include_events: bool,
        target: Option<LedgerInfoWithSignatures>
    ) -> Pin<Box<dyn Future<Output = Result<DataStreamListener, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn terminate_stream_with_feedback<'life0, 'async_trait>(
        &'life0 self,
        notification_id: NotificationId,
        notification_feedback: NotificationFeedback
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }
Expand description

The streaming client used by state sync to fetch data from the Aptos network to synchronize local state.

Notes:

  1. The streaming service streams data sequentially, so clients (e.g., state sync) can process data notifications in the order they’re received. For example, if we’re streaming transactions with proofs, state sync can assume the transactions are returned in monotonically increasing versions.
  2. If a stream completes (possibly prematurely), an end of stream notification will be sent to the listener. Once a stream has completed, it is the responsibility of the client to terminate the stream using this API.

Required Methods

Fetches the account states at the specified version. If start_index is specified, the account states will be fetched starting at the start_index (inclusive). Otherwise, the start index will 0. The specified version must be an epoch ending version, otherwise an error will be returned. Account state proofs are at the same version.

Fetches all epoch ending ledger infos starting at start_epoch (inclusive) and ending at the last known epoch advertised in the network.

Fetches all transaction outputs with proofs from start_version to end_version (inclusive) at the specified proof_version.

Fetches all transactions with proofs from start_version to end_version (inclusive) at the specified proof_version. If include_events is true, events are also included in the proofs.

Continuously streams transaction outputs with proofs as the blockchain grows. The stream starts at known_version + 1 (inclusive) and known_epoch, where the known_epoch is expected to be the epoch that contains known_version + 1, i.e., any epoch change at known_version must be noted by the client. Transaction output proof versions are tied to ledger infos within the same epoch, otherwise epoch ending ledger infos will signify epoch changes.

Note: if a target is provided, the stream will terminate once it reaches the target. Otherwise, it will continue indefinitely.

Continuously streams transactions with proofs as the blockchain grows. The stream starts at known_version + 1 (inclusive) and known_epoch, where the known_epoch is expected to be the epoch that contains known_version + 1, i.e., any epoch change at known_version must be noted by the client. Transaction proof versions are tied to ledger infos within the same epoch, otherwise epoch ending ledger infos will signify epoch changes.

If include_events is true, events are also included in the proofs.

Note: if a target is provided, the stream will terminate once it reaches the target. Otherwise, it will continue indefinitely.

Terminates the stream that sent the notification with the given notification_id and provides feedback for the termination reason.

Note:

  1. This is required because: (i) clients must terminate completed streams (after receiving an end of stream notification); and (ii) data payloads may be invalid, e.g., due to malformed data returned by a misbehaving peer. This notifies the streaming service to terminate the stream and take any action based on the provided feedback.
  2. Clients that wish to continue fetching data need to open a new stream.

Implementors