Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Jul 27, 2024
1 parent 51a3fdf commit 4aea9b8
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 141 deletions.
232 changes: 133 additions & 99 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ strip = true
opt-level = 's'

[workspace.package]
version = "0.6.6"
version = "0.7.0"
edition = "2021"
repository = "https://github.com/ldclabs/ic-oss"
keywords = ["file", "storage", "oss", "s3", "icp"]
Expand Down Expand Up @@ -52,7 +52,7 @@ num-traits = "0.2"
ic-cdk = "0.15"
ic-cdk-timers = "0.8"
ic-stable-structures = "0.6"
icrc-ledger-types = "0.1"
icrc-ledger-types = "0.1.6"
ic-http-certification = { version = "2.5", features = ["serde"] }
anyhow = "1"
crc32fast = "1.4"
Expand Down
4 changes: 2 additions & 2 deletions examples/ai_canister/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ serde = { workspace = true }
serde_bytes = { workspace = true }
getrandom = { workspace = true }
rand = { version = "0.8", features = ["getrandom"] }
ic-oss-types = { path = "../../src/ic_oss_types", version = "0.6" }
ic-oss-can = { path = "../../src/ic_oss_can", version = "0.6" }
ic-oss-types = { path = "../../src/ic_oss_types", version = "0.7" }
ic-oss-can = { path = "../../src/ic_oss_can", version = "0.7" }
2 changes: 1 addition & 1 deletion src/ic_oss/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ futures-util = { workspace = true }
crc32fast = { workspace = true }
sha3 = { workspace = true }
ic-agent = "0.36"
ic-oss-types = { path = "../ic_oss_types", version = "0.6" }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
4 changes: 2 additions & 2 deletions src/ic_oss_bucket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ icrc-ledger-types = { workspace = true }
getrandom = { workspace = true }
lazy_static = "1.4"
hyperx = { git = "https://github.com/ldclabs/hyperx", rev = "4b9bd373b8c4d29a32e59912bf598ba69273c032" }
ic-oss-types = { path = "../ic_oss_types", version = "0.6" }
ic-oss-cose = { path = "../ic_oss_cose", version = "0.6" }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
ic-oss-cose = { path = "../ic_oss_cose", version = "0.7" }
32 changes: 7 additions & 25 deletions src/ic_oss_bucket/ic_oss_bucket.did
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
type BTreeMap = vec record {
text;
variant {
Int : int;
Map : BTreeMap;
Nat : nat;
Nat64 : nat64;
Blob : blob;
Text : text;
Array : vec Value;
};
};
type BucketInfo = record {
status : int8;
total_chunks : nat64;
Expand All @@ -31,9 +19,10 @@ type BucketInfo = record {
};
type CanisterArgs = variant { Upgrade : UpgradeArgs; Init : InitArgs };
type CreateFileInput = record {
dek : opt blob;
status : opt int8;
content : opt blob;
custom : opt vec record { text; Value };
custom : opt vec record { text; MetadataValue };
hash : opt blob;
name : text;
crc32 : opt nat32;
Expand All @@ -44,11 +33,12 @@ type CreateFileInput = record {
type CreateFileOutput = record { id : nat32; created_at : nat64 };
type CreateFolderInput = record { name : text; parent : nat32 };
type FileInfo = record {
ex : opt vec record { text; Value };
ex : opt vec record { text; MetadataValue };
id : nat32;
dek : opt blob;
status : int8;
updated_at : nat64;
custom : opt vec record { text; Value };
custom : opt vec record { text; MetadataValue };
hash : opt blob;
name : text;
size : nat64;
Expand Down Expand Up @@ -79,6 +69,7 @@ type InitArgs = record {
max_folder_depth : nat8;
file_id : nat32;
};
type MetadataValue = variant { Int : int; Nat : nat; Blob : blob; Text : text };
type MoveInput = record { id : nat32; to : nat32; from : nat32 };
type Result = variant { Ok; Err : text };
type Result_1 = variant { Ok : vec nat32; Err : text };
Expand Down Expand Up @@ -115,7 +106,7 @@ type UpdateFileChunkOutput = record { updated_at : nat64; filled : nat64 };
type UpdateFileInput = record {
id : nat32;
status : opt int8;
custom : opt vec record { text; Value };
custom : opt vec record { text; MetadataValue };
hash : opt blob;
name : opt text;
content_type : opt text;
Expand All @@ -133,15 +124,6 @@ type UpgradeArgs = record {
max_file_size : opt nat64;
max_folder_depth : opt nat8;
};
type Value = variant {
Int : int;
Map : BTreeMap;
Nat : nat;
Nat64 : nat64;
Blob : blob;
Text : text;
Array : vec Value;
};
service : (opt CanisterArgs) -> {
admin_set_auditors : (vec principal) -> (Result);
admin_set_managers : (vec principal) -> (Result);
Expand Down
1 change: 1 addition & 0 deletions src/ic_oss_bucket/src/api_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fn create_file(
content_type: input.content_type,
size,
hash: input.hash,
dek: input.dek,
custom: input.custom,
created_at: now_ms,
updated_at: now_ms,
Expand Down
3 changes: 2 additions & 1 deletion src/ic_oss_bucket/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ pub struct FileMetadata {
pub chunks: u32,
pub status: i8, // -1: archived; 0: readable and writable; 1: readonly
pub hash: Option<ByteN<32>>, // recommend sha3 256
pub dek: Option<ByteN<32>>, // Data Encryption Key
pub dek: Option<ByteBuf>, // // Data Encryption Key that encrypted by BYOK or vetKey in COSE_Encrypt0
pub custom: Option<MapValue>, // custom metadata
pub ex: Option<MapValue>, // External Resource, ER indicates that the file is an external resource.
}
Expand Down Expand Up @@ -267,6 +267,7 @@ impl FileMetadata {
chunks: self.chunks,
status: self.status,
hash: self.hash,
dek: self.dek,
custom: self.custom,
ex: self.ex,
}
Expand Down
2 changes: 1 addition & 1 deletion src/ic_oss_can/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ serde_bytes = { workspace = true }
ciborium = { workspace = true }
ic-cdk = { workspace = true }
ic-stable-structures = { workspace = true }
ic-oss-types = { path = "../ic_oss_types", version = "0.6" }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
4 changes: 2 additions & 2 deletions src/ic_oss_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ futures = { workspace = true }
futures-util = { workspace = true }
crc32fast = { workspace = true }
sha3 = { workspace = true }
ic-oss = { path = "../ic_oss", version = "0.6" }
ic-oss-types = { path = "../ic_oss_types", version = "0.6" }
ic-oss = { path = "../ic_oss", version = "0.7" }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
ic-agent = "0.36"
anyhow = "1"
clap = { version = "=4.5", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions src/ic_oss_cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ hex = { workspace = true }
serde = { workspace = true }
serde_bytes = { workspace = true }
getrandom = { workspace = true }
ic-oss-types = { path = "../ic_oss_types", version = "0.6" }
ic-oss-cose = { path = "../ic_oss_cose", version = "0.6" }
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
ic-oss-cose = { path = "../ic_oss_cose", version = "0.7" }
4 changes: 2 additions & 2 deletions src/ic_oss_cose/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ icrc-ledger-types = { workspace = true }
k256 = { workspace = true }
ed25519-dalek = { workspace = true }
sha2 = { workspace = true }
coset = { git = "https://github.com/ldclabs/coset.git", version = "0.3.7-ldc" }
ic-oss-types = { path = "../ic_oss_types", version = "0.6" }
coset = "0.3.8"
ic-oss-types = { path = "../ic_oss_types", version = "0.7" }
4 changes: 3 additions & 1 deletion src/ic_oss_types/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ pub struct FileInfo {
pub chunks: u32,
pub status: i8, // -1: archived; 0: readable and writable; 1: readonly
pub hash: Option<ByteN<32>>,
pub dek: Option<ByteBuf>, // // Data Encryption Key that encrypted by BYOK or vetKey in COSE_Encrypt0
pub custom: Option<MapValue>, // custom metadata
pub ex: Option<MapValue>, // External Resource info
pub ex: Option<MapValue>, // External Resource info
}

#[derive(CandidType, Clone, Debug, Default, Deserialize, Serialize)]
Expand All @@ -37,6 +38,7 @@ pub struct CreateFileInput {
pub content: Option<ByteBuf>, // should <= 1024 * 1024 * 2 - 1024
pub status: Option<i8>, // when set to 1, the file must be fully filled, and hash must be provided
pub hash: Option<ByteN<32>>, // recommend sha3 256
pub dek: Option<ByteBuf>,
pub custom: Option<MapValue>,
pub crc32: Option<u32>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/ic_oss_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ mod bytes;
pub use bytes::*;

// should update to ICRC3Map
pub type MapValue = BTreeMap<String, icrc_ledger_types::icrc::generic_value::Value>;
pub type MapValue =
BTreeMap<String, icrc_ledger_types::icrc::generic_metadata_value::MetadataValue>;

pub fn format_error<T>(err: T) -> String
where
Expand Down

0 comments on commit 4aea9b8

Please sign in to comment.