|
xrootd
|
#include <XrdClZipArchive.hh>

Classes | |
| struct | NewFile |
| LFH of a newly appended file (in case it needs to be overwritten) More... | |
Public Member Functions | |
| ZipArchive (bool enablePlugIns=true) | |
| Constructor. More... | |
| virtual | ~ZipArchive () |
| Destructor. More... | |
| XRootDStatus | OpenArchive (const std::string &url, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | OpenFile (const std::string &fn, OpenFlags::Flags flags=OpenFlags::None, uint64_t size=0, uint32_t crc32=0) |
| XRootDStatus | Read (uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | PgRead (uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | ReadFrom (const std::string &fn, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | PgReadFrom (const std::string &fn, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Write (uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | UpdateMetadata (uint32_t crc32) |
| XRootDStatus | AppendFile (const std::string &fn, uint32_t crc32, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0) |
| XRootDStatus | Stat (const std::string &fn, StatInfo *&info) |
| XRootDStatus | Stat (StatInfo *&info) |
| XRootDStatus | GetCRC32 (const std::string &fn, uint32_t &cksum) |
| XRootDStatus | GetOffset (const std::string &fn, uint64_t &offset) |
| XRootDStatus | CloseArchive (ResponseHandler *handler, uint16_t timeout=0) |
| Create the central directory at the end of ZIP archive and close it. More... | |
| XRootDStatus | CloseFile () |
| XRootDStatus | List (DirectoryList *&list) |
| bool | IsOpen () |
| bool | IsSecure () |
| Check if the underlying file is using an encrypted connection. More... | |
| bool | SetProperty (const std::string &name, const std::string &value) |
| Set property on the underlying File object. More... | |
| bool | GetProperty (const std::string &name, std::string &value) |
| Get property on the underlying File object. More... | |
| File & | GetFile () |
| Get the underlying File object. More... | |
Private Types | |
| enum | OpenStages { None = 0, HaveEocdBlk, HaveZip64EocdlBlk, HaveZip64EocdBlk, HaveCdRecords, Done, Error, NotParsed } |
| Stages of opening and parsing a ZIP archive. More... | |
| typedef std::unordered_map < std::string, ZipCache > | zipcache_t |
| Type that maps file name to its cache. More... | |
| typedef std::unordered_map < std::string, NewFile > | new_files_t |
Private Member Functions | |
| XRootDStatus | WriteImpl (uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout) |
| XRootDStatus | OpenOnly (const std::string &url, bool update, ResponseHandler *handler, uint16_t timeout=0) |
| buffer_t | GetCD () |
| void | SetCD (const buffer_t &buffer) |
| StatInfo * | make_stat (const std::string &fn) |
| void | Clear () |
| Clear internal ZipArchive objects. More... | |
Static Private Member Functions | |
| template<typename Response > | |
| static AnyObject * | PkgRsp (Response *rsp) |
| template<typename Response > | |
| static void | Free (XRootDStatus *st, Response *rsp) |
| Free status and response. More... | |
| template<typename Response > | |
| static void | Schedule (ResponseHandler *handler, XRootDStatus *st, Response *rsp=nullptr) |
| static StatInfo * | make_stat (const StatInfo &starch, uint64_t size) |
| static XRootDStatus * | make_status (const XRootDStatus &status=XRootDStatus()) |
| Allocate new XRootDStatus object. More... | |
Private Attributes | |
| File | archive |
| uint64_t | archsize |
| bool | cdexists |
| bool | updated |
| std::unique_ptr< char[]> | buffer |
| std::unique_ptr< EOCD > | eocd |
| cdvec_t | cdvec |
| cdmap_t | cdmap |
| uint64_t | cdoff |
| uint32_t | orgcdsz |
| uint32_t | orgcdcnt |
| buffer_t | orgcdbuf |
| std::unique_ptr< ZIP64_EOCD > | zip64eocd |
| OpenStages | openstage |
| std::string | openfn |
| zipcache_t | zipcache |
| std::unique_ptr< LFH > | lfh |
| bool | ckpinit |
| new_files_t | newfiles |
Friends | |
| class | XrdEc::StrmWriter |
| class | XrdEc::Reader |
| template<bool > | |
| class | XrdEc::OpenOnlyImpl |
| class | ::MicroTest |
| class | ::XrdEcTests |
| template<typename RSP > | |
| XRootDStatus | ReadFromImpl (ZipArchive &, const std::string &, uint64_t, uint32_t, void *, ResponseHandler *, uint16_t) |
|
private |
|
private |
Type that maps file name to its cache.
|
private |
| XrdCl::ZipArchive::ZipArchive | ( | bool | enablePlugIns = true | ) |
Constructor.
|
virtual |
Destructor.
| XRootDStatus XrdCl::ZipArchive::AppendFile | ( | const std::string & | fn, |
| uint32_t | crc32, | ||
| uint32_t | size, | ||
| const void * | buffer, | ||
| ResponseHandler * | handler, | ||
| uint16_t | timeout = 0 |
||
| ) |
Create a new file in the ZIP archive and append the data
| fn | : the name of the new file to be created |
| crc32 | : the crc32 of the file |
| size | : the size of the file |
| buffer | : the buffer with the data |
| handler | : user callback |
| timeout | : operation timeout |
|
inlineprivate |
Clear internal ZipArchive objects.
| XRootDStatus XrdCl::ZipArchive::CloseArchive | ( | ResponseHandler * | handler, |
| uint16_t | timeout = 0 |
||
| ) |
Create the central directory at the end of ZIP archive and close it.
| handler | : user callback |
| timeout | : operation timeout |
|
inline |
Close an open file within the ZIP archive
References XrdCl::errInvalidOp, and XrdCl::stError.
|
inlinestaticprivate |
Free status and response.
|
private |
Get a buffer with central directory of the ZIP archive
|
inline |
Get crc32 for a given file
| fn | : file name |
| cksum | : output parameter |
References XrdCl::errInvalidOp, XrdCl::errNotFound, and XrdCl::stError.
|
inline |
References XrdZip::CDFH::compressedSize, XrdZip::CDFH::compressionMethod, Done, XrdCl::errInvalidOp, XrdCl::errNotFound, XrdCl::errNotSupported, XrdZip::CDFH::extra, XrdZip::CDFH::GetOffset(), XrdZip::DataDescriptor::GetSize(), XrdZip::CDFH::HasDataDescriptor(), XrdZip::CDFH::IsZIP64(), and XrdCl::stError.
|
inline |
Get property on the underlying File object.
|
inline |
|
inline |
Check if the underlying file is using an encrypted connection.
| XRootDStatus XrdCl::ZipArchive::List | ( | DirectoryList *& | list | ) |
List files in the ZIP archive
|
inlinestaticprivate |
Create a StatInfo object from ZIP archive stat info and the file size.
| starch | : ZIP archive stat info |
| size | : file size |
References XrdCl::StatInfo::GetFlags(), XrdCl::StatInfo::IsWritable, XrdCl::StatInfo::SetFlags(), and XrdCl::StatInfo::SetSize().
|
inlineprivate |
Create a StatInfo object for a given file within the ZIP archive.
| fn | : file name |
References XrdCl::Status::IsOK().
|
inlinestaticprivate |
Allocate new XRootDStatus object.
| XRootDStatus XrdCl::ZipArchive::OpenArchive | ( | const std::string & | url, |
| OpenFlags::Flags | flags, | ||
| ResponseHandler * | handler, | ||
| uint16_t | timeout = 0 |
||
| ) |
Open ZIP Archive (and parse the Central Directory)
| url | : the URL of the ZIP archive |
| flags | : open flags to be used when openning the file |
| handler | : user callback |
| timeout | : operation timeout |
| XRootDStatus XrdCl::ZipArchive::OpenFile | ( | const std::string & | fn, |
| OpenFlags::Flags | flags = OpenFlags::None, |
||
| uint64_t | size = 0, |
||
| uint32_t | crc32 = 0 |
||
| ) |
Open a file within the ZIP Archive
| fn | : file name to be opened |
| flags | : open flags (either 'Read' or 'New | Write') |
| size | : file size (to be included in the LFH) |
| crc32 | : file crc32 (to be included in the LFH) |
|
private |
Open the ZIP archive in read-only mode without parsing the central directory.
| url | : url of the ZIP archive |
| handler | : user callback |
| timeout | : operation timeout |
|
inline |
PgRead data from an open file
| offset | : offset within the file to read at |
| size | : number of bytes to be read |
| buffer | : the buffer for the data |
| handler | : user callback |
| timeout | : operation timeout |
References XrdCl::errInvalidOp, and XrdCl::stError.
| XRootDStatus XrdCl::ZipArchive::PgReadFrom | ( | const std::string & | fn, |
| uint64_t | offset, | ||
| uint32_t | size, | ||
| void * | buffer, | ||
| ResponseHandler * | handler, | ||
| uint16_t | timeout = 0 |
||
| ) |
PgRead data from a given file
| fn | : the name of the file from which we are going to read |
| offset | : offset within the file to read at |
| size | : number of bytes to be read |
| buffer | : the buffer for the data |
| handler | : user callback |
| timeout | : operation timeout |
|
inlinestaticprivate |
Package a response into AnyObject (erase the type)
| rsp | : the response to be packaged |
References XrdCl::AnyObject::Set().
|
inline |
Read data from an open file
| offset | : offset within the file to read at |
| size | : number of bytes to be read |
| buffer | : the buffer for the data |
| handler | : user callback |
| timeout | : operation timeout |
References XrdCl::errInvalidOp, XrdCl::ReadFrom(), and XrdCl::stError.
| XRootDStatus XrdCl::ZipArchive::ReadFrom | ( | const std::string & | fn, |
| uint64_t | offset, | ||
| uint32_t | size, | ||
| void * | buffer, | ||
| ResponseHandler * | handler, | ||
| uint16_t | timeout = 0 |
||
| ) |
Read data from a given file
| fn | : the name of the file from which we are going to read |
| offset | : offset within the file to read at |
| size | : number of bytes to be read |
| buffer | : the buffer for the data |
| handler | : user callback |
| timeout | : operation timeout |
|
inlinestaticprivate |
Schedule a user callback to be executed in the thread-pool with given status and response.
| handler | : user callback to be scheduled |
| st | : status to be passed to the callback |
| rsp | : response to be passed to the callback |
References XrdCl::PostMaster::GetJobManager(), XrdCl::DefaultEnv::GetPostMaster(), and XrdCl::JobManager::QueueJob().
|
private |
Set central directory for the ZIP archive
| buffer | : a buffer with the central directory to be set |
|
inline |
Set property on the underlying File object.
|
inline |
Get stat info for given file
| fn | : the name of the file |
| info | : output parameter |
References XrdCl::errInvalidOp, XrdCl::errNotFound, and XrdCl::stError.
|
inline |
Get stat info for an open file
| info | : output parameter |
References XrdCl::errInvalidOp, XrdCl::Stat(), and XrdCl::stError.
| XRootDStatus XrdCl::ZipArchive::UpdateMetadata | ( | uint32_t | crc32 | ) |
Update the metadata of the currently open file
| crc32 | : the crc32 checksum |
|
inline |
Append data to a new file
| size | : number of bytes to be appended |
| buffer | : the buffer with the data to be appended |
| handler | : user callback |
| timeout | : operation timeout |
References XrdCl::errInvalidOp, and XrdCl::stError.
|
private |
Append data to a new file, implementation
| size | : number of bytes to be appended |
| buffer | : the buffer with the data to be appended |
| handler | : user callback |
| timeout | : operation timeout |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.5