Skip to content

Conversation

LucioFranco
Copy link
Member

cc @NeoLegends

Closes #81

@LucioFranco
Copy link
Member Author

Yeah...this will be a bit harder than anticipated...

@NeoLegends
Copy link

NeoLegends commented Oct 21, 2019

Yeah, this is the other option. I guess you're in the best position to know which bounds you will be able to satisfy in tonic.

For this implementation route we'd also want to add a test that ensures Streaming stays sync (when adding new members).

You might also want to add a Closes #82 to close the other PR automatically when this one is merged. I'll do the opposite on the other one.

@NeoLegends NeoLegends mentioned this pull request Oct 21, 2019
@LucioFranco
Copy link
Member Author

@seanmonstar would you be able to take a look at this?

@seanmonstar
Copy link
Member

What I'm about to say sounds dumb: for trait objects, the order of additional auto traits matters, and most places write them as dyn Foo + Send + Sync. That's to say, dyn Foo + Sync + Send isn't the same thing. 😭

@LucioFranco
Copy link
Member Author

@seanmonstar all i can say is lol

@NeoLegends
Copy link

Does this put #82 back on the table?

@LucioFranco
Copy link
Member Author

@NeoLegends we still want to go with this one but need to change the order of the bounds.

@LucioFranco
Copy link
Member Author

@seanmonstar can I get your +1 on this before we merge?

@LucioFranco LucioFranco merged commit 3ce61d9 into master Oct 30, 2019
@LucioFranco LucioFranco deleted the lucio/streaming-sync branch October 30, 2019 19:00
rabbitinspace pushed a commit to satelit-project/tonic that referenced this pull request Jan 1, 2020
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
3 participants