Crate ic_asset

Crate ic_asset 

Source
Expand description

A library for manipulating assets in an asset canister.

§Example

use ic_agent::agent::Agent;
use ic_agent::identity::BasicIdentity;
use ic_utils::Canister;
use std::time::Duration;
let agent = Agent::builder()
    .with_url(replica_url)
    .with_identity(BasicIdentity::from_pem_file(pemfile)?)
    .build()?;
let canister = Canister::builder()
    .with_canister_id(canister_id)
    .with_agent(&agent)
    .build()?;
let logger = slog::Logger::root(slog::Discard, slog::o!());
ic_asset::sync(&canister, &[concat!(env!("CARGO_MANIFEST_DIR"), "assets/").as_ref()], false, &logger, None).await?;

Modules§

error
Error types
security_policy
Content-Security Policy

Enums§

AssetSyncState
.

Traits§

AssetSyncProgressRenderer
Display progress of the synchronization process

Functions§

compute_evidence
Compute the hash (“evidence”) over the batch operations required to update the assets
prepare_sync_for_proposal
Stage changes and propose the batch for commit.
sync
Sets the contents of the asset canister to the contents of a directory, including deleting old assets.
upload
Upload the specified files