Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

manifold:storage 0.2.0

Contract reference · Payloads · contract.json (crates/manifold-wasm-abi/wit/contract.json)

Contract 0.2.0, track 0.2: open, unreleased. Nothing on track 0.2 is released yet, so any item may still change in place (spec §7.2).

InterfaceKindConsentSidesOwner
blob-storeimportoperatorserverenki
storage-typestypes-onlysilentbothcontract-foundation

Interface blob-store

import · consent operator · sides server · owner enki · since 0.2.0

Mod blob storage in the world save (Enki B §7): per world, or per world and player. Server side; consent class operator (server disk against a quota, contract foundation §10.2).

Operations keep the deferred shape (Enki B §0): each call returns a request id, and its result arrives through take-completions. Both hosts run the operation during the call, so every result is ready at the next drain (Enki B issue 32). Writes reach the save with the world’s next save transaction, so blobs never disagree with the chunks on disk.

Functions

delete

delete: func(key: blob-key) -> u64

list

list: func(scope: scope, player: option<player-id>, prefix: string) -> u64

Blobs in a scope whose paths start with prefix, in path order.

quota

quota: func(scope: scope, player: option<player-id>) -> quota-info

Bytes used and allowed in a scope; zero used outside a system.

read

read: func(key: blob-key) -> u64

take-completions

take-completions: func() -> list<tuple<u64, result<completion, blob-error>>>

Results since the last call, in request order.

write

write: func(key: blob-key, bytes: list<u8>) -> u64

Create or replace. Over the scope’s quota it fails with quota-exceeded and changes nothing.

Types

blob-error (variant)

io carries diagnostic text. outside-system: the call was made outside one of the mod’s server systems, where the host lends no world.

IndexCasePayloadAbout
0invalid-pathnone
1not-foundnone
2quota-exceedednone
3iostring
4cancellednone
5wrong-sidenone
6outside-systemnone

blob-info (alias)

= storage/storage-types.blob-info

blob-key (alias)

= storage/storage-types.blob-key

completion (variant)

A successful operation. read carries the blob’s bytes.

IndexCasePayloadAbout
0readlist<u8>
1writtennone
2deletednone
3listedlist<blob-info>

player-id (alias)

= core/types.player-id

quota-info (alias)

= storage/storage-types.quota-info

scope (alias)

= storage/storage-types.scope

Interface storage-types

types-only · consent silent · sides both · owner contract-foundation · since 0.2.0

Records the storage interfaces share with each other and with manifold:world/block-transaction’s undo records (contract foundation §4.5 rule 2; Enki B §7.2). Types only: importing this interface links nothing and needs no consent.

Types

blob-info (record)

A stored blob: its path, size in bytes and modification time in milliseconds since the Unix epoch.

FieldTypeAbout
pathstring
sizeu64
modified-msu64

blob-key (record)

A blob of the calling mod. The host adds the mod id it authenticated; a guest never names another mod’s blobs. player names the player of a world-player blob and is none for a world one. path is up to 8 /-separated segments of [A-Za-z0-9._-], at most 256 bytes.

FieldTypeAbout
scopescope
playeroption<player-id>
pathstring

player-id (alias)

= core/types.player-id

quota-info (record)

Bytes used and allowed in one scope.

FieldTypeAbout
usedu64
limitu64

scope (enum)

Where a server blob lives (Enki B §7.1): per world and mod, or per world, mod and player. Files on the player’s machine are local-files, a separate interface (contract foundation §10.2).

IndexCaseAbout
0world
1world-player