-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
record state root hash to resolve statedb smt rebuild after server re…
…start (#539) * record state root hash to resolve statedb smt rebuild after server restart * simple option call by map lambda * cleanup code
- Loading branch information
Showing
20 changed files
with
569 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::CONFIG_PREFIX_NAME; | ||
use anyhow::Result; | ||
use moveos_types::startup_info::StartupInfo; | ||
use raw_store::{derive_store, CodecKVStore}; | ||
use std::string::ToString; | ||
|
||
pub const STARTUP_INFO_KEY: &str = "startup_info"; | ||
|
||
derive_store!(StartupInfoDBStore, String, StartupInfo, CONFIG_PREFIX_NAME); | ||
|
||
pub trait ConfigStore { | ||
fn get_startup_info(&self) -> Result<Option<StartupInfo>>; | ||
|
||
fn save_startup_info(&self, startup_info: StartupInfo) -> Result<()>; | ||
} | ||
|
||
impl ConfigStore for StartupInfoDBStore { | ||
fn get_startup_info(&self) -> Result<Option<StartupInfo>> { | ||
self.kv_get(STARTUP_INFO_KEY.to_string()) | ||
} | ||
|
||
fn save_startup_info(&self, startup_info: StartupInfo) -> Result<()> { | ||
self.put_sync(STARTUP_INFO_KEY.to_string(), startup_info) | ||
} | ||
} |
Oops, something went wrong.