Query object for the medium behind a filesystem accessor.
More...
#include <StormByte/system/device.hxx>
|
| enum class | Error {
Success = 0
, BrokenSymlink
, DeviceNotFound
, NotADevice
,
Permission
, ProbeFailed
} |
| | Device classification and probe enumerators. More...
|
| enum class | Kind {
HDD
, SSD
, NVMeGen3
, NVMeGen4
,
NVMeGen5
, USBHDD
, USBStick
, Network
} |
| | Classified storage or network medium. More...
|
| enum class | AccessFlag : std::uint8_t { Readable = 0x01
, Writable = 0x02
} |
| | Transfer permission of this path for this process. More...
|
|
| | Device (const StormByte::Safe::String &path) noexcept |
| | Store an owned UTF-8 accessor.
|
| | Device (std::string_view path) noexcept |
| | Store a UTF-8 accessor view.
|
| | Device (std::wstring_view path) noexcept |
| | Store a wide accessor as UTF-8 text.
|
| | Device (const std::filesystem::path &path) noexcept |
| | Store a filesystem path using its native path view.
|
| | Device (const Device &)=default |
| | Copy constructor.
|
| | Device (Device &&) noexcept=default |
| | Move constructor.
|
| Device & | operator= (const Device &)=default |
| | Copy assignment.
|
| Device & | operator= (Device &&) noexcept=default |
| | Move assignment.
|
| virtual | ~Device ()=default |
| | Destructor.
|
| | operator bool () const noexcept |
| | Whether the current probe succeeded.
|
| StormByte::Error::Fault | Fault () const noexcept |
| | Result of the current probe.
|
| const StormByte::Safe::String & | Path () const noexcept |
| | Accessor stored at construction.
|
| enum Kind | Kind () const noexcept |
| | Classified medium.
|
| class Access | Access () const noexcept |
| | Transfer permissions for this process on this path.
|
| virtual struct Throughput | Throughput () const noexcept |
| | Nominal sequential rates of the medium.
|
| virtual struct Window | Window () const noexcept |
| | Suggested read and write windows.
|
Query object for the medium behind a filesystem accessor.
Stores only the caller path as StormByte::Safe::String. Fault, Kind, Access, Throughput and Window are computed on each call.
Construction does not throw and does not open a handle. operator bool is true only when the current probe produced a success code. It does not mean readable or writable.
- Validity
- Kind, Access, Throughput and Window are defined only when the Device converts to
true. Path is always the stored accessor.
- Path kinds
- The accessor may be a regular file, a directory, a missing leaf on an existing volume, or a special device node. Symlinks are followed (stat). A dangling symlink is Error::BrokenSymlink. Special device nodes are never AccessFlag::Writable.
- Copy
- Copyable, movable and assignable. Only
m_path is owned.
- Derivation
- Throughput and Window are virtual so another module can report its own rates without System talking to sockets.
◆ AccessFlag
Transfer permission of this path for this process.
Not SMART and not medium feature flags.
| Enumerator |
|---|
| Readable | The process may read this path.
|
| Writable | The process may write this path.
|
◆ Error
Device classification and probe enumerators.
Domain tag StormByte.System.Device. Zero is success.
| Enumerator |
|---|
| Success | No error.
|
| BrokenSymlink | The path is a symlink whose target does not exist.
|
| DeviceNotFound | No volume or node could be resolved.
|
| NotADevice | The path exists but is not a classifiable file, directory or device node.
|
| Permission | The process may not stat or access this path.
|
| ProbeFailed | Classification I/O failed.
|
◆ Kind
Classified storage or network medium.
Acronyms stay uppercase. Nominal throughput presets follow Kind.
| Enumerator |
|---|
| HDD | Rotational local disk.
|
| SSD | Non-rotational local disk that is not NVMe.
|
| NVMeGen3 | NVMe PCIe 3.0.
|
| NVMeGen4 | NVMe PCIe 4.0.
|
| NVMeGen5 | NVMe PCIe 5.0.
|
| USBHDD | Removable rotational disk.
|
| USBStick | Removable solid-state key.
|
| Network | Network filesystem or remote drive.
|
◆ Device() [1/6]
Store an owned UTF-8 accessor.
- Parameters
-
| path | Caller path. Need not exist. |
◆ Device() [2/6]
| StormByte::System::Device::Device |
( |
std::string_view | path | ) |
|
|
explicitnoexcept |
Store a UTF-8 accessor view.
- Parameters
-
| path | Caller path. Need not exist. |
◆ Device() [3/6]
| StormByte::System::Device::Device |
( |
std::wstring_view | path | ) |
|
|
explicitnoexcept |
Store a wide accessor as UTF-8 text.
- Parameters
-
| path | Caller path. Need not exist. |
◆ Device() [4/6]
| StormByte::System::Device::Device |
( |
const std::filesystem::path & | path | ) |
|
|
inlineexplicitnoexcept |
Store a filesystem path using its native path view.
- Parameters
-
| path | Caller path. Need not exist; its text is copied before return. |
◆ Device() [5/6]
| StormByte::System::Device::Device |
( |
const Device & | | ) |
|
|
default |
◆ Device() [6/6]
| StormByte::System::Device::Device |
( |
Device && | | ) |
|
|
defaultnoexcept |
◆ ~Device()
| virtual StormByte::System::Device::~Device |
( |
| ) |
|
|
virtualdefault |
◆ Access()
| class Access StormByte::System::Device::Access |
( |
| ) |
const |
|
noexcept |
Transfer permissions for this process on this path.
- Returns
- Access bitmask. Valid only when
*this is true.
◆ Fault()
Result of the current probe.
- Returns
- Success or an Error code.
◆ Kind()
Classified medium.
- Returns
- Kind. Valid only when
*this is true.
◆ operator bool()
| StormByte::System::Device::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Whether the current probe succeeded.
- Returns
- true if Fault is a success code.
◆ operator=() [1/2]
| Device & StormByte::System::Device::operator= |
( |
const Device & | | ) |
|
|
default |
◆ operator=() [2/2]
◆ Path()
Accessor stored at construction.
- Returns
- Owned UTF-8 text. Not a canonical target path.
◆ Throughput()
| virtual struct Throughput StormByte::System::Device::Throughput |
( |
| ) |
const |
|
virtualnoexcept |
Nominal sequential rates of the medium.
- Returns
- Throughput. Valid only when
*this is true.
A derived Device may replace this with its own rates.
◆ Window()
| virtual struct Window StormByte::System::Device::Window |
( |
| ) |
const |
|
virtualnoexcept |
Suggested read and write windows.
- Returns
- Window. Valid only when
*this is true.
A derived Device may replace this with its own windows.
The documentation for this class was generated from the following file: