Store custom schema metas as proto binary in pogreb cache#1994
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors custom schema meta handling so the cache backends stream *structpb.Struct directly (instead of raw []byte), and updates the pogreb cache backend to store metas in protobuf binary format to reduce per-query JSON parsing overhead.
Changes:
- Updates the cache backend interface to
SendMetas(..., func(*structpb.Struct) error)and simplifiesListPackageCustomSchemasto forward the sender directly. - Changes the pogreb backend to convert incoming meta JSON to protobuf wire format at write time and
proto.Unmarshalit at read time. - Updates the JSON backend to continue storing JSON on disk but unmarshal into
structpb.Structat read time.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/cache/pogrebv1.go | Switches pogreb meta storage from JSON bytes to protobuf binary and changes SendMetas to emit *structpb.Struct. |
| pkg/cache/json.go | Changes SendMetas to unmarshal stored JSON into *structpb.Struct before sending. |
| pkg/cache/cache.go | Updates backend interface and removes shared JSON→Struct conversion in ListPackageCustomSchemas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1994 +/- ##
==========================================
- Coverage 58.77% 58.75% -0.03%
==========================================
Files 141 141
Lines 13418 13426 +8
==========================================
+ Hits 7887 7889 +2
- Misses 4322 4325 +3
- Partials 1209 1212 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/approved |
PutMeta receives JSON and each backend decides its internal format. Pogreb now converts JSON to proto binary at build time and uses proto.Unmarshal at read time, which is cheaper than JSON parsing. The SendMetas sender signature changes to func(*structpb.Struct) so backends own the deserialization. JSON backend still stores and parses JSON. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a45c0b6 to
a82fb7d
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tmshort The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
23c2915
into
operator-framework:master
Description of the change:
Changes the
SendMetasbackend method to send*structpb.Structinstead of raw[]byte,pushing deserialization responsibility into each backend implementation.
The pogreb backend now converts incoming JSON to protobuf binary wire format at write time
(
PutMeta) and usesproto.Unmarshalat read time (SendMetas), which is significantlycheaper than JSON parsing. The JSON backend continues to store JSON on disk and unmarshals
at read time.
This eliminates the JSON→structpb.Struct conversion that previously happened in the shared
ListPackageCustomSchemasmethod, since each backend now owns the full round-trip.Motivation for the change:
Proto binary deserialization is 2-5x faster than JSON for structpb.Struct. Since the pogreb
cache is built infrequently but read on every query, shifting the JSON parse cost to build
time reduces per-request latency.
Reviewer Checklist
/docs