Skip to main content

Crate shardline_rebuild

Crate shardline_rebuild 

Source
Expand description

Index rebuild logic for the Shardline server ecosystem.

This crate provides pure rebuild functions that operate on explicit store parameters rather than server configuration.

§Quick start

The issue and report types are pure data that describe what a rebuild found and fixed:

use shardline_rebuild::{
    IndexRebuildIssue, IndexRebuildIssueDetail, IndexRebuildIssueKind,
    IndexRebuildReport,
};

let issue = IndexRebuildIssue {
    kind: IndexRebuildIssueKind::InvalidVersionRecordJson,
    location: "records/latest/acme-assets.json".to_owned(),
    detail: IndexRebuildIssueDetail::RecordJsonInvalid,
};
assert_eq!(issue.kind.as_str(), "invalid_version_record_json");

let report = IndexRebuildReport {
    scanned_version_records: 120,
    scanned_retained_shards: 4,
    rebuilt_latest_records: 1,
    unchanged_latest_records: 119,
    removed_stale_latest_records: 0,
    scanned_reconstructions: 4,
    unchanged_reconstructions: 4,
    removed_stale_reconstructions: 0,
    rebuilt_dedupe_shard_mappings: 0,
    unchanged_dedupe_shard_mappings: 0,
    removed_stale_dedupe_shard_mappings: 0,
    preserved_latest_records_unreadable_version: Vec::new(),
    issues: vec![issue],
};
assert!(!report.is_clean());
assert_eq!(report.issue_count(), 1);

To run a real rebuild, use run_index_rebuild_with_stores with explicit record, index, and object-store adapters.

Structs§

IndexRebuildIssue
One index-rebuild issue.
IndexRebuildReport
Index-rebuild report.

Enums§

IndexRebuildIssueDetail
Index-rebuild issue detail.
IndexRebuildIssueKind
Index-rebuild issue kinds.
IndexRebuildReconstructionPlanDetail
Index-rebuild reconstruction-plan issue detail.
RebuildError
Rebuild operation failure.

Functions§

run_index_rebuild_with_stores
Rebuilds latest-record state from immutable version records.

Type Aliases§

LocalIndexRebuildIssue
Backward-compatible local index-rebuild issue alias.
LocalIndexRebuildIssueKind
Backward-compatible local index-rebuild issue-kind alias.
LocalIndexRebuildReport
Backward-compatible local index-rebuild report alias.