Skip to content

Conversation

@rtso
Copy link
Collaborator

@rtso rtso commented Jul 16, 2024

Description

Clean up transaction_stream.rs' (renamed from grpc_stream.rs`) so we can make a crate of it, which will be used in the SDK.

TransactionStream

transaction_stream.rs defines a struct TransactionStream that has these methods:

  • init_stream establishes a connection with the grpc stream
  • get_next_transaction_batch fetches the next transaction response from grpc
  • is_end_of_stream signals if you've reached the end of the stream
  • reconnect_to_grpc will attempt to reconnect with grpc if there's an error with the stream
  • reconnect_to_grpc_with_retries is a wrapper around reconnect_to_grpc that adds retry logic

How processors use TransactionStream

In worker.rs, fetch_transactions_from_transaction_stream will initialize and manage the TransactionStream, filtering transactions, sending the transactions to channel, handle reconnection if necessary.

Testing

cargo run --release -- -c config.yaml
with and without starting_version set

@rtso
Copy link
Collaborator Author

rtso commented Jul 16, 2024

Need to add this to this repo to avoid circular dep. Addressed all the comments in aptos-labs/aptos-indexer-processors#397

@rtso rtso requested a review from a team July 16, 2024 22:47
@rtso rtso force-pushed the rtso/txn-stream branch from 9cf9d3d to eb2959d Compare July 16, 2024 23:08
@rtso rtso merged commit 5c4719a into main Jul 18, 2024
@rtso rtso deleted the rtso/txn-stream branch July 18, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants