You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: streamline repair dataset handling and enhance CLI functionality
- Updated the repair CLI to target a single IPFS-enabled dataset, simplifying dataset management.
- Removed obsolete dataset grouping logic and refactored related database queries for improved clarity.
- Enhanced error handling for missing datasets and improved command responses to include relevant dataset information.
- Introduced new utility functions for dataset retrieval and updated existing functions to align with the new dataset structure.
- Updated TypeScript types for better type safety and clarity in the codebase.
Same CID may appear on multiple datasets in one group; dedupe per group when listing or paginating pieces.
26
-
27
-
Target datasets are looked up with payer + `EARLY_REPAIR_SOURCE` (`utils.ts`, value `early-repair2`).
20
+
All source pieces are deduped globally by CID and repaired into this one target dataset. Target datasets are looked up with target provider + payer + `EARLY_REPAIR_SOURCE` (`utils.ts`) + `withIpfsIndexing = true` + `withCdn = false`.
1.**Target provider** — if `--target-provider-id` is set, **`getRepairProvider`** loads that active provider; otherwise **`selectAlternateRepairProvider`** picks one with tier-matched fallback (endorsed → approved → none). Throws if none found.
36
-
2.**`getDataSetsByGroup`** — target provider datasets per group.
4.**`getRepairDataset`** — find the target IPFS-enabled dataset for the repair wallet.
32
+
5. If no target dataset exists → insert one **`create_dataset`** operation (`pending`).
41
33
42
34
### 2. `repair run <repairId>`
43
35
44
-
1. Run **`create_dataset`** phase (`pipeline/create-datasets.ts`) via fastq — `SP.createDataSet`, then `updateOperation`; returns created dataset IDs indexed by group.
45
-
2. Run **`add_piece`** pull phase (`pipeline/pull.ts`): pending ops are fetched in same-group pages and fed into fastq as workers free up (`createPullPiecesWorker` — mock logs CIDs per batch).
36
+
1. Run **`create_dataset`** phase (`pipeline/create-datasets.ts`) for the single pending dataset operation — `SP.createDataSet`, then `updateOperation`; stores the single IPFS target dataset ID.
37
+
2. Run **`add_piece`** pull phase (`pipeline/pull.ts`) via `p-queue`: pending ops are fetched in ID order with bounded queue backpressure.
46
38
47
-
`--reset` retries `pending` and `failed``create_dataset` ops only; `add_piece`always runs `pending` (failed pieces are skipped). `--batch-size`(default 50) caps pieces per pull job; each batch is one repair group only.
39
+
`--reset` retries `pending` and `failed``create_dataset` ops and also includes failed `add_piece`ops; otherwise `add_piece` runs only `pending` operations. `--batch-size` caps pieces per pull job.
48
40
49
41
### Operation types
50
42
51
43
-`create_dataset`: `pending` → `committing` → `completed` | `failed`; data has `serviceUrl`, `payee`.
52
44
-`add_piece`: `pending` → `pulling` → `committing` → `completed` | `failed`; data has `cid`, `serviceUrl`, `metadata`, `alternateProviders`.
53
45
54
-
`add_piece` without alternate providers (other replicas) is created as **`failed`** with error `"No alternate providers found"`. `getProvidersByCid` excludes the source `providerId`.
46
+
`add_piece` without alternate providers (other replicas) is created as **`skipped`** with error `"No alternate providers found"`.
55
47
56
48
## Source layout
57
49
@@ -66,10 +58,8 @@ src/
66
58
wallet.ts
67
59
db/
68
60
create-repair.ts # createRepair orchestration
69
-
get-repair-groups.ts # source groups that need repair
70
-
get-datasets-by-group.ts # target datasets per group
0 commit comments