phive 0.9.0
phive: ^0.9.0 copied to clipboard
Annotation-driven runtime for Hive CE with hook pipelines and consumer APIs.
0.9.0 #
Model layouts remain opt-in. This update revises unreleased 0.9.0 drift handling.
- Add the
TolerantLayoutclass hook. Opted-in models store a version-3 header plus a map of field tag to value, so records survive added, removed and reordered fields. Incompatible records raisePHiveSchemaDriftExceptioninstead of decoding wrong values. extractMetadataHeaderaccepts header versions 2 and 3 and reports which it read (positionalVersion,taggedVersion,isTagged).- Add
PHiveDriftPolicyon both routers, as a router default and perregistercall.propagate(default) never deletes.deleteAndMissremoves drifted entries, including records with a tombstoned type ID, and treats them as misses inget,getAlland container traversal. - Add explicit
PHiveTombstoneAdapterandregisterPHiveTombstone. Typed tombstones replace Hive error-message matching. Untombstoned unknown type IDs propagate under every policy and their stored entries are preserved. Apps must explicitly call the generatedregisterPHiveTombstones()after normal adapter registration to handle retired data as drift. - Add
schemaFingerprintonPTypeAdapter, thePHiveFingerprintedinterface, andphiveSchemaFingerprintto combine adapters into one order-independent value. - Add
PTypeAdapter.castStored, used by tolerant adapters for type checks that survive optimized web builds. - Downgrade caveat: 0.8.x cannot read records written in the tagged layout. Do not downgrade a store after writing tolerant records, or clear it first.
Tolerant layout cost, measured with flutter test --no-pub benchmark/tolerant_benchmark.dart in phive_test (Dart VM, 20,000
iterations, two runs):
| Model | Encode (µs/op) | Decode (µs/op) | Bytes |
|---|---|---|---|
| positional twin (5 fields incl. list and map, no hooks) | 0.92–0.97 | 0.68 | 118 |
| tagged twin (same fields) | 1.75–1.76 | 1.61 | 222 |
| positional record with 20 one-field items (one hooked field) | 4.15–4.19 | 2.46–2.52 | 409 |
| tagged lesson with 20 two-field tagged cards | 19.3 | 14.5–14.6 | 2258 |
Most of the extra size is the version-3 metadata header. Every tagged record carries one, including each nested tagged card. The two nested rows have different shapes and show orders of magnitude, not a like-for-like comparison.
0.8.1 #
-
Apply Dart 3.13 formatting to existing library sources.
-
Verify Hive CE 2.24.0 compatibility, including existing records, without raising the public
hive_ceminimum. Examples now select^2.24.0. -
Add a self-contained, runnable storage example with generated adapters.
-
Include the full Apache-2.0 and BSD-3-Clause license texts while preserving the existing dual-license choice.
0.8.0 #
-
deleteWithChildrenremoves descendants at every level of registered relationships and cleans up their traversed ref entries. Previously it deleted only direct children. To delete only direct children, usedeleteContainerfor the applicable containers, thendeletethe parent. -
Fix typed child-box opening during cascade deletion and give container handles value equality.
-
Reconcile relationships from current storage across sequential writes by multiple routers. Batch static-router reads while honoring hook policies.
0.7.0 #
- Reconcile child references on successful stores in both routers, so moving a child removes former-parent membership and protects it from former-container deletion. Primary-only deletion/reset semantics and record formats are unchanged.
- Document stable generated store names and explicit names for manual registration.
- Align with generator and hook packages at 0.7.0. Regenerated default descriptors may target different stores than earlier minified builds; recreate affected stores or arrange an application-owned migration.
0.6.0 #
- Added
PHiveRouter.clear()— empties every primary box and ref store while keeping boxes/BoxCollectionopen and the schema intact (data reset, not teardown). - Added
PHiveRouter.clearType<T>()— empties one type's primary box without cascading into ref stores. - Added
PHiveRouter.getAll<T>()— enumerates every stored item of a type, skipping entries a hook rejects on read. - Redesigned PHive hook metadata storage to use one versioned record header with
globalandperFieldsections. - Removed the legacy
%PVR%and%PAR%payload/envelope formats and the associated runtime helper surface.
0.3.0 #
- added true classhooks
0.2.1 #
- Fixed
PTypeAdapter.serializePayloadreturning the string"null"for null field values; now returnsnulldirectly so Hive stores a true null and nullable-typed casts (as int?) succeed on read.
0.2.0 #
- Added
PHiveAutoTypeannotation — same surface asPHiveTypebut withouttypeId; resolved at build time fromphive_type_registry.json.
0.1.0 #
- Initial runtime release for PHive annotations and hook pipelines.
- Added
PHiveDynamicRouterandPHiveStaticRouterstorage flows. - Added generated-router descriptor support with
@PHivePrimaryKeyand@PHiveRef. - Added behavior-driven read handling with
PHiveActionException.