Struct tvix_glue::tvix_store_io::TvixStoreIO
source · pub struct TvixStoreIO {
pub(crate) blob_service: Arc<dyn BlobService>,
pub(crate) directory_service: Arc<dyn DirectoryService>,
pub(crate) path_info_service: Arc<dyn PathInfoService>,
pub(crate) nar_calculation_service: Arc<dyn NarCalculationService>,
std_io: StdIO,
build_service: Arc<dyn BuildService>,
pub(crate) tokio_handle: Handle,
pub(crate) fetcher: Fetcher<Arc<dyn BlobService>, Arc<dyn DirectoryService>, Arc<dyn PathInfoService>, Arc<dyn NarCalculationService>>,
pub known_paths: RefCell<KnownPaths>,
}
Expand description
Implements EvalIO, asking given PathInfoService, DirectoryService and BlobService.
In case the given path does not exist in these stores, we ask StdIO. This is to both cover cases of syntactically valid store paths, that exist on the filesystem (still managed by Nix), as well as being able to read files outside store paths.
This structure is also directly used by the derivation builtins and tightly coupled to it.
In the future, we may revisit that coupling and figure out how to generalize this interface and hide this implementation detail of the glue itself so that glue can be used with more than one implementation of “Tvix Store IO” which does not necessarily bring the concept of blob service, directory service or path info service.
Fields§
§blob_service: Arc<dyn BlobService>
§directory_service: Arc<dyn DirectoryService>
§path_info_service: Arc<dyn PathInfoService>
§nar_calculation_service: Arc<dyn NarCalculationService>
§std_io: StdIO
§build_service: Arc<dyn BuildService>
§tokio_handle: Handle
§fetcher: Fetcher<Arc<dyn BlobService>, Arc<dyn DirectoryService>, Arc<dyn PathInfoService>, Arc<dyn NarCalculationService>>
§known_paths: RefCell<KnownPaths>
Implementations§
source§impl TvixStoreIO
impl TvixStoreIO
pub fn new( blob_service: Arc<dyn BlobService>, directory_service: Arc<dyn DirectoryService>, path_info_service: Arc<dyn PathInfoService>, nar_calculation_service: Arc<dyn NarCalculationService>, build_service: Arc<dyn BuildService>, tokio_handle: Handle, ) -> Self
sourceasync fn store_path_to_node(
&self,
store_path: &StorePath<String>,
sub_path: &Path,
) -> Result<Option<Node>>
async fn store_path_to_node( &self, store_path: &StorePath<String>, sub_path: &Path, ) -> Result<Option<Node>>
for a given StorePath and additional Path inside the store path,
look up the PathInfo, and if it exists, and then use
directoryservice::descend_to to return the
Node specified by sub_path
.
In case there is no PathInfo yet, this means we need to build it (which currently is stubbed out still).
Trait Implementations§
source§impl EvalIO for TvixStoreIO
impl EvalIO for TvixStoreIO
source§fn path_exists(&self, path: &Path) -> Result<bool>
fn path_exists(&self, path: &Path) -> Result<bool>
source§fn open(&self, path: &Path) -> Result<Box<dyn Read>>
fn open(&self, path: &Path) -> Result<Box<dyn Read>>
io::Read
.source§fn file_type(&self, path: &Path) -> Result<FileType>
fn file_type(&self, path: &Path) -> Result<FileType>
Auto Trait Implementations§
impl !Freeze for TvixStoreIO
impl !RefUnwindSafe for TvixStoreIO
impl Send for TvixStoreIO
impl !Sync for TvixStoreIO
impl Unpin for TvixStoreIO
impl !UnwindSafe for TvixStoreIO
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request