Skip to main content

InodeWrapper

Enum InodeWrapper 

Source
pub enum InodeWrapper {
    V5(RafsV5Inode),
    V6(RafsV6Inode),
    Ref(Arc<dyn RafsInodeExt>),
}
Expand description

An inode object wrapper for different RAFS versions.

Variants§

§

V5(RafsV5Inode)

Inode info structure for RAFS v5.

§

V6(RafsV6Inode)

Inode info structure for RAFS v6, reuse RafsV5Inode as IR for v6.

§

Ref(Arc<dyn RafsInodeExt>)

A reference to a RafsInodeExt object.

Implementations§

Source§

impl InodeWrapper

Source

pub fn new(version: RafsVersion) -> Self

Create a new instance of InodeWrapper with default value.

Source

pub fn from_inode_info(inode: Arc<dyn RafsInodeExt>) -> Self

Create an InodeWrapper object from a RafsInodeExt trait object.

Source

pub fn is_v5(&self) -> bool

Check whether is a RAFS V5 inode.

Source

pub fn is_v6(&self) -> bool

Check whether is a RAFS V6 inode.

Source

pub fn inode_size(&self) -> usize

Get file content size of the inode.

Source

pub fn mode(&self) -> u32

Get access permission/mode for the inode.

Source

pub fn set_mode(&mut self, mode: u32)

Set access permission/mode for the inode.

Source

pub fn is_dir(&self) -> bool

Check whether the inode is a directory.

Source

pub fn is_reg(&self) -> bool

Check whether the inode is a regular file.

Check whether the inode is a hardlink.

Check whether the inode is a symlink.

Source

pub fn is_chrdev(&self) -> bool

Check whether the inode is a char device node.

Source

pub fn is_blkdev(&self) -> bool

Check whether the inode is a block device node.

Source

pub fn is_fifo(&self) -> bool

Check whether the inode is a FIFO.

Source

pub fn is_sock(&self) -> bool

Check whether the inode is a socket.

Source

pub fn is_special(&self) -> bool

Check whether the inode is a special file, such chardev, blkdev, FIFO and socket.

Get inode flags.

Set whether the inode has HARDLINK flag set.

Source

pub fn has_xattr(&self) -> bool

Check whether the inode has associated xattrs.

Source

pub fn set_has_xattr(&mut self, enable: bool)

Set whether the inode has associated xattrs.

Source

pub fn ino(&self) -> Inode

Get inode number.

Source

pub fn set_ino(&mut self, ino: Inode)

Set inode number.

Source

pub fn parent(&self) -> Inode

Get parent inode number, only for RAFS v5.

Source

pub fn set_parent(&mut self, parent: Inode)

Set parent inode number, only for RAFS v5.

Source

pub fn size(&self) -> u64

Get inode content size of regular file, directory and symlink.

Source

pub fn set_size(&mut self, size: u64)

Set inode content size.

Source

pub fn uid(&self) -> u32

Get user id associated with the inode.

Source

pub fn set_uid(&mut self, uid: u32)

Set user id associated with the inode.

Source

pub fn gid(&self) -> u32

Get group id associated with the inode.

Source

pub fn set_gid(&mut self, gid: u32)

Set group id associated with the inode.

Source

pub fn mtime(&self) -> u64

Get modified time.

Source

pub fn set_mtime(&mut self, mtime: u64)

Set modified time.

Source

pub fn mtime_nsec(&self) -> u32

Get nsec part of modified time.

Source

pub fn set_mtime_nsec(&mut self, mtime_nsec: u32)

Set nsec part of modified time.

Source

pub fn blocks(&self) -> u64

Get data blocks of file content, in unit of 512 bytes.

Source

pub fn set_blocks(&mut self, blocks: u64)

Set data blocks of file content, in unit of 512 bytes.

Source

pub fn rdev(&self) -> u32

Get real device id associated with the inode.

Source

pub fn set_rdev(&mut self, rdev: u32)

Set real device id associated with the inode.

Source

pub fn set_projid(&mut self, projid: u32)

Set project ID associated with the inode.

Get number of hardlinks.

Set number of hardlinks.

Source

pub fn digest(&self) -> &RafsDigest

Get digest of inode metadata, RAFS v5 only.

Source

pub fn set_digest(&mut self, digest: RafsDigest)

Set digest of inode metadata, RAFS v5 only.

Source

pub fn name_size(&self) -> u16

Get size of inode name.

Source

pub fn set_name_size(&mut self, size: usize)

Set size of inode name.

Get size of symlink.

Set size of symlink.

Source

pub fn child_index(&self) -> u32

Get child inode index, only valid for RAFS v5.

Source

pub fn set_child_index(&mut self, index: u32)

Set child inode index, only fro RAFS v5.

Source

pub fn child_count(&self) -> u32

Get child/chunk count.

Source

pub fn set_child_count(&mut self, count: u32)

Set child/chunk count.

Source

pub fn create_chunk(&self) -> ChunkWrapper

Create a ChunkWrapper object to be associated with the inode.

Source

pub fn get_inode_size_with_xattr( &self, xattrs: &RafsXAttrs, v6_compact: bool, ) -> usize

Get memory/disk space occupied by the inode structure, including xattrs.

Trait Implementations§

Source§

impl Clone for InodeWrapper

Source§

fn clone(&self) -> InodeWrapper

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InodeWrapper

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.