This issue aligns with RFC#39 (removal of the UCAN stream) and aims to implement a mid-term solution to improve space usage tracking in the billing sub-system.
Objectives:
- Insert space usage deltas directly into the DynamoDB diff table from the BlobRegistry at the time of item additions or removals.
- Remove the UCAN stream handler from the billing service.
Benefits:
- Improved Visibility: Tasks are performed immediately at the point they are needed, rather than delayed, offering clearer oversight on what needs to be done and when.
- Explicit Coupling: Makes the connection between upload-api and billing sub-systems explicit.
- Early Failure Detection: Surfaces failures earlier in the process, reducing debugging complexity.
- System Consistency: Ensures consistency across the system by maintaining atomicity in operations.
- Fixing Double Diff Entries: Resolves issues like double entries in the diff table if a blob already exists.
Implementation Details:
- repository:
w3infra
- Update
BlobRegistry.register and BlobRegistry.deregister to insert the space usage delta into the space-diff table when blob/accept and blob/remove are executed, respectively.
- Ensure atomic updates to maintain data consistency across the system.
- The
ucan-stream is currently configured in stacks/billing-stack.js.