PolymerLabs / arcs

Arcs
BSD 3-Clause "New" or "Revised" License
56 stars 35 forks source link

Stops embedding entitySchemaHash in DatabaseStorageKey when flag is enabled. #7125

Closed copybara-service[bot] closed 3 years ago

copybara-service[bot] commented 3 years ago

Stops embedding entitySchemaHash in DatabaseStorageKey when flag is enabled.

This behaviour is controlled by the STORAGE_KEY_REDUCTION flag. When it is enabled, entity schema hashes will not be stored in DatabaseStorageKeys anymore. (The behaviour of reading the legacy format keys is preserved, because the code generator creates keys with that format and it's too hard to change the code generator with a build flag.)

This involved heavly refactoring the DatabaseStorageKey class. It now has 4 small data class implementations: LegacyPersistent, ShortPersistent, LegacyMemory and ShortMemory, for the combinations of persistent vs. in-memory and legacy vs. short. The legacy classes are used when the flag is disabled, the short classes when enabled.

The DatabaseDriverProvider was also slightly refactored.