Trait pace_core::ActivityStorage
source · pub trait ActivityStorage: ActivityReadOps + ActivityWriteOps + ActivityStateManagement + SyncStorage + ActivityQuerying {
// Required method
fn setup_storage(&self) -> PaceResult<()>;
}Expand description
The trait that all storage backends must implement. This allows us to swap out the storage backend without changing the rest of the application.
Storage backends can be in-memory, on-disk, or in a database. They can be any kind of persistent storage that can be used to store activities.
Required Methods§
sourcefn setup_storage(&self) -> PaceResult<()>
fn setup_storage(&self) -> PaceResult<()>
Setup the storage backend. This is called once when the application starts.
This is where you would create the database tables, open the file, etc.
§Errors
This function should return an error if the storage backend cannot be setup.