-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Introduce "--storage-memory-cache-limit" #671
Conversation
67f2ff5
to
1544059
Compare
Other ideas:
|
|
||
/// If set, the amount of memory that the storage provider may use | ||
/// for caching in bytes. | ||
#[clap(long)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get a short arg for this? e.g., short = 'S'
or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Punting on this for now, as this is a low-level operator command
@@ -54,6 +58,25 @@ impl Storage for SledStorage { | |||
} | |||
} | |||
|
|||
#[async_trait] | |||
impl ConfigurableStorage for SledStorage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this implementation is the same for both SledStorage
and RocksDbStorage
. Can it just be a general default implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, they both just coincidentally have the core of their instantiation and setup in Self::with_config
rather than calling <Self as ConfigurableStorage>::open_with_config
from Self::new
rust/noosphere/src/storage.rs
Outdated
IpfsStorage::new(storage, maybe_client) | ||
}; | ||
|
||
debug!("Creating platform storage: {:#?}", storage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log line might be better written before the storage is created (otherwise change to past tense e.g., "created" not "creating"; but, I think moving it is better so that you get appropriate context for any subsequent error).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to created
, as we use storage
's Debug implementation to log storage type and extra configurations (could add more debugging to type if needed e.g. trait StorageInfo { fn name() -> String }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks for adding this capability.
1544059
to
387bbeb
Compare
/// creates a new [Workspace] from the current working directory. | ||
/// | ||
/// Use [invoke_cli_with_workspace] if using your own [Workspace]. | ||
pub async fn invoke_cli<'a>(cli: Cli, context: &CliContext<'a>) -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invoke_cli
now creates a Workspace
from its args rather than accept one so that we can always have the correct storage configuration on instantiation (this is the bulk of the follow up changes)
to limit size of memory cache in storage providers.
387bbeb
to
949468d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for implementing this!
ConfigurableStorage
trait to open storage with generalized configurations (onlymemory_cache_limit
at the moment)--storage-memory-cache-limit
andNoosphereStorage { config: NoosphereStorageConfig, path: NoosphereStoragePath }
for propagating these values from orb and rust API respectively into the sphere builder, which makes its way into the storage provider.invoke_cli()
take a mutable Workspace (for setting storage config)