[][src]Struct zfs_core::Zfs

pub struct Zfs { /* fields omitted */ }

A handle to work with Zfs pools, datasets, etc

Implementations

impl Zfs[src]

pub fn new() -> Result<Self>[src]

Create a handle to the Zfs subsystem

pub fn create<S: CStrArgument>(
    &self,
    name: S,
    dataset_type: DataSetType,
    props: &NvList
) -> Result<()>
[src]

Create a new dataset of the given type with props set as properties

Corresponds to lzc_create()

pub fn clone_dataset<S: CStrArgument, S2: CStrArgument>(
    &self,
    name: S,
    origin: S2,
    props: &mut NvListRef
) -> Result<()>
[src]

Corresponds to lzc_clone()

pub fn promote<S: CStrArgument>(
    &self,
    fsname: S,
    snap_name_buf: &mut [u8]
) -> Result<()>
[src]

Corresponds to lzc_promote()

pub fn rename<S: CStrArgument, T: CStrArgument>(
    &self,
    source: S,
    target: T
) -> Result<()>
[src]

Corresponds to lzc_rename()

pub fn destroy<S: CStrArgument>(&self, name: S) -> Result<()>[src]

Destroy the given dataset (which may be a filesystem, snapshot, bookmark, volume, etc)

Corresponds to lzc_destroy()

pub fn snapshot<I: IntoIterator<Item = S>, S: CStrArgument>(
    &self,
    snaps: I
) -> Result<(), Error>
[src]

Create snapshot(s)

The snapshots must be from the same pool, and must not reference the same dataset (iow: cannot create 2 snapshots of the same filesystem).

Corresponds to lzc_snapshot().

pub fn snapshot_raw(
    &self,
    snaps: &NvList,
    props: &NvList
) -> Result<(), Result<Error, NvList>>
[src]

Create snapshot(s). snaps is a list of bool (not boolean_value) entries, the names of which correspond to snapshot names.

The snapshots must be from the same pool, and must not reference the same dataset (iow: cannot create 2 snapshots of the same filesystem with a single call).

Corresponds to lzc_snapshot().

pub fn destroy_snaps<I: IntoIterator<Item = S>, S: CStrArgument>(
    &self,
    snaps: I,
    defer: Defer
) -> Result<(), (Error, NvList)>
[src]

pub fn destroy_snaps_raw(
    &self,
    snaps: &NvList,
    defer: Defer
) -> Result<(), (Error, NvList)>
[src]

Corresponds to lzc_destroy_snaps()

pub fn snaprange_space<F: CStrArgument, L: CStrArgument>(
    &self,
    first_snap: F,
    last_snap: L
) -> Result<u64>
[src]

Corresponds to lzc_snaprange_space()

pub fn exists<S: CStrArgument>(&self, name: S) -> bool[src]

Check if a dataset (a filesystem, or a volume, or a snapshot) with the given name exists.

Note: cannot check for bookmarks

Corresponds to lzc_exists().

pub fn sync<S: CStrArgument>(&self, pool_name: S, force: bool) -> Result<()>[src]

Corresponds to lzc_sync().

pub fn hold_raw(
    &self,
    holds: &NvListRef,
    cleanup_fd: Option<RawFd>
) -> Result<(), Result<Error, NvList>>
[src]

Create "user holds" on snapshots. If there is a hold on a snapshot, the snapshot can not be destroyed. (However, it can be marked for deletion by lzc_destroy_snaps(defer=B_TRUE).)

The keys in the nvlist are snapshot names.
The snapshots must all be in the same pool. The value is the name of the hold (string type).

pub fn hold<'a, H, S, N>(
    &self,
    holds: H,
    cleanup_fd: Option<RawFd>
) -> Result<(), Error> where
    H: IntoIterator<Item = &'a (S, N)>,
    S: 'a + CStrArgument + Clone,
    N: 'a + CStrArgument + Clone
[src]

Create a set of holds, each on a given snapshot

Related: [get_holds], [release], [hold_raw], [release_raw].

Corresponds to lzc_hold.

pub fn release_raw(
    &self,
    holds: &NvListRef
) -> Result<(), Result<Error, NvList>>
[src]

Release holds from various snapshots

The holds nvlist is [(snap_name, [hold_names])], allowing multiple holds for multiple snapshots to be released with one call.

Related: [release]

Corresponds to lzc_release.

pub fn release<'a, F, C, H, N>(&self, holds: F) -> Result<(), Error> where
    F: IntoIterator<Item = &'a (C, H)>,
    C: 'a + CStrArgument + Clone,
    H: 'a + IntoIterator<Item = N> + Clone,
    N: 'a + CStrArgument + Clone
[src]

For a list of datasets, release one or more holds by name

Corresponds to lzc_release.

pub fn get_holds<S: CStrArgument>(&self, snapname: S) -> Result<HoldList>[src]

Get the holds for a given snapshot

The returned nvlist is [(hold_name: String, unix_timestamp_seconds: u64)], where the unix timestamp is when the hold was created.

Corresponds to lzc_get_holds()

pub fn send<S: CStrArgument, F: CStrArgument>(
    &self,
    snapname: S,
    from: Option<F>,
    fd: RawFd,
    flags: SendFlags
) -> Result<()>
[src]

Send the described stream

Internally, is a wrapper around [send_resume_redacted()]

Corresponds to lzc_send()

