diff --git a/apps/nextra/next.config.mjs b/apps/nextra/next.config.mjs index 90cc06f23..d967d5ac1 100644 --- a/apps/nextra/next.config.mjs +++ b/apps/nextra/next.config.mjs @@ -441,6 +441,11 @@ export default withBundleAnalyzer( "/en/build/indexer/indexer-sdk/documentation/version-tracking", permanent: true, }, + { + source: "/indexer/indexer-sdk/documentation/arcify-data", + destination: "/en/build/indexer/indexer-sdk/documentation/arcify-data", + permanent: true, + }, { source: "/indexer/indexer-sdk/documentation/run-processor", destination: diff --git a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx index 5fd252af7..ed534bf7a 100644 --- a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx +++ b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx @@ -18,4 +18,7 @@ export default { "version-tracking": { title: "Version Tracking", }, + "arcify-data": { + title: "Arcifying Data", + }, }; diff --git a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/arcify-data.mdx b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/arcify-data.mdx new file mode 100644 index 000000000..4b3a90e92 --- /dev/null +++ b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/arcify-data.mdx @@ -0,0 +1,40 @@ +--- +title: "Arcifying Step" +--- + +# Overview + +The `ArcifyStep` is a utility step in the processing pipeline that transforms owned data into reference-counted `Arc` instances. This is particularly useful when the data needs to be shared across multiple components or threads without unnecessary cloning. + +## Key Responsibilities + +1. **Convert to `Arc`**: Converts a vector of owned items into a vector of `Arc`-wrapped items. +2. **Preserve Metadata**: Maintains the transaction context metadata during transformation. + +## How It Works + +- The `ArcifyStep` takes a `TransactionContext` containing a vector of owned items. +- Each item in the vector is wrapped in an `Arc` to enable efficient sharing. +- The metadata from the original context is preserved in the output. + +## Example Usage + +### Converting Data to `Arc` + +```rust +let mut arcify_step = ArcifyStep::new(); +let input_context = TransactionContext { + data: vec![1, 2, 3], + metadata: TransactionMetadata { + start_version: 0, + end_version: 0, + start_transaction_timestamp: None, + end_transaction_timestamp: None, + total_size_in_bytes: 0, + }, +}; + +let result = arcify_step.process(input_context).await.unwrap().unwrap(); +assert_eq!(*result.data[0], 1); +``` + diff --git a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/steps.mdx b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/steps.mdx index 6db112236..57fc40344 100644 --- a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/steps.mdx +++ b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/steps.mdx @@ -106,3 +106,4 @@ The SDK implements [several common steps](https://github.com/aptos-labs/aptos-in 3. `VersionTrackerStep` tracks the progress of the processor and checkpoints the processor's progress. Read more about it [here](./version-tracking.mdx). 4. `OrderByVersionStep` orders transaction contextx by their starting versions. It buffers ordered these contexts and releases them at every poll interval. 5. `WriteRateLimitStep` limits the number of bytes written to the database per second. +6. `ArcifyStep` converts transaction data to Arc Instances. Read more about it [here](./arcify-data.mdx).