databroker: add options for maximum capacity (#2095)

* databroker: add options

* implement redis

* add trace for enforce options
This commit is contained in:
Caleb Doxsey 2021-04-26 17:14:54 -06:00 committed by GitHub
parent b3216ae854
commit 636b3d6846
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1085 additions and 419 deletions

View file

@ -20,6 +20,13 @@ message Versions {
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;
@ -46,6 +53,14 @@ message PutResponse {
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;
@ -71,6 +86,8 @@ service DataBrokerService {
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.