Drive identity: aliases, evidence groups, and fingerprint matching for hard drives across controller / SMART / OCR sources
| Tier | operations |
| Role | unclassified (baselined) |
| Path | crates/operations/drive-identity |
| Edition | 2021 |
| Targets | operations_drive_identity |
| Public items | 23 across 0 modules |
| Tests | 79 |
What it is for
Drive Identity Library crates
Alias-graph matcher for identifying a physical hard drive from noisy, multi-source observations. A single drive can carry many "identities" — hpacucli-reported serial, smartctl serial, VPD 0x80 / 0x83 descriptors, OCR-scanned label text, pedigree traces, WWNs, and vendor part numbers. Reducing those to one canonical column loses information; this crate instead represents each drive as a DriveFingerprint carrying a bag of DriveAliases.
Matching is performed by score_fingerprint, a pure function that evaluates a candidate fingerprint against a slice of known fingerprints and returns one MatchResult per candidate. The scoring rules are tuned for SCSI / SATA / NVMe inventory and are deliberately conservative: model+capacity agreement alone is never enough to auto-assign.
This crate is orthogonal to operations-drive-health: health describes what a drive IS DOING, identity describes WHICH drive it is. The two compose at the application layer (e.g. DriveInspection { identity, health }) but do not depend on each other.
Capabilities
crate root
Drive Identity Library crates
| Item |
|---|
pub const NORM_VERSION: u32 |
fn normalize_value(s : & str,) ->(String, String, Option <String>, Option <String>, Option <String>,) |
fn seagate_pedigree_split(s : & str) -> Option <(String, Option <String>)> |
pub const VENDOR_SERIAL_PREFIXES: & & str |
fn strip_vendor_prefix(serial : & str) -> & str |
fn strip_hitachi_date_prefix(serial : & str) -> & str |
fn normalization_variants(token : & str) -> Vec <String> |
fn score_fingerprint(fp : & DriveFingerprint, candidates : & & DriveFingerprint,) -> Vec <MatchResult> |
AliasSource
Drive Identity Library crates
| Item |
|---|
pub enum AliasSource |
DriveAlias
Drive Identity Library crates
| Item |
|---|
pub struct DriveAlias |
DriveAlias :: fn new(source : AliasSource, group : EvidenceGroup, raw : impl Into <String>) -> Self |
DriveFingerprint
Drive Identity Library crates
| Item |
|---|
pub struct DriveFingerprint |
DriveFingerprint :: fn empty() -> Self |
EvidenceGroup
Drive Identity Library crates
| Item |
|---|
pub enum EvidenceGroup |
MatchDecision
Drive Identity Library crates
| Item |
|---|
pub enum MatchDecision |
MatchReason
Drive Identity Library crates
| Item |
|---|
pub enum MatchReason |
MatchResult
Drive Identity Library crates
| Item |
|---|
pub struct MatchResult |
OcrSerial
Drive Identity Library crates
| Item |
|---|
pub struct OcrSerial<'a> |
fn extract_serial_candidates(input : & OcrSerial <'_>) -> Vec <String> |
OcrSerial<'a>
Drive Identity Library crates
| Item |
|---|
OcrSerial<'a> :: fn new(serial : Option <& 'a str>, alt_serial : Option <& 'a str>, conflicting_fields : & 'a Option <& 'a str>,) -> Self |
OcrText
Drive Identity Library crates
| Item |
|---|
pub struct OcrText<'a> |
fn extract_identifier_candidates(input : & OcrText <'_>) -> Vec <String> |
OcrText<'a>
Drive Identity Library crates
| Item |
|---|
OcrText<'a> :: fn new(raw : Option <& 'a str>, unmapped_lines : & 'a & 'a str) -> Self |
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 const NORM_VERSION: u32 | Current normalization version |
pub enum AliasSource | Source of a drive alias observation |
pub enum EvidenceGroup | Groups of correlated observations |
pub struct DriveAlias | One (source, raw_value) identity observation plus derived normalization keys |
DriveAlias :: fn new(source : AliasSource, group : EvidenceGroup, raw : impl Into <String>) -> Self | Build a fully-normalized alias from a raw observation |
pub struct DriveFingerprint | The complete identity footprint of one drive from the matcher's POV |
DriveFingerprint :: fn empty() -> Self | Empty fingerprint — no aliases and no attributes |
pub enum MatchDecision | Top-level matcher verdict for one (bay, candidate) pair. |
pub enum MatchReason | Structured reason for a match score |
pub struct MatchResult | One matcher result for a (fingerprint, candidatei) pair. |
fn normalize_value(s : & str,) ->(String, String, Option <String>, Option <String>, Option <String>,) | Normalize a raw alias value into its derived keys |
fn seagate_pedigree_split(s : & str) -> Option <(String, Option <String>)> | Seagate 3JA dual-form detection |
pub const VENDOR_SERIAL_PREFIXES: & & str | SMART-reported vendor prefixes that printed labels omit |
fn strip_vendor_prefix(serial : & str) -> & str | Strip a known vendor prefix (see VENDOR_SERIAL_PREFIXES) from a SMART-reported serial |
fn strip_hitachi_date_prefix(serial : & str) -> & str | Strip a YYMMDD Hitachi/HGST date prefix from a label serial |
fn normalization_variants(token : & str) -> Vec <String> | Canonical normalization variants of a single token |
pub struct OcrText<'a> | Input to extract_identifier_candidates |
OcrText<'a> :: fn new(raw : Option <& 'a str>, unmapped_lines : & 'a & 'a str) -> Self | Construct an OcrText from primary fields. |
pub struct OcrSerial<'a> | Input to extract_serial_candidates |
OcrSerial<'a> :: fn new(serial : Option <& 'a str>, alt_serial : Option <& 'a str>, conflicting_fields : & 'a Option <& 'a str>,) -> Self | Construct an OcrSerial from primary fields. |
fn extract_identifier_candidates(input : & OcrText <'_>) -> Vec <String> | Extract plausible drive-identifier candidates from free-form OCR text |
fn extract_serial_candidates(input : & OcrSerial <'_>) -> Vec <String> | — |
fn score_fingerprint(fp : & DriveFingerprint, candidates : & & DriveFingerprint,) -> Vec <MatchResult> | Score one fingerprint against each candidate in candidates |
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-identity |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde_json | ^1 | — | no | always |
Build. None.
Depended on by. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_drive_identity["application-drive-identity"] -->|uses| SELF SELF["operations-drive-identity"] 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_identity | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
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
1 workspace crate depends on this one: application-drive-identity.
Verification
| Kind | Count |
|---|---|
| Unit tests | 79 |
| 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 | 19 | 0 | 0 |
What the tests establish, by name:
dedups_across_raw_and_unmapped—src/lib.rsdrive_alias_new_populates_derived_keys—src/lib.rsduplicate_candidates_sharing_serial_downgrade_to_review—src/lib.rsextracts_from_barcode_prefix_line—src/lib.rsextracts_hgst_date_prefixed_serial_from_raw—src/lib.rsfuzzy_rule_blocked_on_low_lcp—src/lib.rsfuzzy_rule_blocked_on_short_ocr—src/lib.rsfuzzy_rule_blocked_without_capacity_agreement—src/lib.rsfuzzy_rule_blocked_without_model_agreement—src/lib.rsfuzzy_rule_fires_on_bay_2_ocr_misread—src/lib.rsfuzzy_rule_fires_on_bay_4_exact_prefix—src/lib.rshyphenated_tokens_are_rejected_by_filter—src/lib.rslcp_early_divergence—src/lib.rslcp_exact_prefix—src/lib.rslcp_no_overlap—src/lib.rslevenshtein_bay_2_real_case—src/lib.rslevenshtein_counts_single_insertion—src/lib.rslevenshtein_counts_single_substitution—src/lib.rslevenshtein_early_exit_on_exceed—src/lib.rslevenshtein_early_exit_on_length_diff—src/lib.rslevenshtein_zero_for_equal_strings—src/lib.rsmodel_capacity_only_never_auto—src/lib.rsno_overlap_returns_no_signal—src/lib.rsnorm_version_is_one—src/lib.rsnormalization_variants_expands_hitachi_date_prefix—src/lib.rsnormalization_variants_is_lossless_for_plain_serial—src/lib.rsnormalization_variants_strips_wd_prefix—src/lib.rsnormalize_value_collapses_internal_whitespace—src/lib.rsnormalize_value_handles_trailing_spaces—src/lib.rsnormalize_value_preserves_leading_zeros—src/lib.rs- _… 49 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 22 | 23 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 22
"No rustdoc detected" : 1
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 2252 |
| Code lines | 1656 |
| Public API items | 23 |
| Public modules | 0 |
| Tests | 79 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 3 |
| Workspace reverse dependencies | 1 |
pie showData
title Public API by kind
"constant" : 2
"enum" : 4
"function" : 8
"method" : 4
"struct" : 5
pie showData
title Rust source composition
"Code" : 1656
"Blank or comment" : 596
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.