Skip to content

Commit

Permalink
chore: update candid file
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Jul 17, 2024
1 parent c423ab9 commit ac61240
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 49 deletions.
7 changes: 3 additions & 4 deletions src/ic_oss_bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ get_file_info : (nat32, opt blob) -> (Result_7) query;
get_file_info_by_hash : (blob, opt blob) -> (Result_7) query;
get_folder_ancestors : (nat32, opt blob) -> (Result_5) query;
get_folder_info : (nat32, opt blob) -> (Result_8) query;
http_request : (HttpRequest) -> (HttpStreamingResponse) query;
list_files : (nat32, opt nat32, opt nat32, opt blob) -> (Result_9) query;
list_folders : (nat32, opt nat32, opt nat32, opt blob) -> (Result_10) query;
move_file : (MoveInput, opt blob) -> (Result_11);
move_folder : (MoveInput, opt blob) -> (Result_11);
update_file_chunk : (UpdateFileChunkInput, opt blob) -> (Result_12);
update_file_info : (UpdateFileInput, opt blob) -> (Result_11);
update_folder_info : (UpdateFolderInput, opt blob) -> (Result_11);
validate_admin_set_auditors : (vec principal) -> (Result) query;
validate_admin_set_managers : (vec principal) -> (Result) query;
validate_admin_update_bucket : (UpdateBucketInput) -> (Result) query;
validate_admin_set_auditors : (vec principal) -> (Result);
validate_admin_set_managers : (vec principal) -> (Result);
validate_admin_update_bucket : (UpdateBucketInput) -> (Result);
```

The complete Candid API definition can be found in the [ic_oss_bucket.did](https://github.com/ldclabs/ic-oss/tree/main/src/ic_oss_bucket/ic_oss_bucket.did) file.
Expand Down
41 changes: 3 additions & 38 deletions src/ic_oss_bucket/ic_oss_bucket.did
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ type FolderInfo = record {
parent : nat32;
};
type FolderName = record { id : nat32; name : text };
type HttpRequest = record {
url : text;
method : text;
body : blob;
headers : vec record { text; text };
};
type HttpStreamingResponse = record {
body : blob;
headers : vec record { text; text };
upgrade : opt bool;
streaming_strategy : opt StreamingStrategy;
status_code : nat16;
};
type InitArgs = record {
name : text;
max_custom_data_size : nat16;
Expand All @@ -106,24 +93,6 @@ type Result_6 = variant { Ok : vec record { nat32; blob }; Err : text };
type Result_7 = variant { Ok : FileInfo; Err : text };
type Result_8 = variant { Ok : FolderInfo; Err : text };
type Result_9 = variant { Ok : vec FileInfo; Err : text };
type StreamingCallbackHttpResponse = record {
token : opt StreamingCallbackToken;
body : blob;
};
type StreamingCallbackToken = record {
id : nat32;
chunk_index : nat32;
token : opt blob;
chunks : nat32;
};
type StreamingStrategy = variant {
Callback : record {
token : StreamingCallbackToken;
callback : func (StreamingCallbackToken) -> (
StreamingCallbackHttpResponse,
) query;
};
};
type UpdateBucketInput = record {
status : opt int8;
trusted_eddsa_pub_keys : opt vec blob;
Expand Down Expand Up @@ -190,18 +159,14 @@ service : (opt CanisterArgs) -> {
get_file_info_by_hash : (blob, opt blob) -> (Result_7) query;
get_folder_ancestors : (nat32, opt blob) -> (Result_5) query;
get_folder_info : (nat32, opt blob) -> (Result_8) query;
http_request : (HttpRequest) -> (HttpStreamingResponse) query;
http_request_streaming_callback : (StreamingCallbackToken) -> (
StreamingCallbackHttpResponse,
) query;
list_files : (nat32, opt nat32, opt nat32, opt blob) -> (Result_9) query;
list_folders : (nat32, opt nat32, opt nat32, opt blob) -> (Result_10) query;
move_file : (MoveInput, opt blob) -> (Result_11);
move_folder : (MoveInput, opt blob) -> (Result_11);
update_file_chunk : (UpdateFileChunkInput, opt blob) -> (Result_12);
update_file_info : (UpdateFileInput, opt blob) -> (Result_11);
update_folder_info : (UpdateFolderInput, opt blob) -> (Result_11);
validate_admin_set_auditors : (vec principal) -> (Result) query;
validate_admin_set_managers : (vec principal) -> (Result) query;
validate_admin_update_bucket : (UpdateBucketInput) -> (Result) query;
validate_admin_set_auditors : (vec principal) -> (Result);
validate_admin_set_managers : (vec principal) -> (Result);
validate_admin_update_bucket : (UpdateBucketInput) -> (Result);
}
4 changes: 2 additions & 2 deletions src/ic_oss_bucket/src/api_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static IC_CERTIFICATE_EXPRESSION_HEADER: &str = "ic-certificateexpression";
// http://mmrxu-fqaaa-aaaap-ahhna-cai.localhost:4943/f/1 // download file by id 1
// http://mmrxu-fqaaa-aaaap-ahhna-cai.localhost:4943/h/8546ffa4296a6960e9e64e95de178d40c231a0cd358a65477bc56a105dda1c1d //download file by hash 854...
// TODO: 1. support range request; 2. token verification; 3. cache control
#[ic_cdk::query]
#[ic_cdk::query(hidden = true)]
fn http_request(request: HttpRequest) -> HttpStreamingResponse {
let witness = store::state::http_tree_with(|t| {
t.witness(&store::state::DEFAULT_CERT_ENTRY, &request.url)
Expand Down Expand Up @@ -274,7 +274,7 @@ fn http_request(request: HttpRequest) -> HttpStreamingResponse {
}
}

#[ic_cdk::query]
#[ic_cdk::query(hidden = true)]
fn http_request_streaming_callback(token: StreamingCallbackToken) -> StreamingCallbackHttpResponse {
match store::fs::get_chunk(token.id, token.chunk_index) {
None => ic_cdk::trap("chunk not found"),
Expand Down
2 changes: 0 additions & 2 deletions src/ic_oss_bucket/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use candid::Principal;
use ic_http_certification::HttpRequest;
use serde_bytes::ByteBuf;
use std::collections::BTreeSet;

Expand All @@ -11,7 +10,6 @@ mod api_update;
mod permission;
mod store;

use api_http::*;
use api_init::CanisterArgs;
use ic_oss_types::{bucket::*, file::*, folder::*, ByteN};

Expand Down
2 changes: 1 addition & 1 deletion src/ic_oss_cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ admin_detach_policies : (Token) -> (Result_1);
admin_set_managers : (vec principal) -> (Result_1);
admin_sign_access_token : (Token) -> (Result);
get_cluster_info : () -> (Result_2) query;
validate_admin_set_managers : (vec principal) -> (Result_1) query;
validate_admin_set_managers : (vec principal) -> (Result_1);
```

The complete Candid API definition can be found in the [ic_oss_cluster.did](https://github.com/ldclabs/ic-oss/tree/main/src/ic_oss_bucket/ic_oss_cluster.did) file.
Expand Down
2 changes: 1 addition & 1 deletion src/ic_oss_cluster/ic_oss_cluster.did
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ service : (opt ChainArgs) -> {
admin_set_managers : (vec principal) -> (Result_1);
admin_sign_access_token : (Token) -> (Result);
get_cluster_info : () -> (Result_2) query;
validate_admin_set_managers : (vec principal) -> (Result_1) query;
validate_admin_set_managers : (vec principal) -> (Result_1);
}
2 changes: 1 addition & 1 deletion src/ic_oss_ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ldclabs/ic_oss_ts",
"version": "0.6.5",
"version": "0.6.6",
"type": "module",
"description": "The Typescript version of the client SDK for the ic-oss cluster.",
"license": "MIT",
Expand Down

0 comments on commit ac61240

Please sign in to comment.