Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularize beacon node backend #4669

Closed
eserilev opened this issue Aug 25, 2023 · 2 comments
Closed

Modularize beacon node backend #4669

eserilev opened this issue Aug 25, 2023 · 2 comments

Comments

@eserilev
Copy link
Collaborator

eserilev commented Aug 25, 2023

Description

I am creating this issue to track the progress of my work surrounding the enabling of multiple database implementations for the beacon node. The initial goal is to modularize the beacon node backend and abstract over the current LevelDB implementation. We'll eventually want to add a second database implementation. Theres some work being done on #4424 to add several new database implementations to the slasher backend. We may be able to decide on a relevant database implementation to add to the beacon node based on the current work being done on the slasher.

I plan to use the modularized slasher backend as a "blueprint" for my work on the beacon node. Similar to the slasher, I'll add a interface.rs file that allow us to abstract over different database implementations. That interface should encapsulate all the relevant database operations needed for the beacon node. Tentatively it will look something like this:

impl Environment {
    pub fn new(config: &StoreConfig) {
    }

    pub fn create_database(&self) {
    }

    pub fn create_rw_transaction(&self) {
    }
}

impl RwTransaction {
    pub fn put_with_options(&self) {
    }

    pub fn get(&self) {
    }

    pub fn delete(&self) { 
    }

    pub fn do_atomically(&self, ops_batch: Vec<KeyValueStoreOp>) {
    }

    pub fn compact(&self) {
    }

    pub fn iter_column(&self) {
    }
}
@michaelsproul
Copy link
Member

Sounds great @eserilev! There is an existing trait called KeyValueStore which does part of the abstract-ing already. The problem is that large parts of Lighthouse assume that the KV store is always LevelDB (in type aliases, etc)

mergify bot pushed a commit that referenced this issue Jan 23, 2025
#4669


  Modularize the beacon node backend to make it easier to add new database implementations
@jimmygchen
Copy link
Member

Completed in #4718 🎉 woot

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

No branches or pull requests

3 participants