IsolatedCompactionStrategy class sealed

A sendable description of a CompactionStrategy

A CompactionStrategy is a function, and functions cannot be reliably sent across an isolate boundary. Compaction also runs lazily inside the long lived Hive isolate, potentially after the isolate that opened the box has exited, so the strategy must be reconstructable entirely within the Hive isolate.

Instead of passing a function, IsolatedHive accepts one of these sendable descriptions and rebuilds the real CompactionStrategy on the isolate side via resolve.

Annotations

Constructors

IsolatedCompactionStrategy.always()
Always compacts the box
const
factory
IsolatedCompactionStrategy.never()
Never compacts the box
const
factory
IsolatedCompactionStrategy.threshold({required int deletedThreshold, required double deletedRatio})
Compacts the box once more than deletedThreshold entries have been deleted and the ratio of deleted entries to total entries exceeds deletedRatio
const
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited