pub struct Arx {
pub container: Container,
pub root_index: Index,
pub properties: AllProperties,
}Fields§
§container: Container§root_index: Index§properties: AllPropertiesImplementations§
Source§impl Arx
impl Arx
pub fn new<P: AsRef<Path>>(file: P) -> Result<Self, ArxError>
pub fn create_properties( &self, index: &Index, ) -> Result<AllProperties, ArxError>
pub fn get_entry<B>(&self, path: &Path) -> Result<Entry<B::Entry>, QueryError>where
B: FullBuilderTrait,
pub fn get_entry_in_range<B, R>(
&self,
path: &Path,
range: &R,
) -> Result<Entry<B::Entry>, QueryError>where
B: FullBuilderTrait,
R: Range,
pub fn get_entry_at_idx<B>(
&self,
idx: EntryIdx,
) -> Result<Option<Entry<B::Entry>>, ArxError>where
B: FullBuilderTrait,
Methods from Deref<Target = Container>§
Sourcepub fn pack_count(&self) -> PackCount
pub fn pack_count(&self) -> PackCount
The number of packs in the container.
Sourcepub fn get_pack(
&self,
pack_id: PackId,
) -> Result<Option<MayMissPack<&ContentPack>>, Error>
pub fn get_pack( &self, pack_id: PackId, ) -> Result<Option<MayMissPack<&ContentPack>>, Error>
Get a pack for the given pack_id.
If pack_id is not found in the manifest, return None.
As a existing pack may be actually missing, we return a MayMissPack which is kind
of option, but with a pack_info payload in the “None”
Sourcepub fn get_bytes(
&self,
content: ContentAddress,
) -> Result<Option<MayMissPack<Option<ByteRegion>>>, Error>
pub fn get_bytes( &self, content: ContentAddress, ) -> Result<Option<MayMissPack<Option<ByteRegion>>>, Error>
Get bytes associated to a content address.
This imply 2 lookups:
- One to get the pack
- One to get the bytes from the pack.
So the return value of this method is a bit complex. Classic use case, when content address come from the jubako archive itself is:
ⓘ
let bytes = container
.get_bytes(content_address)?
.and_then(|m| m.transpose())
.expect("As content address should be valid, we should have a bytes (or a MayMissPack)");
// `expect(...)` may be replaced with `or_or(SomeFormatError::new(...))?`
match bytes {
MayMissPack::FOUND(bytes) => { read_from_bytes(bytes) }
MayMissPack::MISSING(pack_info) => { display_user_pack_is_missing(pack_info) }
}Sourcepub fn get_directory_pack(&self) -> &Arc<DirectoryPack>
pub fn get_directory_pack(&self) -> &Arc<DirectoryPack>
Get the directory pack of the container
Sourcepub fn get_value_storage(&self) -> &Arc<ValueStorage>
pub fn get_value_storage(&self) -> &Arc<ValueStorage>
Get the value storage of the container
Sourcepub fn get_entry_storage(&self) -> &Arc<EntryStorage>
pub fn get_entry_storage(&self) -> &Arc<EntryStorage>
Get the entry storage of the container
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Arx
impl !RefUnwindSafe for Arx
impl Send for Arx
impl Sync for Arx
impl Unpin for Arx
impl !UnwindSafe for Arx
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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