package wasi:blobstore; // a Container is a collection of objects interface container { use wasi:io/streams@0.2.0.{ input-stream, output-stream, }; use types.{ container-metadata, error, incoming-value, object-metadata, object-name, outgoing-value, }; // this defines the `container` resource resource container { // returns container name name: func() -> result; // returns container metadata info: func() -> result; // retrieves an object or portion of an object, as a resource. // Start and end offsets are inclusive. // Once a data-blob resource has been created, the underlying bytes are held by the blobstore service for the lifetime // of the data-blob resource, even if the object they came from is later deleted. get-data: func(name: object-name, start: u64, end: u64) -> result; // creates or replaces an object with the data blob. write-data: func(name: object-name, data: borrow) -> result<_, error>; // returns list of objects in the container. Order is undefined. list-objects: func() -> result; // deletes object. // does not return error if object did not exist. delete-object: func(name: object-name) -> result<_, error>; // deletes multiple objects in the container delete-objects: func(names: list) -> result<_, error>; // returns true if the object exists in this container has-object: func(name: object-name) -> result; // returns metadata for the object object-info: func(name: object-name) -> result; // removes all objects within the container, leaving the container empty. clear: func() -> result<_, error>; } // this defines the `stream-object-names` resource which is a representation of stream resource stream-object-names { // reads the next number of objects from the stream // // This function returns the list of objects read, and a boolean indicating if the end of the stream was reached. read-stream-object-names: func(len: u64) -> result, bool>, error>; // skip the next number of objects in the stream // // This function returns the number of objects skipped, and a boolean indicating if the end of the stream was reached. skip-stream-object-names: func(num: u64) -> result, error>; } }