LCOV - code coverage report
Current view: top level - frmts/icechunk - icechunkmanifest.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 3 3 100.0 %
Date: 2026-06-19 21:24:00 Functions: 4 4 100.0 %

          Line data    Source code
       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 ICECHUNKMANIFEST_H
      14             : #define ICECHUNKMANIFEST_H
      15             : 
      16             : #include "icechunkdefs.h"
      17             : #include "icechunkfile.h"
      18             : 
      19             : #include <map>
      20             : #include <string>
      21             : #include <memory>
      22             : #include <vector>
      23             : 
      24             : namespace gdal::icechunk
      25             : {
      26             : class IcechunkSnapshot;
      27             : 
      28             : /************************************************************************/
      29             : /*                           IcechunkManifest                           */
      30             : /************************************************************************/
      31             : 
      32             : /** Instance of https://icechunk.io/en/stable/reference/spec/#manifestfileinfo
      33             :  *
      34             :  * It is thread-safe.
      35             :  */
      36        6279 : class IcechunkManifest final : public IcechunkFile
      37             : {
      38             :   public:
      39             :     IcechunkManifest();
      40             :     ~IcechunkManifest() override;
      41             : 
      42             :     struct ChunkRef
      43             :     {
      44             :         ChunkIdx idx{};
      45             : 
      46             :         std::vector<uint8_t> inlineContent{};
      47             : 
      48             :         // offset and length only apply to chunkId or location not empty
      49             :         uint64_t offset = 0;
      50             :         uint64_t length = 0;
      51             : 
      52             :         // In-repository chunk
      53             :         std::string chunkId{};
      54             : 
      55             :         // Virtual reference
      56             :         std::string location{};
      57             : 
      58             : #ifdef DEBUG
      59             :         uint32_t checksumLastModified = 0;
      60             :         std::string checksumEtag{};
      61             : #endif
      62             :     };
      63             : 
      64             :     struct ArrayManifest
      65             :     {
      66             :         ObjectId8 nodeId{};
      67             : 
      68             :         // Sorted by increasing ChunkRef::idx
      69             :         std::vector<ChunkRef> chunkRefs{};
      70             :     };
      71             : 
      72             :     static std::unique_ptr<IcechunkManifest> Open(const char *pszFilename);
      73             : 
      74             :     const ChunkRef *GetChunkRef(const ObjectId8 &nodeId,
      75             :                                 const ChunkIdx &idx) const;
      76             : 
      77             :     std::string GetChunkFilename(const std::string &chunkId) const;
      78             : 
      79        2084 :     inline uint32_t GetChunkRefsCount() const
      80             :     {
      81        2084 :         return m_chunkRefsCount;
      82             :     }
      83             : 
      84             :   private:
      85             :     // Sorted by increasing ArrayManifest::nodeId
      86             :     std::vector<ArrayManifest> m_arrayManifests{};
      87             : 
      88             :     // count(m_arrayManifests[].chunkRefs[])
      89             :     uint32_t m_chunkRefsCount = 0;
      90             : };
      91             : 
      92             : }  // namespace gdal::icechunk
      93             : 
      94             : #endif

Generated by: LCOV version 1.14