Skip to content

Commit

Permalink
init wired-dwn
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Oct 2, 2024
1 parent bc7de8f commit 5a54170
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 31 deletions.
53 changes: 53 additions & 0 deletions spatial/wit/wired-dwn/records.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
interface records-query {
use types.{message, status};

record records-query-reply {
entries: list<message>,
status: status,
}

resource records-query {
poll: func() -> option<records-query-reply>;
finished: func() -> bool;
}

resource records-query-builder {
protocol: func() -> option<string>;
set-protocol: func(value: option<string>);

record-id: func() -> option<string>;
set-record-id: func(value: option<string>);

schema: func() -> option<string>;
set-schema: func(value: option<string>);

run: func() -> records-query;
}
}

interface records-write {
use types.{message, status};

record records-write-reply {
record-id: string,
status: status,
}

resource records-write {
poll: func() -> option<records-write-reply>;
finished: func() -> bool;
}

resource records-write-builder {
protocol: func() -> option<string>;
set-protocol: func(value: option<string>);

record-id: func() -> option<string>;
set-record-id: func(value: option<string>);

schema: func() -> option<string>;
set-schema: func(value: option<string>);

run: func() -> records-write;
}
}
40 changes: 9 additions & 31 deletions spatial/wit/wired-dwn/world.wit
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package wired:dwn;

world host {
import api;
import dwn;
}

interface api {
use dwn.{dwn};
interface dwn {
use records-query.{records-query-builder};
use records-write.{records-write-builder};

resource dwn {
records-query: func() -> records-query-builder;
records-write: func() -> records-write-builder;
}

/// Get the local user's DWN.
local-dwn: func() -> dwn;
Expand All @@ -15,7 +20,7 @@ interface api {
world-host-dwn: func() -> dwn;
}

interface dwn {
interface types {
record encrypted-data {
alg: string,
ciphertext: string,
Expand All @@ -38,31 +43,4 @@ interface dwn {
code: u16,
detail: option<string>,
}

record query-reply {
entries: list<message>,
status: status,
}

resource query {
poll: func() -> option<query-reply>;
finished: func() -> bool;
}

resource query-builder {
protocol: func() -> option<string>;
set-protocol: func(value: option<string>);

record-id: func() -> option<string>;
set-record-id: func(value: option<string>);

schema: func() -> option<string>;
set-schema: func(value: option<string>);

run: func() -> query;
}

resource dwn {
query: func() -> query-builder;
}
}

0 comments on commit 5a54170

Please sign in to comment.