Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cc341be
Add back the Client trait, renamed Stub.
tikue Nov 13, 2022
5551108
Add request hooks to the Serve trait.
tikue Nov 8, 2022
7f02cf7
Use rust nightly for Github workflows.
tikue Nov 13, 2022
30710db
Use async fn in generated traits!!
tikue Nov 23, 2022
e23bba7
Replace actions-rs
tikue Nov 24, 2022
ff26d02
Remove bad mem::forget usage.
tikue Nov 24, 2022
3f47cce
Add ability to create a BaseChannel with a Transport dealing with Req…
axos88 Feb 10, 2023
60edf4f
add request sequencer
axos88 Feb 12, 2023
f52cd0f
revert base channel to having unit context, and move the contextual c…
axos88 Feb 12, 2023
416090f
fix merge differences
axos88 Feb 12, 2023
d358a83
revert atomics change to u64
axos88 Feb 13, 2023
c176528
fix formatting
axos88 Feb 13, 2023
33ce197
wip
axos88 Feb 16, 2023
61aa139
Add back the Client trait, renamed Stub.
tikue Nov 13, 2022
2fb75d9
Add request hooks to the Serve trait.
tikue Nov 8, 2022
4e2a499
Use rust nightly for Github workflows.
tikue Nov 13, 2022
e703da5
Use async fn in generated traits!!
tikue Nov 23, 2022
4d24dde
Replace actions-rs
tikue Nov 24, 2022
4031281
Remove bad mem::forget usage.
tikue Nov 24, 2022
b500b72
fix rebase errors
axos88 Apr 10, 2023
a257f3a
Merge branch 'tikuemaster' into typescript
axos88 Apr 10, 2023
404c657
fix
axos88 Apr 10, 2023
f198cfb
wip
axos88 May 4, 2023
f12acc0
remove request sequencer
axos88 May 4, 2023
5f52e5c
wip internal mutability
axos88 May 6, 2023
03a5bf0
revert merge of google/master
axos88 May 6, 2023
d66bf17
revert rename of context to trace_context
axos88 May 6, 2023
cc67311
fixes
axos88 May 6, 2023
02c276a
fix tests
axos88 May 6, 2023
aa65d58
fix compile errors
axos88 Nov 6, 2023
a3874dd
fix tests
axos88 Nov 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
with:
targets: mipsel-unknown-linux-gnu
- run: cargo check --all-features
Expand All @@ -33,7 +33,7 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
- run: cargo test
- run: cargo test --manifest-path tarpc/Cargo.toml --features serde1
- run: cargo test --manifest-path tarpc/Cargo.toml --features tokio1
Expand All @@ -50,7 +50,7 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
Expand All @@ -64,7 +64,7 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- run: cargo clippy --all-features -- -D warnings
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Some other features of tarpc:
Add to your `Cargo.toml` dependencies:

```toml
tarpc = "0.33"
tarpc = "0.31"
```

