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 ICECHUNKUTILS_H 14 : #define ICECHUNKUTILS_H 15 : 16 : #include "cpl_vsi_virtual.h" 17 : 18 : #include <memory> 19 : #include <string> 20 : #include <utility> 21 : #include <vector> 22 : 23 : namespace gdal::icechunk 24 : { 25 : #ifdef DEBUG 26 : constexpr bool IS_DEBUG_BUILD = true; 27 : #else 28 : constexpr bool IS_DEBUG_BUILD = false; 29 : #endif 30 : 31 : void VSIInstallIcechunkFileSystem(); 32 : void VSIIcechunkFileSystemClearCaches(); 33 : 34 : std::string GetFilenameFromDatasetName(const std::string &osDatasetName, 35 : std::string &osBranchName, 36 : std::string &osTagName); 37 : 38 : std::pair<std::unique_ptr<unsigned char, VSIFreeReleaser>, size_t> 39 : DecompressFile(const char *pszFilename, VSIVirtualHandle *poFile, 40 : int nExpectedFileType, int *pnVersion = nullptr); 41 : 42 : std::string CrockfordBase32Encode(const uint8_t *data, size_t size); 43 : 44 23838 : template <class T> static std::string CrockfordBase32Encode(const T &buffer) 45 : { 46 23838 : return CrockfordBase32Encode(buffer.data(), buffer.size()); 47 : } 48 : } // namespace gdal::icechunk 49 : 50 : #endif