65 lines
2.0 KiB
Protocol Buffer
65 lines
2.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
package waymaker.cache;
|
|
|
|
option go_package = "/apis/waymaker_cache";
|
|
|
|
// ============================================================
|
|
// WaymakerCacheService — generic TTL / eviction layer over any
|
|
// bucket-shaped store (KV, Hash, Set). Methods are deliberately
|
|
// minimal at this stage; the design will land alongside the
|
|
// first concrete eviction policy (LRU, ARC, expiry-driven).
|
|
//
|
|
// Phase-5 milestone:
|
|
// - This proto pins the crate layout + the wire namespace
|
|
// (`waymaker.cache`) so clients don't need to migrate when
|
|
// real handlers ship.
|
|
// - The server registers the service but every RPC returns
|
|
// `Unimplemented` until the policy work lands.
|
|
// ============================================================
|
|
|
|
service WaymakerCacheService {
|
|
// Apply a TTL policy to a bucket. `policy_id` selects from
|
|
// server-configured policies (initially: `lru`, `expiry`).
|
|
rpc AttachPolicy (AttachPolicyRequest) returns (AttachPolicyResponse);
|
|
|
|
// Detach the policy currently bound to `bucket` (no-op if
|
|
// none).
|
|
rpc DetachPolicy (DetachPolicyRequest) returns (DetachPolicyResponse);
|
|
|
|
// Report current cache stats (hit/miss/eviction counters,
|
|
// memory footprint) for a bucket.
|
|
rpc Stats (StatsRequest) returns (StatsResponse);
|
|
}
|
|
|
|
message AttachPolicyRequest {
|
|
string bucket = 1;
|
|
string policy_id = 2;
|
|
// Policy-specific knobs (e.g. `max_entries`, `default_ttl_ms`)
|
|
// — interpretation is server-side.
|
|
map<string, string> params = 3;
|
|
}
|
|
message AttachPolicyResponse {
|
|
bool success = 1;
|
|
string result_code = 2;
|
|
string message = 3;
|
|
}
|
|
|
|
message DetachPolicyRequest { string bucket = 1; }
|
|
message DetachPolicyResponse {
|
|
bool success = 1;
|
|
string result_code = 2;
|
|
string message = 3;
|
|
}
|
|
|
|
message StatsRequest { string bucket = 1; }
|
|
message StatsResponse {
|
|
bool success = 1;
|
|
string result_code = 2;
|
|
string message = 3;
|
|
uint64 hit_count = 4;
|
|
uint64 miss_count = 5;
|
|
uint64 eviction_count = 6;
|
|
uint64 size_bytes = 7;
|
|
uint64 entry_count = 8;
|
|
}
|