Module zpool

Module zpool 

Source
Expand description

Generic interface to work with zpools.

Somewhat poorly organized, but I’m afraid to do more refactoring here. The module consists of multiple parts:

  • Regular expressions for error parsing. I want to switch to pest at one point
  • Error enums: ZpoolError and ZpoolErrorKind
    • ZPoolError is used as an actual error
    • ZPoolErrorKind is used for easy comparision because io::Error doesn’t implement Eq
  • Some enums for various fields to avoid using boring bool
  • Main trait for everything Zpool related
    • It’s implemented as trait for easy mocking

Re-exports§

pub use self::description::Reason;
pub use self::description::Zpool;
pub use self::open3::ZpoolOpen3;
pub use self::properties::CacheType;
pub use self::properties::FailMode;
pub use self::properties::Health;
pub use self::properties::PropPair;
pub use self::properties::ZpoolProperties;
pub use self::properties::ZpoolPropertiesWrite;
pub use self::properties::ZpoolPropertiesWriteBuilder;
pub use self::topology::CreateZpoolRequest;
pub use self::topology::CreateZpoolRequestBuilder;
pub use self::vdev::CreateVdevRequest;
pub use self::vdev::Disk;
pub use self::vdev::Vdev;
pub use self::vdev::VdevType;

Modules§

description
If anyone has a better name for this module - hit me up. This module is where consumer friendly representation of Zpool is defined. This is where pest’s Pairs turned into Zpool.
open3
Open3 implementation of ZpoolEngine.
properties
Consumer friendly representation of Zpool’s properties.
topology
Structure representing what zpool consist of. This structure is used in zpool creation and when new drives are attached.
vdev
Consumer friendly structure representing vdev.

Enums§

CreateMode
Strategy to use when creating Zpool.
DestroyMode
Strategy to use when destroying Zpool.
ExportMode
Strategy to use when exporting Zpool.
OfflineMode
Strategy to use when bringing device offline.
OnlineMode
Strategy to use when bringing device online.
ZpoolError
Zpool sub-module errors. Every error returned by this module is wrapped into ZpoolError.
ZpoolErrorKind
This is a hack to allow doing Eq on errors because std::io::Error doesn’t implement PartialEq. Error descriptions are copied from ZpoolError. Might be out of date.

Traits§

ZpoolEngine
Interface to manage zpools. This documentation implies that you know how to use zpool(8).

Type Aliases§

ZpoolResult
Type alias to Result<T, ZpoolError>.