Skip to content

Conversation

NeoLegends
Copy link

@NeoLegends NeoLegends commented Oct 21, 2019

Safe because there are no &self methods on Streaming<T> that access any of its non Sync members.

Fixes #81
Closes #84

Safe because there are no `&self` methods on `Streaming<T>` that access any of its non `Sync` members.

Fixes hyperium#81
@LucioFranco
Copy link
Member

So I'm not sure this is the correct approach, we should instead add them via bounds.

@LucioFranco
Copy link
Member

done in #84 thank you for the help <3

brentalanmiller pushed a commit to brentalanmiller/tonic that referenced this pull request Oct 6, 2023
github-merge-queue bot pushed a commit to linera-io/linera-protocol that referenced this pull request Jun 4, 2025
## Motivation

Currently we have a lot of implementations in `linera-views` that don't
work on the Web because they require `Sync` bounds. For example,
`MapView` and `QueueView` are not usable on the Web.

## Proposal

Conditionally use `trait-variant` to add bounds to the traits themselves
rather than the implementations. [Futures should ‘always’ be
`Sync`](https://internals.rust-lang.org/t/what-shall-sync-mean-across-an-await/12020/18)
anyway.

`linera_storage_service::client` contains an implementation of
`KeyValueStore` that is not `Sync` even though it isn't on the Web, due
to a trait object inside `tonic` that
[has](hyperium/tonic#81)
[caused](hyperium/tonic#82)
[some](hyperium/tonic#84)
[contention](hyperium/tonic#117). For that
implementation, follow the solution [given
there](hyperium/tonic#117 (comment))
and use
[`sync_wrapper::SyncFuture`](https://docs.rs/sync_wrapper/latest/sync_wrapper/struct.SyncFuture.html)
to make the futures `Sync` based on the fact that they can only be used
through `Pin<&mut Self>` anyway.

Ditto `aws-smithy-async`.

## Test Plan

CI.

## Release Plan

- Nothing to do / These changes follow the usual release cycle.

## Links

- [reviewer
checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
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.

Consider making Streaming<T> Sync
2 participants