Skip to content

Commit

Permalink
Accept compressed RPCs in Oak Functions trusted app
Browse files Browse the repository at this point in the history
  • Loading branch information
andrisaar committed Jan 23, 2024
1 parent 5641a13 commit a399a1b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion oak_functions_containers_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ opentelemetry-otlp = { version = "*", default-features = false, features = [
prost = "*"
tokio = { version = "*", features = ["rt-multi-thread", "macros", "sync"] }
tokio-stream = { version = "*", features = ["net"] }
tonic = { workspace = true }
tonic = { workspace = true, features = ["gzip"] }
tower = { version = "*", features = ["load-shed"] }
tower-http = { version = "*", features = ["trace"] }
tracing = "*"
Expand Down
4 changes: 3 additions & 1 deletion oak_functions_containers_app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use opentelemetry::{
use prost::Message;
use tokio::net::TcpListener;
use tokio_stream::{wrappers::TcpListenerStream, StreamExt};
use tonic::codec::CompressionEncoding;
use tracing::Span;

use crate::proto::oak::functions::oak_functions_server::{OakFunctions, OakFunctionsServer};
Expand Down Expand Up @@ -407,7 +408,8 @@ pub async fn serve<G: AsyncEncryptionKeyHandle + Send + Sync + 'static>(
encryption_key_handle,
Some(Arc::new(OtelObserver::new(meter))),
))
.max_decoding_message_size(MAX_DECODING_MESSAGE_SIZE),
.max_decoding_message_size(MAX_DECODING_MESSAGE_SIZE)
.accept_compressed(CompressionEncoding::Gzip),
)
.serve_with_incoming(TcpListenerStream::new(listener))
.await
Expand Down
4 changes: 2 additions & 2 deletions oak_functions_containers_app/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use oak_functions_containers_app::serve;
use oak_functions_service::proto::oak::functions::InitializeRequest;
use opentelemetry::metrics::{noop::NoopMeterProvider, MeterProvider};
use tokio::net::TcpListener;
use tonic::transport::Endpoint;
use tonic::{codec::CompressionEncoding, transport::Endpoint};

use crate::proto::oak::functions::oak_functions_client::OakFunctionsClient;

Expand All @@ -60,7 +60,7 @@ async fn test_lookup() {
.connect()
.await
.expect("couldn't connect to trusted app");
OakFunctionsClient::new(channel)
OakFunctionsClient::new(channel).send_compressed(CompressionEncoding::Gzip)
};

let _ = oak_functions_client
Expand Down

0 comments on commit a399a1b

Please sign in to comment.