Skip to content

feat(go)!: represent async values as chan - #1585

Open
rvolosatovs wants to merge 2 commits into
mainfrom
feat/go-channels
Open

rvolosatovs wants to merge 2 commits into
mainfrom
feat/go-channels

Conversation

@rvolosatovs

Copy link
Copy Markdown
Member

No description provided.

@rvolosatovs
rvolosatovs force-pushed the feat/go-channels branch 4 times, most recently from c999f5d to 1d5ede9 Compare October 26, 2026 18:18
@rvolosatovs
rvolosatovs changed the base branch from main to fix/go-futures-streams October 26, 2026 18:18
@rvolosatovs
rvolosatovs changed the base branch from fix/go-futures-streams to main October 26, 2026 18:26
@rvolosatovs
rvolosatovs enabled auto-merge October 26, 2026 18:32
@rvolosatovs
rvolosatovs force-pushed the feat/go-channels branch 2 times, most recently from 714a5d1 to bbcc432 Compare October 26, 2026 18:35
@rvolosatovs
rvolosatovs disabled auto-merge October 26, 2026 18:36
A `future<T>` is now a `<-chan T`, which receives the value once the
future resolves and is closed afterwards, and a `stream<T>` is a
`<-chan []T` of chunks, which is closed once the stream ends. The values
cannot fail: as in Rust, a future never resolves after a failed read,
and a stream ends. Readers of pending values return a deferred read
alongside the value, like writers return a deferred write, and its error
is reported on the client's error channel, renamed from `writeErrs__` to
`errs__`, or logged by the server.

The deferred read takes a `context.Context` and stops once it is done,
so an unconsumed channel does not block it forever. The client reads
with the invocation context, and the server cancels the context of the
deferred parameter reads once the handler returned and the results were
written.

`IndexReader` gains `Buffered`, which a pending future read uses to
reject data received after the value, like Rust does.

This also fixes `future<u8>`, `future<list<u8>>` and futures held by
resources, which did not compile before.

Assisted-by: claude:claude-opus-5-5
The served function logged the handler error instead of the error
returned by closing the parameter reader.

Assisted-by: claude:claude-opus-5-5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant