Skip to content
188 changes: 187 additions & 1 deletion internal/venice-common/src/main/proto/VeniceReadService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,35 @@ package com.linkedin.venice.protocols;
option java_multiple_files = true;

service VeniceReadService {
// Existing RPCs (implemented)
rpc get (VeniceClientRequest) returns (VeniceServerResponse) {}
rpc batchGet(VeniceClientRequest) returns (VeniceServerResponse) {}
rpc countByValue(CountByValueRequest) returns (CountByValueResponse) {}

// New RPCs below are defined for future implementation.
// Server-side implementation will be added in subsequent PRs.

rpc singleGet(SingleGetRequest) returns (SingleGetResponse) {}

rpc multiGet(MultiGetRequest) returns (MultiKeyResponse) {}

rpc multiGetStreaming(MultiGetRequest) returns (stream MultiKeyStreamingResponse) {}

rpc compute(ComputeRequest) returns (MultiKeyResponse) {}

rpc computeStreaming(ComputeRequest) returns (stream MultiKeyStreamingResponse) {}

rpc isServerHealthy(HealthCheckRequest) returns (HealthCheckResponse) {}

rpc getCompressionDictionary(CompressionDictionaryRequest) returns (CompressionDictionaryResponse) {}

rpc handleAdminRequest(AdminRequest) returns (AdminResponse) {}

rpc getMetadata(MetadataRequest) returns (MetadataResponse) {}

rpc getCurrentVersionInfo(CurrentVersionInfoRequest) returns (CurrentVersionInfoResponse) {}

rpc getIngestionContext(IngestionContextRequest) returns (IngestionContextResponse) {}
}

message VeniceClientRequest {
Expand Down Expand Up @@ -47,4 +73,164 @@ message CountByValueResponse {

message ValueCount {
map<string, int32> valueToCounts = 1;
}
}

/*
* Note: The following message formats will be evolved in the future. The current format is used
* for the initial implementation and helps refactor the existing code.
*
* Error handling: Errors are sent via gRPC's onError() mechanism using StatusRuntimeException
* with google.rpc.Status. Response messages do not contain errorMessage fields.
*/
message SingleGetRequest {
string resourceName = 1;
uint32 partition = 2;
string key = 3;
bool isRetryRequest = 4;
string keyEncodingType = 5;
}

message SingleGetResponse {
int32 statusCode = 1;
bytes value = 2;
sint32 schemaId = 3;
uint32 compressionStrategy = 4;
string contentType = 5;
uint32 contentLength = 6;
uint32 rcu = 7;
}

message MultiGetRequest {
string resourceName = 1;
bool isRetryRequest = 2;
// keyCount allows pre-allocating buffers without iterating the repeated keys field.
// Servers should validate keyCount == keys.size() if both are set.
uint32 keyCount = 3;
repeated MultiKeyRequestKey keys = 4;
repeated RpcRequestHeader headers = 5;
}

message MultiKeyRequestKey {
// Using int32 for consistency with MultiKeyStreamingResponse.keyIndex (sint32)
int32 keyIndex = 1;
uint32 partition = 2;
bytes keyBytes = 3;
}

message ComputeRequest {
string resourceName = 1;
bytes computeRequestBytes = 2;
sint32 computeValueSchemaId = 3;
bool isRetryRequest = 4;
uint32 apiVersion = 5;
// keyCount allows pre-allocating buffers without iterating the repeated keys field.
// Servers should validate keyCount == keys.size() if both are set.
uint32 keyCount = 6;
repeated MultiKeyRequestKey keys = 7;
repeated RpcRequestHeader headers = 8;
}

message MultiKeyResponse {
int32 statusCode = 1;
bytes value = 2;
sint32 schemaId = 3;
uint32 compressionStrategy = 4;
string contentType = 5;
uint32 contentLength = 6;
uint32 rcu = 7;
}

message MultiKeyStreamingResponse {
int32 statusCode = 1;
sint32 keyIndex = 2;
bytes value = 3;
sint32 schemaId = 4;
uint32 compressionStrategy = 5;
string contentType = 6;
uint32 contentLength = 7;
uint32 rcu = 8;
}

message RpcRequestHeader {
string key = 1;
string value = 2;
}

message HealthCheckRequest {
}

message HealthCheckResponse {
int32 statusCode = 1;
string message = 2;
}

message CompressionDictionaryRequest {
string storeName = 1;
uint32 storeVersion = 2;
}

message CompressionDictionaryResponse {
int32 statusCode = 1;
bytes value = 2;
string contentType = 3;
uint32 contentLength = 4;
}

// Enum corresponding to com.linkedin.venice.meta.ServerAdminAction.
// Non-zero values must match the integer values returned by ServerAdminAction.getValue()
// in Java. SERVER_ADMIN_ACTION_UNSPECIFIED = 0 indicates "no action specified" and must
// not be mapped to any Java enum value.
enum ServerAdminAction {
SERVER_ADMIN_ACTION_UNSPECIFIED = 0;
DUMP_INGESTION_STATE = 1;
DUMP_SERVER_CONFIGS = 2;
}

message AdminRequest {
string resourceName = 1;
optional uint32 partition = 2;
ServerAdminAction serverAdminAction = 3;
}

message AdminResponse {
int32 statusCode = 1;
bytes value = 2;
sint32 schemaId = 3;
string contentType = 4;
uint32 contentLength = 5;
}

message CurrentVersionInfoRequest {
string storeName = 1;
}

message CurrentVersionInfoResponse {
int32 statusCode = 1;
sint32 currentVersion = 2;
string contentType = 3;
}

message MetadataRequest {
string storeName = 1;
}

message MetadataResponse {
int32 statusCode = 1;
bytes value = 2;
sint32 schemaId = 3;
string contentType = 4;
uint32 contentLength = 5;
}

message IngestionContextRequest {
string versionTopicName = 1;
string topicName = 2;
uint32 partition = 3;
}

message IngestionContextResponse {
int32 statusCode = 1;
bytes value = 2;
string contentType = 3;
uint32 contentLength = 4;
}
Loading