diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-11 12:18:29 +0200 |
---|---|---|
committer | Sascha Roloff <sascha.roloff@huawei.com> | 2022-08-05 14:41:31 +0200 |
commit | c99e8ebc4dc12544ad55cd55e13b0bbe49b6cb4c (patch) | |
tree | c11e43ee6c9b2a2bce5e0dfcaaa3b0a3e19de07a /src/buildtool/file_system/git_cas.hpp | |
parent | a3064e549eb666c162c5bd333a17598355620d63 (diff) | |
download | justbuild-c99e8ebc4dc12544ad55cd55e13b0bbe49b6cb4c.tar.gz |
GitCAS: Support reading/creating trees without filesystem IO
Diffstat (limited to 'src/buildtool/file_system/git_cas.hpp')
-rw-r--r-- | src/buildtool/file_system/git_cas.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp index df077daf..98ebe8d9 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -87,6 +87,27 @@ class GitCAS { [[nodiscard]] auto CreateTree(GitCAS::tree_entries_t const& entries) const noexcept -> std::optional<std::string>; + /// \brief Read entries from tree data (without object db). + /// \param data The tree object as plain data. + /// \param id The object id. + /// \param is_hex_id Specify whether `id` is hex string or raw. + /// \returns The tree entries. + [[nodiscard]] static auto ReadTreeData(std::string const& data, + std::string const& id, + bool is_hex_id = false) noexcept + -> std::optional<tree_entries_t>; + + /// \brief Create a flat shallow (without objects in db) tree and return it. + /// Creates a tree object from the entries without access to the actual + /// blobs. Objects are not required to be available in the underlying object + /// database. It is sufficient to provide the raw object id and and object + /// type for every entry. + /// \param entries The entries to create the tree from. + /// \returns A pair of raw object id and the tree object content. + [[nodiscard]] static auto CreateShallowTree( + GitCAS::tree_entries_t const& entries) noexcept + -> std::optional<std::pair<std::string, std::string>>; + private: git_odb* odb_{nullptr}; bool initialized_{false}; |