TABLE
TABLE = 'strata_dict'
The table versions are indexed in.
Keeps every dictionary version any live frame might need.
A dictionary is the one object in the store whose loss is unrecoverable by any other means. A frame compressed against one cannot be opened without it - not partially, not approximately - so a dictionary is never overwritten, never pruned while referenced, and replicated with the frames that name it.
Retraining therefore adds a version rather than replacing one. New frames use the new version, old frames keep naming the old one, and both stay until nothing references them.
The local table is an index over what the bucket already holds, so an uninstall that drops it loses
nothing: strata:reindex reads the dictionary objects back.
$refs : array
References already read, keyed by id.
$provider : \Drupal\strata\Storage\StorageProviderInterface
__construct(\Drupal\strata\Storage\StorageProviderInterface $provider, \Drupal\Core\Database\Connection $database) : mixed
Constructs a store.
| \Drupal\strata\Storage\StorageProviderInterface | $provider | Where dictionary objects live. |
| \Drupal\Core\Database\Connection | $database | The connection holding the index. |
store(string $realm, string $bytes, string $source = \Drupal\strata\Codec\Dictionary\DictionaryRef::RAW, float $ratio = 1.0, int $samples = 0) : \Drupal\strata\Codec\Dictionary\DictionaryRef
Stores a newly trained dictionary as the next version of its realm.
| string | $realm | Realm value. |
| string | $bytes | The dictionary. |
| string | $source | Either DictionaryRef::RAW or DictionaryRef::TRAINED. |
| float | $ratio | The ratio it measured on the samples it was scored against. |
| int | $samples | How many samples it was built from. |
When the dictionary is empty or cannot be written.
The stored reference.
get(string $id) : string|null
The bytes of one dictionary version.
| string | $id | The id a frame recorded. |
When the object is indexed but absent, or its bytes do not hash to the recorded address. A dictionary that decodes to something else would open every frame that names it into garbage, so this refuses rather than returning it.
The dictionary, or NULL when the id names nothing this store holds.
latest(string $realm) : \Drupal\strata\Codec\Dictionary\DictionaryRef|null
The newest version for a realm.
What a flush and a compaction pass compress against.
| string | $realm | Realm value. |
The reference, or NULL when the realm has no dictionary yet.
forget(string $id) : bool
Removes one version from the index and the store.
Only ever called with a version a reachability walk has proved nothing references. There is no safe way to check that here, which is why this takes no decision of its own.
| string | $id | The id. |
TRUE when a row was removed.