modules/inventory: use filtered serialization of inventory
Opens up inventory for partially non-serializable parts
This commit is contained in:
@@ -241,9 +241,9 @@ def test_caching_works(flake: ClanFlake) -> None:
|
|||||||
wraps=my_flake.get_from_nix,
|
wraps=my_flake.get_from_nix,
|
||||||
) as tracked_build:
|
) as tracked_build:
|
||||||
assert tracked_build.call_count == 0
|
assert tracked_build.call_count == 0
|
||||||
my_flake.select("clanInternals.inventoryClass.inventory.meta")
|
my_flake.select("clanInternals.inventoryClass.inventorySerialization.meta")
|
||||||
assert tracked_build.call_count == 1
|
assert tracked_build.call_count == 1
|
||||||
my_flake.select("clanInternals.inventoryClass.inventory.meta")
|
my_flake.select("clanInternals.inventoryClass.inventorySerialization.meta")
|
||||||
assert tracked_build.call_count == 1
|
assert tracked_build.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class InventoryStore:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def default_selectors(cls) -> list[str]:
|
def default_selectors(cls) -> list[str]:
|
||||||
return [
|
return [
|
||||||
f"clanInternals.inventoryClass.inventory.{key}"
|
f"clanInternals.inventoryClass.inventorySerialization.{key}"
|
||||||
for key in cls.default_keys()
|
for key in cls.default_keys()
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ class InventoryStore:
|
|||||||
"""Loads the evaluated inventory.
|
"""Loads the evaluated inventory.
|
||||||
After all merge operations with eventual nix code in buildClan.
|
After all merge operations with eventual nix code in buildClan.
|
||||||
|
|
||||||
Evaluates clanInternals.inventoryClass.inventory with nix. Which is performant.
|
Evaluates clanInternals.inventoryClass.inventorySerialization with nix. Which is performant.
|
||||||
|
|
||||||
- Contains all clan metadata
|
- Contains all clan metadata
|
||||||
- Contains all machines
|
- Contains all machines
|
||||||
@@ -164,7 +164,9 @@ class InventoryStore:
|
|||||||
|
|
||||||
def get_readonly_raw(self, keys: set[str]) -> Inventory:
|
def get_readonly_raw(self, keys: set[str]) -> Inventory:
|
||||||
attrs = "{" + ",".join(sorted(keys)) + "}"
|
attrs = "{" + ",".join(sorted(keys)) + "}"
|
||||||
return self._flake.select(f"clanInternals.inventoryClass.inventory.{attrs}")
|
return self._flake.select(
|
||||||
|
f"clanInternals.inventoryClass.inventorySerialization.{attrs}"
|
||||||
|
)
|
||||||
|
|
||||||
def _get_persisted(self) -> InventorySnapshot:
|
def _get_persisted(self) -> InventorySnapshot:
|
||||||
"""Load the inventory FILE from the flake directory
|
"""Load the inventory FILE from the flake directory
|
||||||
|
|||||||
Reference in New Issue
Block a user