Skip to content

Default revision to latest (highest number in directory) when querying database #308

Description

@kylecarow

It would be nice to default to the highest revision number in the directory

Example: skipping revision in the from_db call would scan this folder and return the vehicle at r2.yaml.

v1/fastsim-3/conv/ford/fusion/2012/base/
  r1.yaml
  r2.yaml

This would enable users to provide just v1/fastsim-3/conv/ford/fusion/2012 as a path, as variant and extension already have sensible defaults base and yaml

For example these paths would all be valid and return the same vehicle:

  • v1/fastsim-3/conv/ford/fusion/2012/base/r2.yaml
  • v1/fastsim-3/conv/ford/fusion/2012/base/r2
  • v1/fastsim-3/conv/ford/fusion/2012/base
  • v1/fastsim-3/conv/ford/fusion/2012

Currently only the first two of these work.

This would need to be done in Rust, as thats where 95% of the database loading stuff is done.

Notes:

  • Very easy to do with local paths
  • More finagling required for remote databases, getting the list of files in the dir, etc.
  • What value could Python (specifically the internals of from_db) provide to Rust to signal we should scan for latest?
    • change from supplying a u32 to a more flexible type?
    • just supply u32::MAX aka 4294967295, and check on the rust side when loading?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions