ic-oss-can
ic-oss is a decentralized Object Storage Service on the Internet Computer.
ic-oss-can is a Rust library for implementing large file storage in ICP canisters. By including the ic_oss_fs! macro in your canister, a fs module and a set of Candid filesystem APIs will be automatically generated. You can use the ic-oss-cli tool to upload files to the ICP canister.
Usage
The following example is a minimal version using the ic_oss_fs! macro. Its only dependency is a thread-local constant named FS_CHUNKS_STORE of type RefCell<StableBTreeMap<FileId, Chunk, Memory>>.
use ;
use RefCell;
use ic_oss_fs;
use ;
type Memory = ;
const FS_DATA_MEMORY_ID: MemoryId = new;
thread_local!
// need to define `FS_CHUNKS_STORE` before `ic_oss_can::ic_oss_fs!()`
ic_oss_fs!;
For a more complete example, refer to examples/ai_canister.
FS Module
set_max_file_size;
set_visibility;
set_managers;
is_manager ;
with
FS Candid API
create_file : (CreateFileInput, opt blob) -> (Result_2);
delete_file : (nat32, opt blob) -> (Result_3);
list_files : (nat32, opt nat32, opt nat32, opt blob) -> (Result_4) query;
update_file_chunk : (UpdateFileChunkInput, opt blob) -> (Result_6);
update_file_info : (UpdateFileInput, opt blob) -> (Result_7);
The complete module API Candid API definition can be found in the store.rs file.
License
Copyright © 2024 LDC Labs.
ldclabs/ic-oss is licensed under the MIT License. See LICENSE for the full license text.