The `tarpc::service` attribute expands to a collection of items that form an rpc service.
Expand Down Expand Up @@ -127,7 +127,7 @@ impl World for HelloServer {

type HelloFut = Ready<String>;

fn hello(self, _: context::Context, name: String) -> Self::HelloFut {
fn hello(self, _: &mut context::Context, name: String) -> Self::HelloFut {
future::ready(format!("Hello, {name}!"))
}
}
Expand Down
24 changes: 0 additions & 24 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
## 0.33.0 (2023-04-01)

### Breaking Changes

Opentelemetry dependency version increased to 0.18.

## 0.32.0 (2023-03-24)

### Breaking Changes

- As part of a fix to return more channel errors in RPC results, a few error types have changed:

0. `client::RpcError::Disconnected` was split into the following errors:
- Shutdown: the client was shutdown, either intentionally or due to an error. If due to an
error, pending RPCs should see the more specific errors below.
- Send: an RPC message failed to send over the transport. Only the RPC that failed to be sent
will see this error.
- Receive: a fatal error occurred while receiving from the transport. All in-flight RPCs will
receive this error.
0. `client::ChannelError` and `server::ChannelError` are unified in `tarpc::ChannelError`.
Previously, server transport errors would not indicate during which activity the transport
error occurred. Now, just like the client already was, it will be specific: reading, readying,
sending, flushing, or closing.

## 0.31.0 (2022-11-03)

### New Features
Expand Down
4 changes: 2 additions & 2 deletions example-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tarpc-example-service"
version = "0.15.0"
version = "0.13.0"
rust-version = "1.56"
authors = ["Tim Kuehn <tikue@google.com>"]
edition = "2021"
Expand All @@ -21,7 +21,7 @@ futures = "0.3"
opentelemetry = { version = "0.17", features = ["rt-tokio"] }
opentelemetry-jaeger = { version = "0.16", features = ["rt-tokio"] }
rand = "0.8"
tarpc = { version = "0.33", path = "../tarpc", features = ["full"] }
tarpc = { version = "0.31", path = "../tarpc", features = ["full"] }
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread"] }
tracing = { version = "0.1" }
tracing-opentelemetry = "0.17"
Expand Down
8 changes: 2 additions & 6 deletions example-service/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ async fn main() -> anyhow::Result<()> {
let flags = Flags::parse();
init_tracing("Tarpc Example Client")?;

let mut transport = tarpc::serde_transport::tcp::connect(flags.server_addr, Json::default);
transport.config_mut().max_frame_length(usize::MAX);
let transport = tarpc::serde_transport::tcp::connect(flags.server_addr, Json::default);

// WorldClient is generated by the service attribute. It has a constructor `new` that takes a
// config and any Transport as input.
Expand All @@ -43,10 +42,7 @@ async fn main() -> anyhow::Result<()> {
.instrument(tracing::info_span!("Two Hellos"))
.await;

match hello {
Ok(hello) => tracing::info!("{hello:?}"),
Err(e) => tracing::warn!("{:?}", anyhow::Error::from(e)),
}
tracing::info!("{:?}", hello);

// Let the background span processor finish.
sleep(Duration::from_micros(1)).await;
Expand Down
10 changes: 6 additions & 4 deletions example-service/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

use clap::Parser;
use futures::{future, prelude::*};
use rand::{
Expand Down Expand Up @@ -34,16 +33,19 @@ struct Flags {
#[derive(Clone)]
struct HelloServer(SocketAddr);

#[tarpc::server]
impl World for HelloServer {
async fn hello(self, _: context::Context, name: String) -> String {
async fn hello(self, _: &mut context::Context, name: String) -> String {
let sleep_time =
Duration::from_millis(Uniform::new_inclusive(1, 10).sample(&mut thread_rng()));
time::sleep(sleep_time).await;
format!("Hello, {name}! You are connected from {}", self.0)
}
}

async fn spawn(fut: impl Future<Output = ()> + Send + 'static) {
tokio::spawn(fut);
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let flags = Flags::parse();
Expand All @@ -66,7 +68,7 @@ async fn main() -> anyhow::Result<()> {
// the generated World trait.
.map(|channel| {
let server = HelloServer(channel.transport().peer_addr().unwrap());
channel.execute(server.serve())
channel.execute(server.serve()).for_each(spawn)
})
// Max 10 channels.
.buffer_unordered(10)
Expand Down
10 changes: 5 additions & 5 deletions hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ command -v rustup &>/dev/null
if [ "$?" == 0 ]; then
printf "${SUCCESS}\n"

try_run "Building ... " cargo +stable build --color=always
try_run "Testing ... " cargo +stable test --color=always
try_run "Testing with all features enabled ... " cargo +stable test --all-features --color=always
for EXAMPLE in $(cargo +stable run --example 2>&1 | grep ' ' | awk '{print $1}')
try_run "Building ... " cargo build --color=always
try_run "Testing ... " cargo test --color=always
try_run "Testing with all features enabled ... " cargo test --all-features --color=always
for EXAMPLE in $(cargo run --example 2>&1 | grep ' ' | awk '{print $1}')
do
try_run "Running example \"$EXAMPLE\" ... " cargo +stable run --example $EXAMPLE
try_run "Running example \"$EXAMPLE\" ... " cargo run --example $EXAMPLE
done

check_toolchain nightly
Expand Down
Loading