-
Notifications
You must be signed in to change notification settings - Fork 100
feat: replace motoko asset canister with rust one #1644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
62fa246
feat: replace motoko asset canister with rust one
hansl 1d3249f
try 2, after adding authorize method
hansl bb1fede
try 3, url decode
hansl bf8f507
also deal with pluses
hansl 1999f29
remove fixed arrays
hansl 00bd2b5
implement streaming
hansl 704b479
adding logs because i donno whats going on
hansl b6be75c
aaaaaaah pluses need to replaced BEFORE percents
hansl c92846c
okay manually decode url now because fuck crates.io
hansl 573bc22
okay fixed some bugs with help of unit tests
hansl 4c2c828
error case should unwrap directly
hansl f9de4ad
error should show the right message
hansl 2b96b62
disable tests that are excessive
hansl dd1f5ab
disable tests that are unsupported
hansl c1c488a
Update src/distributed/README.md
hansl c52dc7d
.
hansl dce936c
.
hansl e4163ce
.
hansl b82895d
.
hansl f09af54
.
hansl 19b6b57
.
hansl ea7257f
reenable sha tests for asset canister
hansl f47aaa9
add renamed methods renamed back
hansl c63c64b
update token type for command line
hansl 0030792
oops
hansl e414fab
oops
hansl ded4eb9
oops
hansl 7dc9ca3
.
hansl 927d136
should pass everything now
hansl ae5d364
should pass everything now
hansl 1ad2a2b
.
hansl dcc1f79
Merge branch 'master' into hansl/rust-asset-canister
mergify[bot] 525936d
.
hansl e53ac56
.
hansl 84d7dbc
disable test on Mac OS on Replica
hansl db7c8b3
.
hansl 7d9c006
.
hansl 9babeba
.
hansl c149e3a
.
hansl 69e34d1
.
hansl c28c56a
.
hansl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,140 @@ | ||
| type BatchId = nat; | ||
| type ChunkId = nat; | ||
| type Key = text; | ||
| type Time = int; | ||
|
|
||
| type CreateAssetArguments = record { | ||
| key: Key; | ||
| content_type: text; | ||
| }; | ||
|
|
||
| // Add or change content for an asset, by content encoding | ||
| type SetAssetContentArguments = record { | ||
| key: Key; | ||
| content_encoding: text; | ||
| chunk_ids: vec ChunkId; | ||
| sha256: opt blob; | ||
| }; | ||
|
|
||
| // Remove content for an asset, by content encoding | ||
| type UnsetAssetContentArguments = record { | ||
| key: Key; | ||
| content_encoding: text; | ||
| }; | ||
|
|
||
| // Delete an asset | ||
| type DeleteAssetArguments = record { | ||
| key: Key; | ||
| }; | ||
|
|
||
| // Reset everything | ||
| type ClearArguments = record {}; | ||
|
|
||
| type BatchOperationKind = variant { | ||
| CreateAsset: CreateAssetArguments; | ||
| SetAssetContent: SetAssetContentArguments; | ||
|
|
||
| UnsetAssetContent: UnsetAssetContentArguments; | ||
| DeleteAsset: DeleteAssetArguments; | ||
|
|
||
| Clear: ClearArguments; | ||
| }; | ||
|
|
||
| type HeaderField = record { text; text; }; | ||
|
|
||
| type HttpRequest = record { | ||
| method: text; | ||
| url: text; | ||
| headers: vec HeaderField; | ||
| body: blob; | ||
| }; | ||
|
|
||
| type HttpResponse = record { | ||
| status_code: nat16; | ||
| headers: vec HeaderField; | ||
| body: blob; | ||
| streaming_strategy: opt StreamingStrategy; | ||
| }; | ||
|
|
||
| type StreamingCallbackHttpResponse = record { | ||
| body: blob; | ||
| token: opt StreamingCallbackToken; | ||
| }; | ||
|
|
||
| type StreamingCallbackToken = record { | ||
| key: Key; | ||
| content_encoding: text; | ||
| index: nat; | ||
| sha256: opt blob; | ||
| }; | ||
|
|
||
| type StreamingStrategy = variant { | ||
| Callback: record { | ||
| callback: func (StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query; | ||
| token: StreamingCallbackToken; | ||
| }; | ||
| }; | ||
|
|
||
| service: { | ||
|
|
||
| get: (record { | ||
| key: Key; | ||
| accept_encodings: vec text; | ||
| }) -> (record { | ||
| content: blob; // may be the entirety of the content, or just chunk index 0 | ||
| content_type: text; | ||
| content_encoding: text; | ||
| sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments | ||
| total_length: nat; // all chunks except last have size == content.size() | ||
| }) query; | ||
|
|
||
| // if get() returned chunks > 1, call this to retrieve them. | ||
| // chunks may or may not be split up at the same boundaries as presented to create_chunk(). | ||
| get_chunk: (record { | ||
| key: Key; | ||
| content_encoding: text; | ||
| index: nat; | ||
| sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments | ||
| }) -> (record { content: blob }) query; | ||
|
|
||
| list : (record {}) -> (vec record { | ||
| key: Key; | ||
| content_type: text; | ||
| encodings: vec record { | ||
| content_encoding: text; | ||
| sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments | ||
| length: nat; // Size of this encoding's blob. Calculated when uploading assets. | ||
hansl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| modified: Time; | ||
| }; | ||
| }) query; | ||
|
|
||
| create_batch : (record {}) -> (record { batch_id: BatchId }); | ||
|
|
||
| create_chunk: (record { batch_id: BatchId; content: blob }) -> (record { chunk_id: ChunkId }); | ||
|
|
||
| // Perform all operations successfully, or reject | ||
| commit_batch: (record { batch_id: BatchId; operations: vec BatchOperationKind }) -> (); | ||
|
|
||
| create_asset: (CreateAssetArguments) -> (); | ||
| set_asset_content: (SetAssetContentArguments) -> (); | ||
| unset_asset_content: (UnsetAssetContentArguments) -> (); | ||
|
|
||
| delete_asset: (DeleteAssetArguments) -> (); | ||
|
|
||
| clear: (ClearArguments) -> (); | ||
|
|
||
| // Single call to create an asset with content for a single content encoding that | ||
| // fits within the message ingress limit. | ||
| store: (record { | ||
| key: Key; | ||
| content_type: text; | ||
| content_encoding: text; | ||
| content: blob; | ||
| sha256: opt blob | ||
| }) -> (); | ||
|
|
||
| http_request: (request: HttpRequest) -> (HttpResponse) query; | ||
| http_request_streaming_callback: (token: StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query; | ||
|
|
||
| authorize: (principal) -> (); | ||
| } | ||
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.