pub struct LocalStore { /* private fields */ }Expand description
Local Nix store backed by the filesystem and SQLite database.
Implementations§
Source§impl LocalStore
impl LocalStore
Sourcepub async fn open(db_path: impl AsRef<Path>) -> StoreResult<Self>
pub async fn open(db_path: impl AsRef<Path>) -> StoreResult<Self>
Open the local store in read-only mode using the existing Nix database.
Default path: /nix/var/nix/db/db.sqlite.
Accepts any type convertible to a path (&str, &Path, PathBuf, etc.).
Sourcepub async fn open_rw(db_path: impl AsRef<Path>) -> StoreResult<Self>
pub async fn open_rw(db_path: impl AsRef<Path>) -> StoreResult<Self>
Open the local store in read-write mode.
The database file must already exist. Use this when you need to register paths, add signatures, or perform garbage collection.
Sourcepub async fn open_with_dir(
db_path: impl AsRef<Path>,
store_dir: impl AsRef<Path>,
) -> StoreResult<Self>
pub async fn open_with_dir( db_path: impl AsRef<Path>, store_dir: impl AsRef<Path>, ) -> StoreResult<Self>
Open with a custom store directory (for testing).
Sourcepub async fn open_rw_with_dir(
db_path: impl AsRef<Path>,
store_dir: impl AsRef<Path>,
) -> StoreResult<Self>
pub async fn open_rw_with_dir( db_path: impl AsRef<Path>, store_dir: impl AsRef<Path>, ) -> StoreResult<Self>
Open with a custom store directory in read-write mode (for testing).
Sourcepub fn db(&self) -> &DatabaseConnection
pub fn db(&self) -> &DatabaseConnection
Get the database connection for direct queries.
Sourcepub async fn create_tables(&self) -> StoreResult<()>
pub async fn create_tables(&self) -> StoreResult<()>
Create the Nix store schema tables in the database.
This is used for testing and for initializing a new store database.
Creates ValidPaths, Refs, and DerivationOutputs tables.
Sourcepub async fn open_in_memory() -> StoreResult<Self>
pub async fn open_in_memory() -> StoreResult<Self>
Open an in-memory SQLite database with schema created.
Useful for testing. Creates all tables and returns a read-write store.
Sourcepub async fn open_in_memory_with_dir(store_dir: &str) -> StoreResult<Self>
pub async fn open_in_memory_with_dir(store_dir: &str) -> StoreResult<Self>
Open an in-memory SQLite database with schema and a custom store dir.
Trait Implementations§
Source§impl Store for LocalStore
impl Store for LocalStore
Source§fn query_path_info<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<PathInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query_path_info<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<Option<PathInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn is_valid_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_valid_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn query_all_valid_paths<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query_all_valid_paths<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn register_path<'life0, 'life1, 'async_trait>(
&'life0 self,
info: &'life1 PathInfo,
) -> Pin<Box<dyn Future<Output = StoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register_path<'life0, 'life1, 'async_trait>(
&'life0 self,
info: &'life1 PathInfo,
) -> Pin<Box<dyn Future<Output = StoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn add_to_store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
nar_data: &'life2 [u8],
references: &'life3 [String],
) -> Pin<Box<dyn Future<Output = StoreResult<PathInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn add_to_store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
nar_data: &'life2 [u8],
references: &'life3 [String],
) -> Pin<Box<dyn Future<Output = StoreResult<PathInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn collect_garbage<'life0, 'life1, 'async_trait>(
&'life0 self,
options: &'life1 GcOptions,
) -> Pin<Box<dyn Future<Output = StoreResult<GcResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn collect_garbage<'life0, 'life1, 'async_trait>(
&'life0 self,
options: &'life1 GcOptions,
) -> Pin<Box<dyn Future<Output = StoreResult<GcResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn verify_store<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StoreResult<VerifyResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn verify_store<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StoreResult<VerifyResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn delete_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn optimise_store<'life0, 'async_trait>(
&'life0 self,
dry_run: bool,
) -> Pin<Box<dyn Future<Output = StoreResult<OptimiseResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn optimise_store<'life0, 'async_trait>(
&'life0 self,
dry_run: bool,
) -> Pin<Box<dyn Future<Output = StoreResult<OptimiseResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn query_references<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query_references<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn compute_closure<'life0, 'life1, 'async_trait>(
&'life0 self,
roots: &'life1 [StorePath],
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compute_closure<'life0, 'life1, 'async_trait>(
&'life0 self,
roots: &'life1 [StorePath],
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn add_signatures<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 StorePath,
_signatures: &'life2 [String],
) -> Pin<Box<dyn Future<Output = StoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add_signatures<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_path: &'life1 StorePath,
_signatures: &'life2 [String],
) -> Pin<Box<dyn Future<Output = StoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn query_referrers<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query_referrers<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 StorePath,
) -> Pin<Box<dyn Future<Output = StoreResult<Vec<StorePath>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !RefUnwindSafe for LocalStore
impl !UnwindSafe for LocalStore
impl Freeze for LocalStore
impl Send for LocalStore
impl Sync for LocalStore
impl Unpin for LocalStore
impl UnsafeUnpin for LocalStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more