IsolatedCompactionStrategy - #306
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses #305 by making compactionStrategy usable with IsolatedHive by replacing the non-sendable CompactionStrategy function parameter with a sendable IsolatedCompactionStrategy that can be serialized, transmitted across isolate boundaries, and rehydrated inside the Hive isolate.
Changes:
- Introduces
IsolatedCompactionStrategy(JSON-serializable) withthreshold(...)andnever()options and rehydrates it in the Hive isolate handler. - Updates
IsolatedHiveAPIs and implementations (VM/web/stub) to acceptIsolatedCompactionStrategy?instead ofCompactionStrategy?. - Adds
build.yamlconfiguration and updates generated files to include consistentignore_for_filedirectives.
Reviewed changes
Copilot reviewed 8 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| hive/lib/src/schema/hive_schema.g.dart | Adds generated-file ignore directives. |
| hive/lib/src/isolate/isolated_hive.dart | Changes compactionStrategy API type to IsolatedCompactionStrategy?. |
| hive/lib/src/isolate/isolated_hive_impl/impl/isolated_hive_impl_web.dart | Resolves IsolatedCompactionStrategy into a real CompactionStrategy on web. |
| hive/lib/src/isolate/isolated_hive_impl/impl/isolated_hive_impl_vm.dart | Serializes compaction strategy via toJson() when invoking isolate method calls. |
| hive/lib/src/isolate/isolated_hive_impl/impl/isolated_hive_impl_stub.dart | Updates stub signatures to match new API type. |
| hive/lib/src/isolate/isolated_compaction_strategy.dart | New sendable compaction strategy definition + (de)serialization and resolver. |
| hive/lib/src/isolate/isolated_compaction_strategy.g.dart | Generated JSON serialization for the threshold strategy. |
| hive/lib/src/isolate/handler/isolated_hive_handler.dart | Rehydrates compaction strategy JSON into an executable function in the Hive isolate. |
| hive/lib/src/connect/hive_connect_api.g.dart | Adds generated-file ignore directives. |
| hive/lib/src/backend/lock_props.g.dart | Adds generated-file ignore directives. |
| hive/lib/hive.dart | Exports isolated_compaction_strategy.dart as part of the public API. |
| hive/build.yaml | Configures generator ignore directives across generated .g.dart files. |
Files not reviewed (4)
- hive/lib/src/backend/lock_props.g.dart: Generated file
- hive/lib/src/connect/hive_connect_api.g.dart: Generated file
- hive/lib/src/isolate/isolated_compaction_strategy.g.dart: Generated file
- hive/lib/src/schema/hive_schema.g.dart: Generated file
💡 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 @@
## main #306 +/- ##
==========================================
+ Coverage 93.40% 93.47% +0.06%
==========================================
Files 64 66 +2
Lines 2625 2666 +41
==========================================
+ Hits 2452 2492 +40
- Misses 173 174 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Closes #305