interface host {
use wasi:io/poll@0.2.11.{pollable};
use wasi:io/error@0.2.11.{error};
use wasi:io/streams@0.2.11.{stream-error};
variant value {
cbor(list<u8>),
cbor-iterator(value-iterator),
}
resource value-iterator {
read: func() -> option<result<list<u8>, stream-error>>;
blocking-read: func() -> result<list<u8>, stream-error>;
subscribe: func() -> pollable;
}
enum emit-type {
continuation,
end,
partial-result,
}
blocking-emit: func(%type: emit-type, %cbor: list<u8>);
resource future-hostcall {
subscribe: func() -> pollable;
get: func() -> option<result<result<list<u8>, error>>>;
}
hostcall: func(%type: string, %payload: list<u8>) -> future-hostcall;
}