-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move access-api delegation bytes out of d1 and into r2 (#578)
Motivation: * first PR on #571 todo * [x] initial `DbDelegationsStorageWithR2` that passes tests as a `DelegationsStorage` * [x] rm unused access-ws package #596 * [x] access-api should use `DbDelegationsStorageWithR2` and not `DbDelegationsStorage` (without r2) and still pass tests #599 informed by review * [x] add r2 bucket name binding to wrangler.toml for staging, production #578 (comment) unblocks: * `DbDelegationsStorageWithR2` supports deletes * we don't need this to support current `DelegationsStorage`, but probably will before long, but doesn't need to block this PR * optimization where r2 stores all the CIDs with varying multibases but for the same hash only once * safe to remove `DbDelegationsStorage`, `DelegationsV2Row`, `DelegationsV2Tables` --------- Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
- Loading branch information
Showing
18 changed files
with
584 additions
and
886 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/access-api/migrations/0007_add_delegations_v3.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Migration number: 0007 2023-03-20T23:48:40.469Z | ||
|
||
/* | ||
goal: add a new table to store delegations in | ||
which doesn't have a 'bytes' column. | ||
context: we're going to start storing bytes outside of the database (e.g. in R2) | ||
*/ | ||
|
||
CREATE TABLE | ||
IF NOT EXISTS delegations_v3 ( | ||
/* cidv1 dag-ucan/dag-cbor sha2-256 */ | ||
cid TEXT NOT NULL PRIMARY KEY, | ||
audience TEXT NOT NULL, | ||
issuer TEXT NOT NULL, | ||
expiration TEXT, | ||
inserted_at TEXT NOT NULL DEFAULT (strftime ('%Y-%m-%dT%H:%M:%fZ', 'now')), | ||
updated_at TEXT NOT NULL DEFAULT (strftime ('%Y-%m-%dT%H:%M:%fZ', 'now')), | ||
UNIQUE (cid) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.