Repository navigation
refactor: split PayloadFieldIndex into read + write traits - #8966
Conversation
…ldIndexRead Mirror the IdTracker / IdTrackerRead split. PayloadFieldIndexRead holds the read-only query surface (count_indexed_points, filter, estimate_cardinality, for_each_payload_block); PayloadFieldIndex: PayloadFieldIndexRead retains storage-lifecycle methods (wipe, flusher, files, immutable_files). All 11 impls updated (numeric_index, map_index x3, null_index x3, bool_index x3, full_text_index, geo_index). Test imports adjusted where they use the read-side methods. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
📝 WalkthroughWalkthroughThis pull request refactors the payload field index trait system to separate read and write concerns. A new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Mirror the PayloadFieldIndex / PayloadFieldIndexRead split (#8966) one layer up at the FieldIndex enum level. FieldIndexRead names the uniform read-only surface (filter, estimate_cardinality, count_indexed_points, for_each_payload_block, get_telemetry_data, values_count, values_is_empty, special_check_condition, as_numeric, as_facet_index) — the methods that StructPayloadIndexReadView and its helpers reach through IndexesMap. Trait declaration only. No impl, no callers in this PR — this is purely additive. Follow-up PRs will impl it on FieldIndex, then migrate non-destructuring helpers to a FieldIndexRead bound. as_numeric and as_facet_index use return-position impl Trait (impl NumericFieldIndexRead + '_, impl FacetIndex + '_), matching how PayloadIndexRead exposes the same shapes. The trait is therefore not object-safe; consumers will use a generic bound rather than &dyn FieldIndexRead. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…ldIndexRead (#8966) Mirror the IdTracker / IdTrackerRead split. PayloadFieldIndexRead holds the read-only query surface (count_indexed_points, filter, estimate_cardinality, for_each_payload_block); PayloadFieldIndex: PayloadFieldIndexRead retains storage-lifecycle methods (wipe, flusher, files, immutable_files). All 11 impls updated (numeric_index, map_index x3, null_index x3, bool_index x3, full_text_index, geo_index). Test imports adjusted where they use the read-side methods. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Mirror the PayloadFieldIndex / PayloadFieldIndexRead split (#8966) one layer up at the FieldIndex enum level. FieldIndexRead names the uniform read-only surface (filter, estimate_cardinality, count_indexed_points, for_each_payload_block, get_telemetry_data, values_count, values_is_empty, special_check_condition, as_numeric, as_facet_index) — the methods that StructPayloadIndexReadView and its helpers reach through IndexesMap. Trait declaration only. No impl, no callers in this PR — this is purely additive. Follow-up PRs will impl it on FieldIndex, then migrate non-destructuring helpers to a FieldIndexRead bound. as_numeric and as_facet_index use return-position impl Trait (impl NumericFieldIndexRead + '_, impl FacetIndex + '_), matching how PayloadIndexRead exposes the same shapes. The trait is therefore not object-safe; consumers will use a generic bound rather than &dyn FieldIndexRead. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
PayloadFieldIndexinto a read-only supertraitPayloadFieldIndexRead(carryingcount_indexed_points,filter,estimate_cardinality,for_each_payload_block) and the existingPayloadFieldIndex: PayloadFieldIndexReadfor storage-lifecycle methods (wipe,flusher,files,immutable_files).IdTracker/IdTrackerReadsplit — lets read-only consumers depend on the query surface without pulling in storage-lifecycle methods.numeric_index,map_indexx3,null_indexx3,bool_indexx3,full_text_index,geo_index) to split into twoimplblocks.numeric_index/tests.rs,full_text_index/tests/test_congruence.rs,mutable_text_index.rs).Pure refactor — no behavior changes. Trait-object users (
&dyn PayloadFieldIndex) still get all methods through the supertrait.Test plan
🤖 Generated with Claude Code