Coverage Report

Created: 2026-09-26 08:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/frmts/icechunk/icechunkrepo.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  Icechunk driver
5
 * Author:   Even Rouault <even dot rouault at spatialys.com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2026, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef ICECHUNKREPO_H
14
#define ICECHUNKREPO_H
15
16
#include <string>
17
#include <memory>
18
19
#include "icechunkfile.h"
20
#include "cpl_vsi_virtual.h"
21
22
namespace gdal::icechunk
23
{
24
class IcechunkSnapshot;
25
class IcechunkManifest;
26
27
/************************************************************************/
28
/*                             IcechunkRepo                             */
29
/************************************************************************/
30
31
/** Instance of https://icechunk.io/en/stable/reference/spec/#repo-info-file
32
 *
33
 * It is thread-safe.
34
 */
35
class IcechunkRepo final : public IcechunkFile
36
{
37
  public:
38
    IcechunkRepo();
39
    ~IcechunkRepo() override;
40
41
    static std::unique_ptr<IcechunkRepo> Open(const char *pszFilename,
42
                                              VSIVirtualHandle *fp = nullptr);
43
44
    std::unique_ptr<IcechunkSnapshot>
45
    OpenSnapshotOnBranch(const std::string &id,
46
                         bool emitErrorIfUnknownBranch = true) const;
47
48
    std::unique_ptr<IcechunkSnapshot>
49
    OpenSnapshotOnTag(const std::string &id,
50
                      bool emitErrorIfUnknownTag = true) const;
51
52
    std::shared_ptr<IcechunkManifest>
53
    OpenManifest(const std::string &manifestId, uint64_t nExpectedFileSize,
54
                 uint32_t nExpectedChunkRefs) const;
55
56
    const std::map<std::string, std::string> &GetTags() const
57
0
    {
58
0
        return m_oMapTagNameToSnapshotId;
59
0
    }
60
61
    const std::map<std::string, std::string> &GetBranches() const
62
0
    {
63
0
        return m_oMapBranchNameToSnapshotId;
64
0
    }
65
66
    static void ClearCaches();
67
68
  private:
69
    std::string m_osRootPath{};
70
    std::map<std::string, std::string> m_oMapTagNameToSnapshotId{};
71
    std::map<std::string, std::string> m_oMapBranchNameToSnapshotId{};
72
73
    static std::unique_ptr<IcechunkRepo> OpenV1(const char *pszRootPath);
74
};
75
76
}  // namespace gdal::icechunk
77
78
#endif