InventoryDB (uptane/services/inventorydb.py) is a simple module in the reference implementation that stores information about vehicles and ECUs. The only module in the reference implementation that should interact with inventorydb is director (uptane/services/director.py).
What it currently does is to store simple JSON files containing the manifest data. The way it does this feels inappropriate for the reference implementation. Everything in the reference implementation should be clear and modular, easy to understand, easy to replace.
As such, I think that the best way to write inventorydb for the reference implementation is probably to just store things in a single dictionary in memory and have a call to write it to disk when needed. That way, it's very simple and it can be obvious how to replace it with something appropriate for the implementer.
Something like:
{
'vehicle manifests':
{
'vehicle_id_1': [ <full vehicle manifests, in order of receipt> ],
'vehicle_id_2': [ <full vehicle manifests, in order of receipt> ],
...
},
'public_keys':
{
'vehicle_primaries':
{
'vehicle_id_1': {ecu_id: 'primary_ecu_id', public_key: <publickey for primary ecu> },
'vehicle_id_2': {ecu_id: 'primary_ecu_id', public_key: <publickey for primary ecu> },
...
}
'all_ecus':
{
'ecu_serial_2': <publickey>,
'ecu_serial_3': <publickey>,
...
}
}
}
Could also add something like this for convenience, but it's redundant, so I'll leave it out:
'attack_info': {'vehicle_id_1': { 'ecu_serial_2': [] }
InventoryDB (uptane/services/inventorydb.py) is a simple module in the reference implementation that stores information about vehicles and ECUs. The only module in the reference implementation that should interact with inventorydb is director (uptane/services/director.py).
What it currently does is to store simple JSON files containing the manifest data. The way it does this feels inappropriate for the reference implementation. Everything in the reference implementation should be clear and modular, easy to understand, easy to replace.
As such, I think that the best way to write inventorydb for the reference implementation is probably to just store things in a single dictionary in memory and have a call to write it to disk when needed. That way, it's very simple and it can be obvious how to replace it with something appropriate for the implementer.
Something like:
Could also add something like this for convenience, but it's redundant, so I'll leave it out: 'attack_info': {'vehicle_id_1': { 'ecu_serial_2': [] }