Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin data storage phase 2 #875

Open
James-Mart opened this issue Oct 2, 2024 · 0 comments
Open

Plugin data storage phase 2 #875

James-Mart opened this issue Oct 2, 2024 · 0 comments
Assignees
Milestone

Comments

@James-Mart
Copy link
Member

These details were moved from their original issue #740

Key-value Interface

The API should mirror the idb-keyval API, except for the update function, which would require passing functions:

    set      : func(key : string, value : string) -> result<_, error>;
    get      : func(key : string) -> result<string, error>;
    set-many : func(items: list<tuple<string, string>>) -> result<_, error>;
    get-many : func(keys: list<string>) -> result<list<string>, error>;
    del      : func(key: string) -> result<_, error>;
    del-many : func(keys: list<string>) -> result<_, error>;
    clear    : func() -> result<_, error>;
    entries  : func() -> result<list<tuple<string, string>>, error>;
    keys     : func() -> result<list<string>, error>;
    values   : func() -> result<list<string>, error>;

Host-provided functionality:

Wasi-keyvalue shim should be written to make use of the idb-keyval library (or simply idb), which is built on top of the browser's IndexedDB storage API. This would be easiest if it could be postponed until JSPI is farther along in its standardization/integration process. This will allow much more storage, and also allow subsequent phases of the persistence design (see below).

Persistence

User data shall not be immediately persisted. It shall only be persisted after all plugin calls have popped off the stack with successful return values.

Possible phase 3 implementation: The client-side data should work similarly to the server-side data. If a transaction was scheduled for execution from the plugin execution context, then any written data is not persisted until after an irreversible block is created that contains the successfully executed transaction. We can revisit this design later, but perhaps any client data writes during the window of uncertainty (before irreversible) happen on both the head branch and on the pending branch. If the pending branch is confirmed irreversible, the writes to the head branch are thrown out, and if the transaction is forked out then the writes to the pending branch are thrown out.

@James-Mart James-Mart added this to the R3 milestone Oct 2, 2024
@James-Mart James-Mart self-assigned this Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant