Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add micro_rpc method_id option to service protos." #4955

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions micro_rpc_tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ fn main() {
println!("cargo:rerun-if-env-changed=WORKSPACE_ROOT");
micro_rpc_build::compile(
&[format!("{}micro_rpc_tests/proto/test_schema.proto", env!("WORKSPACE_ROOT"))],
&[
format!("{}micro_rpc_tests/proto", env!("WORKSPACE_ROOT")),
env!("WORKSPACE_ROOT").to_string(),
],
&[format!("{}micro_rpc_tests/proto", env!("WORKSPACE_ROOT"))],
Default::default(),
);
}
25 changes: 6 additions & 19 deletions micro_rpc_tests/proto/test_schema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import "google/protobuf/empty.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "proto/micro_rpc/options.proto";

message LookupDataRequest {
bytes key = 1;
Expand All @@ -38,27 +37,15 @@ message LogResponse {}

service TestService {
// method_id: 15
rpc LookupData(LookupDataRequest) returns (LookupDataResponse) {
option (.oak.micro_rpc.method_id) = 15;
}
rpc LookupData(LookupDataRequest) returns (LookupDataResponse);
// method_id: 16
rpc Log(LogRequest) returns (LogResponse) {
option (.oak.micro_rpc.method_id) = 16;
}
rpc Log(LogRequest) returns (LogResponse);
// method_id: 17
rpc Empty(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (.oak.micro_rpc.method_id) = 17;
}
rpc Empty(google.protobuf.Empty) returns (google.protobuf.Empty);
// method_id: 18
rpc Duration(google.protobuf.Duration) returns (google.protobuf.Duration) {
option (.oak.micro_rpc.method_id) = 18;
}
rpc Duration(google.protobuf.Duration) returns (google.protobuf.Duration);
// method_id: 19
rpc Timestamp(google.protobuf.Timestamp) returns (google.protobuf.Timestamp) {
option (.oak.micro_rpc.method_id) = 19;
}
rpc Timestamp(google.protobuf.Timestamp) returns (google.protobuf.Timestamp);
// method_id: 20
rpc Any(google.protobuf.Any) returns (google.protobuf.Any) {
option (.oak.micro_rpc.method_id) = 20;
}
rpc Any(google.protobuf.Any) returns (google.protobuf.Any);
}
1 change: 0 additions & 1 deletion proto/oak_functions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ proto_library(
proto_library(
name = "testing_proto",
srcs = ["testing.proto"],
deps = ["//proto/micro_rpc:options_proto"],
)

build_test(
Expand Down
25 changes: 6 additions & 19 deletions proto/oak_functions/sdk/oak_functions_wasm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ syntax = "proto3";
package oak.functions.wasm.v1;

import "google/protobuf/wrappers.proto";
import "proto/micro_rpc/options.proto";

// The standard API for Oak Functions, which is exposed to Wasm modules via micro RPC, and wrapped
// by the Oak Functions SDK.
Expand All @@ -31,9 +30,7 @@ service StdWasmApi {
// This method is idempotent: multiple calls result in the same response.
//
// method_id: 0
rpc ReadRequest(ReadRequestRequest) returns (ReadRequestResponse) {
option (.oak.micro_rpc.method_id) = 0;
}
rpc ReadRequest(ReadRequestRequest) returns (ReadRequestResponse) {}

// Write a response for the client.
//
Expand All @@ -42,40 +39,30 @@ service StdWasmApi {
// runtime sends an empty response to the client.
//
// method_id: 1
rpc WriteResponse(WriteResponseRequest) returns (WriteResponseResponse) {
option (.oak.micro_rpc.method_id) = 1;
}
rpc WriteResponse(WriteResponseRequest) returns (WriteResponseResponse) {}

// Writes a debug log message.
//
// These log messages are considered sensitive, so will only be logged by the runtime if running
// in debug mode.
//
// method_id: 2
rpc Log(LogRequest) returns (LogResponse) {
option (.oak.micro_rpc.method_id) = 2;
}
rpc Log(LogRequest) returns (LogResponse) {}

// Looks up an item from the in-memory key/value lookup store.
//
// method_id: 3
rpc LookupData(LookupDataRequest) returns (LookupDataResponse) {
option (.oak.micro_rpc.method_id) = 3;
}
rpc LookupData(LookupDataRequest) returns (LookupDataResponse) {}

// Looks up multiple items from the in-memory key/value lookup store.
//
// method_id: 4
rpc LookupDataMulti(LookupDataMultiRequest) returns (LookupDataMultiResponse) {
option (.oak.micro_rpc.method_id) = 4;
}
rpc LookupDataMulti(LookupDataMultiRequest) returns (LookupDataMultiResponse) {}

// Test method only.
//
// method_id: 128
rpc Test(TestRequest) returns (TestResponse) {
option (.oak.micro_rpc.method_id) = 128;
}
rpc Test(TestRequest) returns (TestResponse) {}
}

message ReadRequestRequest {}
Expand Down
29 changes: 7 additions & 22 deletions proto/oak_functions/service/oak_functions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,66 +20,51 @@ package oak.functions;

import "proto/crypto/crypto.proto";
import "proto/attestation/evidence.proto";
import "proto/micro_rpc/options.proto";

service OakFunctions {
// Initializes the service and remote attestation keys.
//
// method_id: 0
rpc Initialize(InitializeRequest) returns (InitializeResponse) {
option (.oak.micro_rpc.method_id) = 0;
}
rpc Initialize(InitializeRequest) returns (InitializeResponse);

// Handles an invocation coming from a client.
//
// method_id: 1
rpc HandleUserRequest(InvokeRequest) returns (InvokeResponse) {
option (.oak.micro_rpc.method_id) = 1;
}
rpc HandleUserRequest(InvokeRequest) returns (InvokeResponse);

// Extends the next lookup data by the given chunk of lookup data. Only
// after the sender calls finishes building the next lookup data, the receiver replaces the
// current lookup data with the next lookup data, and only then chunk is will be served in
// lookups.
//
// method_id: 2
rpc ExtendNextLookupData(ExtendNextLookupDataRequest) returns (ExtendNextLookupDataResponse) {
option (.oak.micro_rpc.method_id) = 2;
}
rpc ExtendNextLookupData(ExtendNextLookupDataRequest) returns (ExtendNextLookupDataResponse);

// Finishes building the next lookup data with the given chunk of lookup data. The receiver
// replaces the current lookup data and the next lookup data will be served in lookups.
//
// method_id: 3
rpc FinishNextLookupData(FinishNextLookupDataRequest) returns (FinishNextLookupDataResponse) {
option (.oak.micro_rpc.method_id) = 3;
}
rpc FinishNextLookupData(FinishNextLookupDataRequest) returns (FinishNextLookupDataResponse);

// Aborts building the next lookup data.option
//
// method_id: 4
rpc AbortNextLookupData(Empty) returns (AbortNextLookupDataResponse) {
option (.oak.micro_rpc.method_id) = 4;
}
rpc AbortNextLookupData(Empty) returns (AbortNextLookupDataResponse);

// Streaming version combining `ExtendNextLookupData` and `FinishNextLookupData`.
//
// This is mainly for use with gRPC, as microRPC doesn't support streaming.
//
// method_id: 5
rpc StreamLookupData(stream LookupDataChunk) returns (FinishNextLookupDataResponse) {
option (.oak.micro_rpc.method_id) = 5;
}
rpc StreamLookupData(stream LookupDataChunk) returns (FinishNextLookupDataResponse);

// Reserves additional capacity for entries in the lookup table.
//
// It should be called before `ExtendNextLookupData`/`StreamLookupData` to reduce the
// number of memory allocations, but it's not mandatory to call this RPC.
//
// method_id: 6
rpc Reserve(ReserveRequest) returns (ReserveResponse) {
option (.oak.micro_rpc.method_id) = 6;
}
rpc Reserve(ReserveRequest) returns (ReserveResponse);
}

message InitializeRequest {
Expand Down
10 changes: 2 additions & 8 deletions proto/oak_functions/testing.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ syntax = "proto3";

package oak.functions.testing;

import "proto/micro_rpc/options.proto";

service TestModule {
// method_id: 0
rpc Lookup(LookupRequest) returns (LookupResponse) {
option (.oak.micro_rpc.method_id) = 0;
}
rpc Lookup(LookupRequest) returns (LookupResponse) {}
// method_id: 1
rpc EchoAndPanic(EchoAndPanicRequest) returns (EchoAndPanicResponse) {
option (.oak.micro_rpc.method_id) = 1;
}
rpc EchoAndPanic(EchoAndPanicRequest) returns (EchoAndPanicResponse) {}
}

message LookupRequest {
Expand Down
9 changes: 2 additions & 7 deletions testing/oak_echo_service/proto/oak_echo.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package oak.echo;

import "google/protobuf/empty.proto";
import "proto/attestation/evidence.proto";
import "proto/micro_rpc/options.proto";

message EchoRequest {
bytes body = 1;
Expand All @@ -36,12 +35,8 @@ message GetEvidenceResponse {

service Echo {
// method_id: 1988
rpc Echo(EchoRequest) returns (EchoResponse) {
option (.oak.micro_rpc.method_id) = 1988;
}
rpc Echo(EchoRequest) returns (EchoResponse);

// method_id: 1771
rpc GetEvidence(google.protobuf.Empty) returns (GetEvidenceResponse) {
option (.oak.micro_rpc.method_id) = 1771;
}
rpc GetEvidence(google.protobuf.Empty) returns (GetEvidenceResponse);
}