[RFC] Persistent Storage Architecture for Stratum V2 Share Accounting #1852
average-gary
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
|
I had a slightly different approach in mind. For share accounting, we can define a Persistence trait that abstracts over different storage backends. The default implementation would use the in-memory backend from channel_sv2, while downstream applications could provide their own implementations backed by a database or another persistence mechanism. The Persistence trait itself would remain completely storage-agnostic, ensuring that share accounting logic does not depend on whether the backend is in-memory, database-driven, or something else. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
Currently, Stratum V2 share accounting in SRI is purely in-memory, with share accounting logic contained within the channels-sv2 crate. This RFC proposes different architectural approaches to add persistent storage capabilities for share accounting data, block discovery records, and mining analytics while maintaining the existing clean separation of concerns.
Current Baseline (origin/main on 8e4cb26)
What exists today:
Current ShareAccounting capabilities:
Limitations of current approach:
Proposed Storage Architecture
Option 1: Trait-Based Storage Integration
Description: Add storage traits to the channels-sv2 crate with feature-gated integration directly in ShareAccounting.
Pros:
Cons:
Implementation approach:
Option 2: Dedicated Storage Service Role
Description: Create a new role (roles/storage/) that runs as a separate service, receiving storage events via async channels or network protocols.
Pros:
Cons:
Implementation approach:
There may even be other places we could hook into for persisting the data but share_accounting.rs already has access to data needed to store everything holistically.
Example Data Structures to Persist
FWIW, I am partial to Option 1 as it's the shortest path to completion but don't want to build in the wrong direction. :)
Beta Was this translation helpful? Give feedback.
All reactions