Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

RFC: storage - #47

Open
louaykamel wants to merge 2 commits into
masterfrom
bee-storage
Open

RFC: storage #47
louaykamel wants to merge 2 commits into
masterfrom
bee-storage

Conversation

@louaykamel

@louaykamel louaykamel commented Jul 29, 2020

Copy link
Copy Markdown

@louaykamel louaykamel self-assigned this Jul 29, 2020
@louaykamel louaykamel changed the title RFC: storage RFC: storage Jul 29, 2020
Comment thread text/0047-storage.md

#[cfg(feature = "rocks_db")]
pub struct Storage {
inner: ::rocksdb::DB // The storage backend

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it should be the inner field that has the feature flag?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I agree it makes more sense.

Comment thread text/0047-storage.md
/// It starts RocksDB instance and then initialize the required column familes
async fn start(config_path: String) -> Result<Self, Box<dyn Error>> {
let config_as_string = fs::read_to_string(config_path)?;
let config: config::Config = toml::from_str(&config_as_string)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this Config type from? The config crate? If so, it might make more sense to have the config loading abstracted such that storage API users can customise it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's already abstracted using feature, you can check that in storage branch.

Comment thread text/0047-storage.md
)?;
Ok(())
}
async fn find_by_hash(hash: Hash, storage: &Storage) -> Result<Option<Self>, OpError> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hash should be passed by reference to avoid unnecessary cloning (I think Hash implements Deref<Trits> now, so you can just call .encode() on it directly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, yeah I will force reference everywhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants