Skip to content

Add clean-up support for archives and resources - #268

Merged
VeaaC merged 10 commits into
heremaps:masterfrom
ChaoJia:cleanup_support
Nov 25, 2026
Merged

VeaaC merged 10 commits into
heremaps:masterfrom
ChaoJia:cleanup_support

Conversation

@ChaoJia

@ChaoJia ChaoJia commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds the ability to remove an archive's resources and their .schema companions from a MemoryResourceStorage or FileResourceStorage (TarArchiveResourceStorage not supported), and to overwrite an existing archive on request. Implemented for flatdata-cpp and flatdata-rs. This allows us to reliably clean up the data written by an archive builder before rebuilding the archive.

  • Each individual resource can be removed by its dedicated cleanup function. An archive builder's cleanup function removes all the resources written by it and all of its sub-archives (essentially recursive call).

  • Cleanup can fail if only schema file or the data file exists, or the schema file doesn't match the expected schema, or filesystem calls for file removal fails. On cleanup failure, the cpp implementation returns false, and rust returns std::io::Error.

  • cpp:

    • Each resource gets a static bool clean_up_<name>(ResourceStorage&), and each archive builder gets bool clean_up(ResourceStorage&). clean_up for an archive builder also removes all the sub-archives.
    • open(storage, force_overwrite = false), set_* and start_* take force_overwrite. When it is set, existing data is cleaned up first by calling the clean_up functions.
  • rust:

    • Each resource gets a pub fn clean_up_<name>(&self) and a static version pub fn clean_up_<name>(storage: flatdata::StorageHandle). The static version is mainly used by the archive builder's pub fn clean_up(storage: flatdata::StorageHandle).

Comment thread flatdata-rs/lib/src/filestorage.rs Resolved
Comment thread flatdata-rs/lib/src/storage.rs Resolved
Comment thread flatdata-rs/lib/src/storage.rs Resolved
Comment thread flatdata-rs/lib/src/storage.rs Resolved
Comment thread flatdata-rs/lib/src/storage.rs Resolved
@VeaaC

VeaaC commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

You need to sign off the commits (see failed DCO checks)

Chao Jia and others added 9 commits November 25, 2026 09:58
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Co-authored-by: epavese <epavese@gmail.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
Signed-off-by: Chao Jia <chao.jia@here.com>
…dition

Signed-off-by: Chao Jia <chao.jia@here.com>
@ChaoJia ChaoJia changed the title cleanup support Add clean-up support for archives and resources Nov 25, 2026
@VeaaC
VeaaC merged commit 996ccbb into heremaps:master Nov 25, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants