#wasmcloud #wasm #actor #webassembly #capability

wasmcloud-interface-blobstore

Interface for accessing an object store over the wasmcloud:blobstore contract

6 releases (3 breaking)

0.5.1 Nov 23, 2022
0.5.0 Nov 15, 2022
0.4.0 Aug 16, 2022
0.3.1 Jul 18, 2022
0.2.0 Mar 2, 2022

#342 in WebAssembly

Download history 4/week @ 2022-12-08 11/week @ 2022-12-15 6/week @ 2022-12-22 6/week @ 2022-12-29 2/week @ 2023-01-05 11/week @ 2023-01-12 30/week @ 2023-01-19 28/week @ 2023-01-26 30/week @ 2023-02-02 21/week @ 2023-02-09 34/week @ 2023-02-16 81/week @ 2023-02-23 1/week @ 2023-03-02 2/week @ 2023-03-09 9/week @ 2023-03-16 10/week @ 2023-03-23

56 downloads per month

Apache-2.0 and maybe LGPL-3.0-or-later

115KB
2.5K SLoC

crates.io  TinyGo Version

wasmCloud Blobstore Interface

The blobstore interface abstracts a service (capability provider) that can manage containers and objects. Actors that use this interface must have the capability contract wasmcloud:blobstore in their claims list (wash claims sign --blob_store).

Capability Provider Implementations

The following is a list of implementations of the wasmcloud:blobstore contract. Feel free to submit a PR adding your implementation if you have a community/open source version.

Name Vendor Description
blobstore-s3 wasmCloud An AWS S3 implementation of a blobstore that manages S3 buckets and objects
blobstore-fs wasmCloud An implementation that manages folders and files on a filesystem

Example Usage (🦀 Rust)

Create a container in a blobstore:

use std::result::Result;
use wasmbus_rpc::actor::prelude::*;
use wasmcloud_interface_blobstore::{Blobstore, BlobstoreSender};
async fn create_container(ctx: &Context, container_name: &str) -> Result<(), RpcError> {
    let blobstore = BlobstoreSender::new();
    blobstore
        .create_container(ctx, &container_name.to_string())
        .await
}

Uploading an object (image bytes) to a blobstore:

use std::result::Result;
use wasmbus_rpc::actor::prelude::*;
use wasmcloud_interface_blobstore::{
    Blobstore, BlobstoreSender, Chunk, PutObjectRequest, PutObjectResponse,
};
async fn upload_bytes(ctx: &Context, image_bytes: &[u8]) -> Result<PutObjectResponse, RpcError> {
    BlobstoreSender::new()
        .put_object(
            ctx,
            &PutObjectRequest {
                chunk: Chunk {
                    container_id: "myfolder".to_string(),
                    object_id: "myobjectname".to_string(),
                    bytes: image_bytes.to_vec(),
                    offset: 0,
                    is_last: true,
                },
                content_type: Some("image/png".to_string()),
                ..Default::default()
            },
        )
        .await
}

Dependencies

~9–20MB
~405K SLoC