xrootd
XrdClZipArchive.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
3 // Author: Michal Simon <michal.simon@cern.ch>
4 //------------------------------------------------------------------------------
5 // This file is part of the XRootD software suite.
6 //
7 // XRootD is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // XRootD is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // In applying this licence, CERN does not waive the privileges and immunities
21 // granted to it by virtue of its status as an Intergovernmental Organization
22 // or submit itself to any jurisdiction.
23 //------------------------------------------------------------------------------
24 
25 #ifndef SRC_XRDZIP_XRDZIPARCHIVE_HH_
26 #define SRC_XRDZIP_XRDZIPARCHIVE_HH_
27 
28 #include "XrdCl/XrdClFile.hh"
30 #include "XrdCl/XrdClJobManager.hh"
31 #include "XrdCl/XrdClDefaultEnv.hh"
32 #include "XrdCl/XrdClPostMaster.hh"
33 #include "XrdZip/XrdZipEOCD.hh"
34 #include "XrdZip/XrdZipCDFH.hh"
36 #include "XrdZip/XrdZipLFH.hh"
37 #include "XrdCl/XrdClZipCache.hh"
38 
39 #include <memory>
40 #include <unordered_map>
41 
42 //-----------------------------------------------------------------------------
43 // Forward declaration needed for friendship
44 //-----------------------------------------------------------------------------
45 namespace XrdEc{ class StrmWriter; class Reader; template<bool> class OpenOnlyImpl; };
46 class MicroTest;
47 
48 namespace XrdCl
49 {
50  using namespace XrdZip;
51 
52  //---------------------------------------------------------------------------
53  // ZipArchive provides following functionalities:
54  // - parsing of existing ZIP archive
55  // - reading data from existing ZIP archive
56  // - appending data to existing ZIP archive
57  // - querying stat info and checksum for given file in ZIP archive
58  //---------------------------------------------------------------------------
59  class ZipArchive
60  {
61  friend class XrdEc::StrmWriter;
62  friend class XrdEc::Reader;
63  template<bool>
64  friend class XrdEc::OpenOnlyImpl;
65  friend class ::MicroTest;
66 
67  template<typename RSP>
68  friend XRootDStatus ReadFromImpl( ZipArchive&, const std::string&, uint64_t, uint32_t, void*, ResponseHandler*, uint16_t );
69 
70  public:
71  //-----------------------------------------------------------------------
73  //-----------------------------------------------------------------------
74  ZipArchive( bool enablePlugIns = true );
75 
76  //-----------------------------------------------------------------------
78  //-----------------------------------------------------------------------
79  virtual ~ZipArchive();
80 
81  //-----------------------------------------------------------------------
89  //-----------------------------------------------------------------------
90  XRootDStatus OpenArchive( const std::string &url,
91  OpenFlags::Flags flags,
92  ResponseHandler *handler,
93  uint16_t timeout = 0 );
94 
95  //-----------------------------------------------------------------------
103  //-----------------------------------------------------------------------
104  XRootDStatus OpenFile( const std::string &fn,
106  uint64_t size = 0,
107  uint32_t crc32 = 0 );
108 
109  //-----------------------------------------------------------------------
118  //-----------------------------------------------------------------------
119  inline
120  XRootDStatus Read( uint64_t offset,
121  uint32_t size,
122  void *buffer,
123  ResponseHandler *handler,
124  uint16_t timeout = 0 )
125  {
126  if( openfn.empty() ) return XRootDStatus( stError, errInvalidOp );
127  return ReadFrom( openfn, offset, size, buffer, handler, timeout );
128  }
129 
130  //-----------------------------------------------------------------------
139  //-----------------------------------------------------------------------
140  inline
141  XRootDStatus PgRead( uint64_t offset,
142  uint32_t size,
143  void *buffer,
144  ResponseHandler *handler,
145  uint16_t timeout = 0 )
146  {
147  if( openfn.empty() ) return XRootDStatus( stError, errInvalidOp );
148  return PgReadFrom( openfn, offset, size, buffer, handler, timeout );
149  }
150 
151  //-----------------------------------------------------------------------
161  //-----------------------------------------------------------------------
162  XRootDStatus ReadFrom( const std::string &fn,
163  uint64_t offset,
164  uint32_t size,
165  void *buffer,
166  ResponseHandler *handler,
167  uint16_t timeout = 0 );
168 
169  //-----------------------------------------------------------------------
179  //-----------------------------------------------------------------------
180  XRootDStatus PgReadFrom( const std::string &fn,
181  uint64_t offset,
182  uint32_t size,
183  void *buffer,
184  ResponseHandler *handler,
185  uint16_t timeout = 0 );
186 
187  //-----------------------------------------------------------------------
195  //-----------------------------------------------------------------------
196  inline XRootDStatus Write( uint32_t size,
197  const void *buffer,
198  ResponseHandler *handler,
199  uint16_t timeout = 0 )
200  {
201  if( openstage != Done || openfn.empty() )
202  return XRootDStatus( stError, errInvalidOp, 0, "Archive not opened." );
203 
204  return WriteImpl( size, buffer, handler, timeout );
205  }
206 
207  //-----------------------------------------------------------------------
212  //-----------------------------------------------------------------------
213  XRootDStatus UpdateMetadata( uint32_t crc32 );
214 
215  //-----------------------------------------------------------------------
225  //-----------------------------------------------------------------------
226  XRootDStatus AppendFile( const std::string &fn,
227  uint32_t crc32,
228  uint32_t size,
229  const void *buffer,
230  ResponseHandler *handler,
231  uint16_t timeout = 0 );
232 
233  //-----------------------------------------------------------------------
239  //-----------------------------------------------------------------------
240  inline XRootDStatus Stat( const std::string &fn, StatInfo *&info )
241  { // make sure archive has been opened and CD has been parsed
242  if( openstage != Done )
243  return XRootDStatus( stError, errInvalidOp );
244  // make sure the file is part of the archive
245  auto cditr = cdmap.find( fn );
246  if( cditr == cdmap.end() )
247  return XRootDStatus( stError, errNotFound );
248  // create the result
249  info = make_stat( fn );
250  if (info)
251  return XRootDStatus();
252  else // have difficult to access the openned archive.
253  return XRootDStatus( stError, errNotFound );
254  }
255 
256  //-----------------------------------------------------------------------
261  //-----------------------------------------------------------------------
262  inline XRootDStatus Stat( StatInfo *&info )
263  {
264  if( openfn.empty() )
265  return XRootDStatus( stError, errInvalidOp );
266  return Stat( openfn, info );
267  }
268 
269  //-----------------------------------------------------------------------
275  //-----------------------------------------------------------------------
276  inline XRootDStatus GetCRC32( const std::string &fn, uint32_t &cksum )
277  { // make sure archive has been opened and CD has been parsed
278  if( openstage != Done )
279  return XRootDStatus( stError, errInvalidOp );
280  // make sure the file is part of the archive
281  auto cditr = cdmap.find( fn );
282  if( cditr == cdmap.end() )
283  return XRootDStatus( stError, errNotFound );
284  cksum = cdvec[cditr->second]->ZCRC32;
285  return XRootDStatus();
286  }
287 
288  inline XRootDStatus GetOffset( const std::string &fn, uint64_t &offset){
289  if( openstage != XrdCl::ZipArchive::Done || !archive.IsOpen() )
291 
292  auto cditr = cdmap.find( fn );
293  if( cditr == cdmap.end() )
295  XrdCl::errNotFound, "File not found." );
296 
297  XrdCl::CDFH *cdfh = cdvec[cditr->second].get();
298 
299  // check if the file is compressed, for now we only support uncompressed and inflate/deflate compression
300  if( cdfh->compressionMethod != 0 && cdfh->compressionMethod != Z_DEFLATED )
302  0, "The compression algorithm is not supported!" );
303 
304  // Now the problem is that at the beginning of our
305  // file there is the Local-file-header, which size
306  // is not known because of the variable size 'extra'
307  // field, so we need to know the offset of the next
308  // record and shift it by the file size.
309  // The next record is either the next LFH (next file)
310  // or the start of the Central-directory.
311  uint64_t cdOffset = zip64eocd ? zip64eocd->cdOffset : eocd->cdOffset;
312  uint64_t nextRecordOffset = ( cditr->second + 1 < cdvec.size() ) ?
313  XrdCl::CDFH::GetOffset( *cdvec[cditr->second + 1] ) : cdOffset;
314  uint64_t filesize = cdfh->compressedSize;
315  if( filesize == std::numeric_limits<uint32_t>::max() && cdfh->extra )
316  filesize = cdfh->extra->compressedSize;
317  uint16_t descsize = cdfh->HasDataDescriptor() ?
319  offset = nextRecordOffset - filesize - descsize;
320  return XrdCl::XRootDStatus();
321  }
322 
323  //-----------------------------------------------------------------------
325  //
329  //-----------------------------------------------------------------------
331  uint16_t timeout = 0 );
332 
333  //-----------------------------------------------------------------------
336  //-----------------------------------------------------------------------
338  {
339  if( openstage != Done || openfn.empty() )
341  0, "Archive not opened." );
342  openfn.clear();
343  lfh.reset();
344  return XRootDStatus();
345  }
346 
347  //-----------------------------------------------------------------------
350  //-----------------------------------------------------------------------
352 
353  //-----------------------------------------------------------------------
355  //-----------------------------------------------------------------------
356  inline bool IsOpen()
357  {
358  return openstage == Done;
359  }
360 
361  //------------------------------------------------------------------------
363  //------------------------------------------------------------------------
364  inline bool IsSecure()
365  {
366  return archive.IsSecure();
367  }
368 
369  //-----------------------------------------------------------------------
371  //-----------------------------------------------------------------------
372  inline bool SetProperty( const std::string &name, const std::string &value )
373  {
374  return archive.SetProperty( name, value );
375  }
376 
377  //-----------------------------------------------------------------------
379  //-----------------------------------------------------------------------
380  inline bool GetProperty( const std::string &name, std::string &value )
381  {
382  return archive.GetProperty( name, value );
383  }
384 
385  //-----------------------------------------------------------------------
387  //-----------------------------------------------------------------------
388  inline File& GetFile()
389  {
390  return archive;
391  }
392 
393  private:
394 
395  //-----------------------------------------------------------------------
403  //-----------------------------------------------------------------------
404  XRootDStatus WriteImpl( uint32_t size,
405  const void *buffer,
406  ResponseHandler *handler,
407  uint16_t timeout );
408 
409  //-----------------------------------------------------------------------
417  //-----------------------------------------------------------------------
418  XRootDStatus OpenOnly( const std::string &url,
419  bool update,
420  ResponseHandler *handler,
421  uint16_t timeout = 0 );
422 
423  //-----------------------------------------------------------------------
427  //-----------------------------------------------------------------------
429 
430  //-----------------------------------------------------------------------
434  //-----------------------------------------------------------------------
435  void SetCD( const buffer_t &buffer );
436 
437  //-----------------------------------------------------------------------
442  //-----------------------------------------------------------------------
443  template<typename Response>
444  inline static AnyObject* PkgRsp( Response *rsp )
445  {
446  if( !rsp ) return nullptr;
447  AnyObject *pkg = new AnyObject();
448  pkg->Set( rsp );
449  return pkg;
450  }
451 
452  //-----------------------------------------------------------------------
454  //-----------------------------------------------------------------------
455  template<typename Response>
456  inline static void Free( XRootDStatus *st, Response *rsp )
457  {
458  delete st;
459  delete rsp;
460  }
461 
462  //-----------------------------------------------------------------------
469  //-----------------------------------------------------------------------
470  template<typename Response>
471  inline static void Schedule( ResponseHandler *handler, XRootDStatus *st, Response *rsp = nullptr )
472  {
473  if( !handler ) return Free( st, rsp );
474  ResponseJob *job = new ResponseJob( handler, st, PkgRsp( rsp ), 0 );
476  }
477 
478  //-----------------------------------------------------------------------
484  //-----------------------------------------------------------------------
485  inline static StatInfo* make_stat( const StatInfo &starch, uint64_t size )
486  {
487  StatInfo *info = new StatInfo( starch );
488  uint32_t flags = info->GetFlags();
489  info->SetFlags( flags & ( ~StatInfo::IsWritable ) ); // make sure it is not listed as writable
490  info->SetSize( size );
491  return info;
492  }
493 
494  //-----------------------------------------------------------------------
499  //-----------------------------------------------------------------------
500  inline StatInfo* make_stat( const std::string &fn )
501  {
502  StatInfo *infoptr = 0;
503  XRootDStatus st = archive.Stat( false, infoptr );
504  if (!st.IsOK()) return nullptr;
505  std::unique_ptr<StatInfo> stinfo( infoptr );
506  auto itr = cdmap.find( fn );
507  if( itr == cdmap.end() ) return nullptr;
508  size_t index = itr->second;
509  uint64_t uncompressedSize = cdvec[index]->uncompressedSize;
510  if( cdvec[index]->extra && uncompressedSize == std::numeric_limits<uint32_t>::max() )
511  uncompressedSize = cdvec[index]->extra->uncompressedSize;
512  return make_stat( *stinfo, uncompressedSize );
513  }
514 
515  //-----------------------------------------------------------------------
517  //-----------------------------------------------------------------------
518  inline static XRootDStatus* make_status( const XRootDStatus &status = XRootDStatus() )
519  {
520  return new XRootDStatus( status );
521  }
522 
523  //-----------------------------------------------------------------------
525  //-----------------------------------------------------------------------
526  inline void Clear()
527  {
528  buffer.reset();
529  eocd.reset();
530  cdvec.clear();
531  cdmap.clear();
532  zip64eocd.reset();
533  openstage = None;
534  }
535 
536  //-----------------------------------------------------------------------
538  //-----------------------------------------------------------------------
540  {
541  None = 0, //< opening/parsing not started
542  HaveEocdBlk, //< we have the End of Central Directory record
543  HaveZip64EocdlBlk, //< we have the ZIP64 End of Central Directory locator record
544  HaveZip64EocdBlk, //< we have the ZIP64 End of Central Directory record
545  HaveCdRecords, //< we have Central Directory records
546  Done, //< we are done parsing the Central Directory
547  Error, //< opening/parsing failed
548  NotParsed //< the ZIP archive has been opened but Central Directory is not parsed
549  };
550 
551  //-----------------------------------------------------------------------
553  //-----------------------------------------------------------------------
554  struct NewFile
555  {
556  NewFile( uint64_t offset, std::unique_ptr<LFH> lfh ) : offset( offset ),
557  lfh( std::move( lfh ) ),
558  overwrt( false )
559  {
560  }
561 
562  NewFile( NewFile && nf ) : offset( nf.offset ),
563  lfh( std::move( nf.lfh ) ),
564  overwrt( nf.overwrt )
565  {
566  }
567 
568  uint64_t offset; // the offset of the LFH of the file
569  std::unique_ptr<LFH> lfh; // LFH of the file
570  bool overwrt; // if true the LFH needs to be overwritten on close
571  };
572 
573  //-----------------------------------------------------------------------
575  //-----------------------------------------------------------------------
576  typedef std::unordered_map<std::string, ZipCache> zipcache_t;
577  typedef std::unordered_map<std::string, NewFile> new_files_t;
578 
579  File archive; //> File object for handling the ZIP archive
580  uint64_t archsize; //> size of the ZIP archive
581  bool cdexists; //> true if Central Directory exists, false otherwise
582  bool updated; //> true if the ZIP archive has been updated, false otherwise
583  std::unique_ptr<char[]> buffer; //> buffer for keeping the data to be parsed or raw data
584  std::unique_ptr<EOCD> eocd; //> End of Central Directory record
585  cdvec_t cdvec; //> vector of Central Directory File Headers
586  cdmap_t cdmap; //> mapping of file name to CDFH index
587  uint64_t cdoff; //> Central Directory offset
588  uint32_t orgcdsz; //> original CD size
589  uint32_t orgcdcnt; //> original number CDFH records
590  buffer_t orgcdbuf; //> buffer with the original CDFH records
591  std::unique_ptr<ZIP64_EOCD> zip64eocd; //> ZIP64 End of Central Directory record
592  OpenStages openstage; //> stage of opening / parsing a ZIP archive
593  std::string openfn; //> file name of opened file
594  zipcache_t zipcache; //> cache for inflating compressed data
595  std::unique_ptr<LFH> lfh; //> Local File Header record for the newly appended file
596  bool ckpinit; //> a flag indicating whether a checkpoint has been initialized
597  new_files_t newfiles; //> all newly appended files
598  };
599 
600 } /* namespace XrdZip */
601 
602 #endif /* SRC_XRDZIP_XRDZIPARCHIVE_HH_ */
Definition: XrdClAnyObject.hh:33
void Set(Type object, bool own=true)
Definition: XrdClAnyObject.hh:59
static PostMaster * GetPostMaster()
Get default post master.
Directory list.
Definition: XrdClXRootDResponses.hh:650
A file.
Definition: XrdClFile.hh:46
void QueueJob(Job *job, void *arg=0)
Add a job to be run.
Definition: XrdClJobManager.hh:92
JobManager * GetJobManager()
Get the job manager object user by the post master.
Handle an async response.
Definition: XrdClXRootDResponses.hh:1126
Call the user callback.
Definition: XrdClResponseJob.hh:31
Object stat info.
Definition: XrdClXRootDResponses.hh:400
@ IsWritable
Write access is allowed.
Definition: XrdClXRootDResponses.hh:414
uint32_t GetFlags() const
Get flags.
void SetSize(uint64_t size)
Set size.
void SetFlags(uint32_t flags)
Set flags.
Write operation (.
Definition: XrdClFileOperations.hh:546
Request status.
Definition: XrdClXRootDResponses.hh:219
Definition: XrdClZipArchive.hh:60
OpenStages
Stages of opening and parsing a ZIP archive.
Definition: XrdClZipArchive.hh:540
@ HaveCdRecords
Definition: XrdClZipArchive.hh:545
@ HaveZip64EocdlBlk
Definition: XrdClZipArchive.hh:543
@ Done
Definition: XrdClZipArchive.hh:546
@ HaveEocdBlk
Definition: XrdClZipArchive.hh:542
@ HaveZip64EocdBlk
Definition: XrdClZipArchive.hh:544
@ Error
Definition: XrdClZipArchive.hh:547
File & GetFile()
Get the underlying File object.
Definition: XrdClZipArchive.hh:388
XRootDStatus ReadFrom(const std::string &fn, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
buffer_t orgcdbuf
Definition: XrdClZipArchive.hh:590
XRootDStatus PgRead(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
Definition: XrdClZipArchive.hh:141
bool IsSecure()
Check if the underlying file is using an encrypted connection.
Definition: XrdClZipArchive.hh:364
bool cdexists
Definition: XrdClZipArchive.hh:581
static XRootDStatus * make_status(const XRootDStatus &status=XRootDStatus())
Allocate new XRootDStatus object.
Definition: XrdClZipArchive.hh:518
XRootDStatus Stat(const std::string &fn, StatInfo *&info)
Definition: XrdClZipArchive.hh:240
XRootDStatus Write(uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
Definition: XrdClZipArchive.hh:196
XRootDStatus UpdateMetadata(uint32_t crc32)
uint64_t archsize
Definition: XrdClZipArchive.hh:580
bool GetProperty(const std::string &name, std::string &value)
Get property on the underlying File object.
Definition: XrdClZipArchive.hh:380
XRootDStatus WriteImpl(uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout)
static void Schedule(ResponseHandler *handler, XRootDStatus *st, Response *rsp=nullptr)
Definition: XrdClZipArchive.hh:471
std::unique_ptr< char[]> buffer
Definition: XrdClZipArchive.hh:583
static AnyObject * PkgRsp(Response *rsp)
Definition: XrdClZipArchive.hh:444
XRootDStatus OpenArchive(const std::string &url, OpenFlags::Flags flags, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus OpenOnly(const std::string &url, bool update, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus List(DirectoryList *&list)
bool ckpinit
Definition: XrdClZipArchive.hh:596
XRootDStatus AppendFile(const std::string &fn, uint32_t crc32, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
bool SetProperty(const std::string &name, const std::string &value)
Set property on the underlying File object.
Definition: XrdClZipArchive.hh:372
new_files_t newfiles
Definition: XrdClZipArchive.hh:597
std::unique_ptr< LFH > lfh
Definition: XrdClZipArchive.hh:595
XRootDStatus Stat(StatInfo *&info)
Definition: XrdClZipArchive.hh:262
void Clear()
Clear internal ZipArchive objects.
Definition: XrdClZipArchive.hh:526
cdvec_t cdvec
Definition: XrdClZipArchive.hh:585
uint32_t orgcdsz
Definition: XrdClZipArchive.hh:588
StatInfo * make_stat(const std::string &fn)
Definition: XrdClZipArchive.hh:500
OpenStages openstage
Definition: XrdClZipArchive.hh:592
zipcache_t zipcache
Definition: XrdClZipArchive.hh:594
XRootDStatus CloseArchive(ResponseHandler *handler, uint16_t timeout=0)
Create the central directory at the end of ZIP archive and close it.
std::unique_ptr< EOCD > eocd
Definition: XrdClZipArchive.hh:584
std::unordered_map< std::string, NewFile > new_files_t
Definition: XrdClZipArchive.hh:577
bool IsOpen()
Definition: XrdClZipArchive.hh:356
XRootDStatus GetOffset(const std::string &fn, uint64_t &offset)
Definition: XrdClZipArchive.hh:288
static StatInfo * make_stat(const StatInfo &starch, uint64_t size)
Definition: XrdClZipArchive.hh:485
XRootDStatus PgReadFrom(const std::string &fn, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
virtual ~ZipArchive()
Destructor.
XRootDStatus CloseFile()
Definition: XrdClZipArchive.hh:337
File archive
Definition: XrdClZipArchive.hh:579
friend XRootDStatus ReadFromImpl(ZipArchive &, const std::string &, uint64_t, uint32_t, void *, ResponseHandler *, uint16_t)
uint32_t orgcdcnt
Definition: XrdClZipArchive.hh:589
std::unique_ptr< ZIP64_EOCD > zip64eocd
Definition: XrdClZipArchive.hh:591
std::unordered_map< std::string, ZipCache > zipcache_t
Type that maps file name to its cache.
Definition: XrdClZipArchive.hh:576
bool updated
Definition: XrdClZipArchive.hh:582
XRootDStatus GetCRC32(const std::string &fn, uint32_t &cksum)
Definition: XrdClZipArchive.hh:276
ZipArchive(bool enablePlugIns=true)
Constructor.
buffer_t GetCD()
cdmap_t cdmap
Definition: XrdClZipArchive.hh:586
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)
Definition: XrdClZipArchive.hh:120
std::string openfn
Definition: XrdClZipArchive.hh:593
uint64_t cdoff
Definition: XrdClZipArchive.hh:587
static void Free(XRootDStatus *st, Response *rsp)
Free status and response.
Definition: XrdClZipArchive.hh:456
void SetCD(const buffer_t &buffer)
Definition: XrdClZipArchive.hh:45
Definition: XrdEcReader.hh:58
Definition: XrdEcStrmWriter.hh:53
Definition: XrdClAction.hh:34
StatImpl< false > Stat(Ctx< File > file, Arg< bool > force, uint16_t timeout=0)
Definition: XrdClFileOperations.hh:535
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
const uint16_t errNotFound
Definition: XrdClStatus.hh:100
ZipReadFromImpl< false > ReadFrom(Ctx< ZipArchive > zip, Arg< std::string > fn, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< void * > buffer, uint16_t timeout=0)
Factory for creating ArchiveReadImpl objects.
Definition: XrdClZipOperations.hh:302
const uint16_t errInvalidOp
Definition: XrdClStatus.hh:51
const uint16_t errNotSupported
Definition: XrdClStatus.hh:62
Definition: XrdClZipArchive.hh:45
Definition: XrdZipCDFH.hh:40
std::vector< std::unique_ptr< CDFH > > cdvec_t
Definition: XrdZipCDFH.hh:44
std::vector< char > buffer_t
Definition: XrdZipUtils.hh:54
std::unordered_map< std::string, size_t > cdmap_t
Definition: XrdZipCDFH.hh:54
Definition: XrdOucJson.hh:4517
none object for initializing empty Optional
Definition: XrdClOptional.hh:35
Flags
Open flags, may be or'd when appropriate.
Definition: XrdClFileSystem.hh:76
@ None
Nothing.
Definition: XrdClFileSystem.hh:77
bool IsOK() const
We're fine.
Definition: XrdClStatus.hh:124
LFH of a newly appended file (in case it needs to be overwritten)
Definition: XrdClZipArchive.hh:555
uint64_t offset
Definition: XrdClZipArchive.hh:568
bool overwrt
Definition: XrdClZipArchive.hh:570
NewFile(NewFile &&nf)
Definition: XrdClZipArchive.hh:562
std::unique_ptr< LFH > lfh
Definition: XrdClZipArchive.hh:569
NewFile(uint64_t offset, std::unique_ptr< LFH > lfh)
Definition: XrdClZipArchive.hh:556
Definition: XrdZipCDFH.hh:65
static uint64_t GetOffset(const CDFH &cdfh)
Definition: XrdZipCDFH.hh:225
std::unique_ptr< Extra > extra
Definition: XrdZipCDFH.hh:343
uint16_t compressionMethod
Definition: XrdZipCDFH.hh:330
bool HasDataDescriptor()
Definition: XrdZipCDFH.hh:322
uint32_t compressedSize
Definition: XrdZipCDFH.hh:333
bool IsZIP64() const
Definition: XrdZipCDFH.hh:314
static uint8_t GetSize(bool zip64)
Definition: XrdZipDataDescriptor.hh:35