pub fn send_resume<S: CStrArgument, F: CStrArgument>(
    &self,
    snapname: S,
    from: F,
    fd: RawFd,
    flags: SendFlags,
    resume_obj: u64,
    resume_off: u64
) -> Result<()>
[src]

Send the described stream with resume information

Internally, this is a wrapper around [send_resume_redacted()].

Corresponds to lzc_send_resume()

pub fn send_space<S: CStrArgument, F: CStrArgument>(
    &self,
    snapname: S,
    from: F,
    flags: SendFlags
) -> Result<u64>
[src]

Estimate the size of the stream to be sent if [send] were called with the same arguments

Internally, this is a wrapper around [send_space_resume_redacted()].

Corresponds to lzc_send_space()

pub fn receive<S: CStrArgument, O: CStrArgument>(
    &self,
    snapname: S,
    props: Option<&NvListRef>,
    origin: Option<O>,
    force: bool,
    raw: bool,
    fd: RawFd
) -> Result<()>
[src]

Corresponds to lzc_receive()

pub fn receive_resumable<S: CStrArgument, O: CStrArgument>(
    &self,
    snapname: S,
    props: &NvListRef,
    origin: O,
    force: bool,
    raw: bool,
    fd: RawFd
) -> Result<()>
[src]

Corresponds to lzc_receive_resumable()

pub fn rollback<S: CStrArgument>(&self, fsname: S) -> Result<CString>[src]

Corresponds to lzc_rollback()

pub fn rollback_to<F: CStrArgument, S: CStrArgument>(
    &self,
    fsname: F,
    snapname: S
) -> Result<()>
[src]

Corresponds to lzc_rollback_to()

pub fn bookmark<I: IntoIterator<Item = (D, S)>, D: CStrArgument, S: CStrArgument>(
    &self,
    bookmarks: I
) -> Result<(), ErrorList>
[src]

Create bookmarks from existing snapshot or bookmark

pub fn bookmark_raw(&self, bookmarks: &NvListRef) -> Result<(), (Error, NvList)>[src]

Create bookmarks from existing snapshot or bookmark

The bookmarks nvlist is [(full_name_of_new_bookmark, full_name_of_source_snap_or_bookmark)].

Corresponds to lzc_bookmark()

pub fn get_bookmarks_raw<F: CStrArgument>(
    &self,
    fsname: F,
    props: &NvListRef
) -> Result<NvList>
[src]

Retreive bookmarks for the given filesystem

props is a list of [(prop_name, ())], where prop_name names a property on a bookmark. All the named properties are returned in the return value as the values of each bookmark.

Corresponds to lzc_get_bookmarks()

pub fn get_bookmark_props<B: CStrArgument>(&self, bookmark: B) -> Result<NvList>[src]

Corresponds to lzc_get_bookmark_props()

pub fn destroy_bookmarks(
    &self,
    bookmarks: &NvListRef
) -> Result<(), (Error, NvList)>
[src]

Corresponds to lzc_destroy_bookmarks()

pub fn channel_program<P: CStrArgument, R: CStrArgument>(
    &self,
    pool: P,
    program: R,
    instruction_limit: u64,
    memlimit: u64,
    args: &NvListRef
) -> Result<NvList>
[src]

Execute a channel program

root privlidges are required to execute a channel program

Corresponds to lzc_channel_program()

pub fn channel_program_nosync<P: CStrArgument, R: CStrArgument>(
    &self,
    pool: P,
    program: R,
    instruction_limit: u64,
    memlimit: u64,
    args: &NvListRef
) -> Result<NvList>
[src]

Execute a read-only channel program

root privlidges are required to execute a channel program (even a read-only one)

Corresponds to lzc_channel_program_nosync()

pub fn pool_checkpoint<P: CStrArgument>(&self, pool: P) -> Result<()>[src]

Create a pool checkpoint

Corresponds to lzc_pool_checkpoint()

pub fn pool_checkpoint_discard<P: CStrArgument>(&self, pool: P) -> Result<()>[src]

Discard the pool checkpoint

Corresponds to lzc_pool_checkpoint_discard()

pub fn load_key<F: CStrArgument>(
    &self,
    fsname: F,
    noop: bool,
    keydata: &[u8]
) -> Result<()>
[src]

Corresponds to lzc_load_key()

pub fn unload_key<F: CStrArgument>(&self, fsname: F) -> Result<()>[src]

Corresponds to lzc_unload_key()

pub fn change_key<F: CStrArgument>(
    &self,
    fsname: F,
    crypt_cmd: u64,
    props: &NvListRef,
    keydata: Option<&[u8]>
) -> Result<()>
[src]

Corresponds to lzc_change_key()

pub fn reopen<P: CStrArgument>(
    &self,
    pool: P,
    scrub_restart: bool
) -> Result<()>
[src]

Corresponds to lzc_reopen()

pub fn initialize<P: CStrArgument>(
    &self,
    pool: P,
    initialize_func: PoolInitializeFunc,
    vdevs: &NvListRef
) -> Result<(), (Error, NvList)>
[src]

Corresponds to lzc_initialize()

pub fn trim<P: CStrArgument>(
    &self,
    pool: P,
    pool_trim_func: PoolTrimFunc,
    rate: u64,
    secure: bool,
    vdevs: &NvListRef
) -> Result<(), (Error, NvList)>
[src]

Corresponds to lzc_trim()

Trait Implementations

impl Debug for Zfs[src]

impl Drop for Zfs[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,