Skip to content

Standardise and align db abstraction implementations #305

@damiannolan

Description

@damiannolan

Description

The prover service ev-prover currently contains three storage abstractions over rocksdb embedded databases.
They are as follows:

  • ProofStorage (storage_path: "~/.ev-prover/data/proofs.db"
  • HyperlaneMessageStore (storage_path: "~/.ev-prover/data/messages.db"
  • HyperlaneSnapshotStore (storage_path: "~/.ev-prover/data/snapshots.db"

Each implementation wraps an instance of rocksdb with an Arc<DB> smart pointer for shared access across async tasks.

At the moment there is some discrepancies between each implementation. We should aim to align the implementations such that they are consistent.

Before addressing this issue we should evaluate if having three distinct physical DBs is desirable (i.e. proofs.db, messages.db, snapshots.db). Or if these can be consolidated into one logical application specific DB. If one physical DB is preferred the 3 abstractions can still be kept within the application code and access to the DB object is shared via Arc<DB> so that logical separation is maintained.

Things to consider regarding using three independent DBs:

  • 3× WALs, background threads, file descriptors, block caches, etc.
  • More operational work (3 dirs to back up, monitor, migrate).
  • Needs for different RocksDB options (cache size, compression, etc.).
  • Very different access patterns / options
    • e.g. one write-heavy, one read-mostly, each tuned differently.

Furthermore, we should consider a wrapper object for Storage so that we do not need to pass three objects around. This can improve code readability and simplify various method arguments.
For example something very straight-forward such as:

pub struct AppStorage {
    proofs: ProofStorage,
    messages: HyperlaneMessageStore,
    snapshots: HyperlaneSnapshotStore,
}

The following issue should also be addressed:

Metadata

Metadata

Assignees

Labels

needs discussionIssues that require discussion with the teamprover-serviceIssues that relate to the prover service

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions