Hard drive lifecycle enums: physical state, SMART status, wipe status, disposition, and tag derivation
| Tier | operations |
| Role | unclassified (baselined) |
| Path | crates/operations/drive-health |
| Edition | 2021 |
| Targets | operations_drive_health |
| Public items | 30 across 0 modules |
| Tests | 83 |
What it is for
Hard Drive Health & Lifecycle Library crates
Strongly-typed enums for drive physical state, SMART diagnostic status, wipe status/method, and commercial disposition. Shared between rust-inventory-ai (inventory management) and bootusb (drive test station).
This crate contains only models and pure functions — no I/O, no database access.
Capabilities
crate root
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
fn classify_media(smart : & SmartSummary) -> MediaVerdict |
fn derive_tags(disposition : & Disposition, wipe : & WipeStatus, manufacturer : & str,) -> Vec <String> |
Disposition
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum Disposition |
Disposition :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
fn derive_disposition(physical : & PhysicalState, smart : & SmartStatus, wipe : & WipeStatus,) -> Disposition |
fn derive_disposition_from_verdict(verdict : & MediaVerdict, wipe : & WipeStatus) -> Disposition |
DriveFormFactor
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum DriveFormFactor |
MediaVerdict
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum MediaVerdict |
MediaVerdict :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
ParseDriveEnumError
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub struct ParseDriveEnumError |
ParseDriveEnumError :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
PhysicalState
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum PhysicalState |
PhysicalState :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
PhysicalState :: fn from_str(s : & str) -> Result <Self, Self::Err> |
ScsiFields
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub struct ScsiFields |
SmartStatus
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum SmartStatus |
SmartStatus :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
SmartStatus :: fn from_str(s : & str) -> Result <Self, Self::Err> |
SmartSummary
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub struct SmartSummary |
fn extract_smart_summary(snapshot : & serde_json::Value) -> SmartSummary |
fn parse_scsi_smartctl_text(stdout : & str) -> SmartSummary |
Transport
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum Transport |
TransportStatus
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum TransportStatus |
TransportStatus :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
WipeMethod
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum WipeMethod |
WipeMethod :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
WipeMethod :: fn from_str(s : & str) -> Result <Self, Self::Err> |
WipeStatus
Hard Drive Health & Lifecycle Library crates
| Item |
|---|
pub enum WipeStatus |
WipeStatus :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result |
WipeStatus :: fn from_str(s : & str) -> Result <Self, Self::Err> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub enum PhysicalState | Observable physical behavior of a hard drive |
PhysicalState :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
PhysicalState :: fn from_str(s : & str) -> Result <Self, Self::Err> | — |
pub enum SmartStatus | SMART diagnostic test overall result |
SmartStatus :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
SmartStatus :: fn from_str(s : & str) -> Result <Self, Self::Err> | — |
pub enum WipeStatus | — |
WipeStatus :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
WipeStatus :: fn from_str(s : & str) -> Result <Self, Self::Err> | — |
pub enum WipeMethod | — |
WipeMethod :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
WipeMethod :: fn from_str(s : & str) -> Result <Self, Self::Err> | — |
pub enum Transport | Drive transport / protocol family |
pub struct ScsiFields | SCSI log-page attributes used for media health classification |
pub struct SmartSummary | Subset of SMART attributes used for media health classification |
pub enum DriveFormFactor | Drive form factor — affects read speed thresholds. |
pub enum MediaVerdict | Graded media health verdict derived from SMART attributes. |
MediaVerdict :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
fn classify_media(smart : & SmartSummary) -> MediaVerdict | Classify media health from SMART attributes and performance data |
pub enum TransportStatus | Host-side transport health, independent of media health |
TransportStatus :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
pub enum Disposition | What should happen to this drive, derived from health + wipe state. |
Disposition :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
fn derive_disposition(physical : & PhysicalState, smart : & SmartStatus, wipe : & WipeStatus,) -> Disposition | Derive the commercial disposition from observable drive state |
fn derive_tags(disposition : & Disposition, wipe : & WipeStatus, manufacturer : & str,) -> Vec <String> | Derive inventory tags from disposition, wipe status, and manufacturer |
fn derive_disposition_from_verdict(verdict : & MediaVerdict, wipe : & WipeStatus) -> Disposition | Derive disposition using graded SMART verdict instead of simple pass/fail |
fn extract_smart_summary(snapshot : & serde_json::Value) -> SmartSummary | Extract a SmartSummary from the full smartctl JSON snapshot |
fn parse_scsi_smartctl_text(stdout : & str) -> SmartSummary | Parse smartctl -a -d cciss,N /dev/cciss/c0d0 text output (smartmontools 6.x) into a typed SmartSummary with transport = Transport::Scsi |
pub struct ParseDriveEnumError | — |
ParseDriveEnumError :: fn fmt(& self, f : & mut fmt::Formatter <'_>) -> fmt::Result | — |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | operations |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/operations/drive-health |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde_json | ^1 | — | no | always |
Build. None.
Depended on by. 2 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_drive_health["application-drive-health"] -->|uses| SELF n_operations_host_inventory["operations-host-inventory"] -->|uses| SELF SELF["operations-drive-health"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | operations_drive_health | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
ParseDriveEnumError | declared, no public signature returns it |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
2 workspace crates depend on this one: application-drive-health, operations-host-inventory.
Verification
| Kind | Count |
|---|---|
| Unit tests | 83 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 18 | 0 | 4 |
What the tests establish, by name:
ata_classification_unchanged_after_scsi_extension—src/lib.rsclassify_160gb_35_warning_band—src/lib.rsclassify_199_does_not_escalate_alone_with_one_other—src/lib.rsclassify_250gb_25_fast—src/lib.rsclassify_2tb_35_bad_speed—src/lib.rsclassify_500gb_25_warning_band—src/lib.rsclassify_bad_health_failed—src/lib.rsclassify_bad_pending_sectors—src/lib.rsclassify_bad_self_test_failed—src/lib.rsclassify_bad_uncorrectable—src/lib.rsclassify_hd109_dying_samsung_500gb_25—src/lib.rsclassify_hd174_old_40gb_25_normal_speed—src/lib.rsclassify_high_temp_downgrades_bad_speed_to_suspect—src/lib.rsclassify_no_speed_data_falls_through—src/lib.rsclassify_pending_overrides_clean_reallocated—src/lib.rsclassify_perfect_drive—src/lib.rsclassify_realloc_plus_high_187_escalate—src/lib.rsclassify_slow_speed_plus_high_187_escalate_to_bad—src/lib.rsclassify_slow_speed_plus_low_187_no_amplification—src/lib.rsclassify_smart_187_high_alone_is_pass_with_wear—src/lib.rsclassify_smart_187_low_is_pass_with_wear—src/lib.rsclassify_smart_188_excluded_from_classification—src/lib.rsclassify_smart_199_excluded_from_classification—src/lib.rsclassify_suspect_high_reallocated—src/lib.rsclassify_unknown_form_factor_skips_speed—src/lib.rsclassify_with_wear—src/lib.rsclassify_with_wear_at_threshold—src/lib.rsderive_for_parts_smart_failed—src/lib.rsderive_for_parts_smart_passed_not_wiped—src/lib.rsderive_needs_review_reads_but_no_smart—src/lib.rs- _… 53 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 15 | 30 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 15
"No rustdoc detected" : 15
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 1979 |
| Code lines | 1410 |
| Public API items | 30 |
| Public modules | 0 |
| Tests | 83 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 2 |
| Workspace reverse dependencies | 2 |
pie showData
title Public API by kind
"enum" : 9
"function" : 6
"method" : 12
"struct" : 3
pie showData
title Rust source composition
"Code" : 1410
"Blank or comment" : 569
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.