mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-04 21:06:03 +02:00
93 lines
2.2 KiB
Protocol Buffer
93 lines
2.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package databroker;
|
|
option go_package = "github.com/pomerium/pomerium/pkg/grpc/databroker";
|
|
|
|
import "google/protobuf/any.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
message Record {
|
|
uint64 version = 1;
|
|
string type = 2;
|
|
string id = 3;
|
|
google.protobuf.Any data = 4;
|
|
google.protobuf.Timestamp modified_at = 5;
|
|
google.protobuf.Timestamp deleted_at = 6;
|
|
}
|
|
message Versions {
|
|
// the server version indicates the version of the server storing the data
|
|
uint64 server_version = 1;
|
|
uint64 latest_record_version = 2;
|
|
}
|
|
|
|
// Options are the options for a type stored in the databroker.
|
|
message Options {
|
|
// capacity sets a maximum size for the given type. Once the capacity is
|
|
// reached the oldest records will be removed.
|
|
optional uint64 capacity = 1;
|
|
}
|
|
|
|
message GetRequest {
|
|
string type = 1;
|
|
string id = 2;
|
|
}
|
|
message GetResponse {
|
|
Record record = 1;
|
|
}
|
|
|
|
message QueryRequest {
|
|
string type = 1;
|
|
string query = 2;
|
|
int64 offset = 3;
|
|
int64 limit = 4;
|
|
}
|
|
message QueryResponse {
|
|
repeated Record records = 1;
|
|
int64 total_count = 2;
|
|
}
|
|
|
|
message PutRequest { Record record = 1; }
|
|
message PutResponse {
|
|
uint64 server_version = 1;
|
|
Record record = 2;
|
|
}
|
|
|
|
message SetOptionsRequest {
|
|
string type = 1;
|
|
Options options = 2;
|
|
}
|
|
message SetOptionsResponse {
|
|
Options options = 1;
|
|
}
|
|
|
|
message SyncRequest {
|
|
uint64 server_version = 1;
|
|
uint64 record_version = 2;
|
|
}
|
|
message SyncResponse {
|
|
Record record = 1;
|
|
}
|
|
|
|
message SyncLatestRequest { string type = 1; }
|
|
message SyncLatestResponse {
|
|
oneof response {
|
|
Record record = 1;
|
|
Versions versions = 2;
|
|
}
|
|
}
|
|
|
|
// The DataBrokerService stores key-value data.
|
|
service DataBrokerService {
|
|
// Get gets a record.
|
|
rpc Get(GetRequest) returns (GetResponse);
|
|
// Put saves a record.
|
|
rpc Put(PutRequest) returns (PutResponse);
|
|
// Query queries for records.
|
|
rpc Query(QueryRequest) returns (QueryResponse);
|
|
// SetOptions sets the options for a type in the databroker.
|
|
rpc SetOptions(SetOptionsRequest) returns (SetOptionsResponse);
|
|
// Sync streams changes to records after the specified version.
|
|
rpc Sync(SyncRequest) returns (stream SyncResponse);
|
|
// SyncLatest streams the latest version of every record.
|
|
rpc SyncLatest(SyncLatestRequest) returns (stream SyncLatestResponse);
|
|
}
|