8 #ifndef SRC_XRDCL_XRDCLZIPOPERATIONS_HH_
9 #define SRC_XRDCL_XRDCLZIPOPERATIONS_HH_
26 template<
template<
bool>
class Derived,
bool HasHndl,
typename Response,
typename ... Arguments>
30 template<
template<
bool>
class, bool,
typename,
typename ...>
friend class ZipOperation;
76 template<
bool HasHndl>
91 enum { UrlArg, FlagsArg };
112 std::string &url = std::get<UrlArg>( this->args ).Get();
114 uint16_t timeout = pipelineTimeout < this->timeout ?
115 pipelineTimeout : this->timeout;
116 return this->zip->OpenArchive( url, flags, handler, timeout );
127 std::move( flags ) ).
Timeout( timeout );
134 template<
bool HasHndl>
136 Arg<std::string>, Arg<OpenFlags::Flags>, Arg<uint64_t>, Arg<uint32_t>>
156 return "ZipOpenFile";
170 std::string &fn = std::get<FnArg>( this->
args ).Get();
172 uint64_t size = std::get<SizeArg>( this->
args ).Get();
173 uint32_t crc32 = std::get<Crc32Arg>( this->
args ).Get();
175 if( !st.
IsOK() )
return st;
189 std::move( size ), std::move( crc32 ) ).
Timeout( timeout );
196 template<
bool HasHndl>
198 Arg<uint64_t>, Arg<uint32_t>, Arg<void*>>
232 uint64_t offset = std::get<OffsetArg>( this->
args ).Get();
233 uint32_t size = std::get<SizeArg>( this->
args ).Get();
234 void *buffer = std::get<BufferArg>( this->
args ).Get();
235 uint16_t
timeout = pipelineTimeout < this->timeout ?
236 pipelineTimeout : this->
timeout;
248 std::move( buffer ) ).
Timeout( timeout );
253 template<
bool HasHndl>
255 Arg<std::string>, Arg<uint64_t>, Arg<uint32_t>, Arg<void*>>
275 return "ZipReadFrom";
289 std::string &fn = std::get<FileNameArg>( this->
args ).Get();
290 uint64_t offset = std::get<OffsetArg>( this->
args ).Get();
291 uint32_t size = std::get<SizeArg>( this->
args ).Get();
292 void *buffer = std::get<BufferArg>( this->
args ).Get();
293 uint16_t
timeout = pipelineTimeout < this->timeout ?
294 pipelineTimeout : this->
timeout;
307 std::move( size ), std::move( buffer ) ).
Timeout( timeout );
314 template<
bool HasHndl>
316 Arg<uint32_t>, Arg<const void*>>
350 uint32_t size = std::get<SizeArg>( this->
args ).Get();
351 const void *buffer = std::get<BufferArg>( this->
args ).Get();
352 uint16_t
timeout = pipelineTimeout < this->timeout ?
353 pipelineTimeout : this->
timeout;
362 uint16_t timeout = 0 )
365 std::move( buffer ) ).
Timeout( timeout );
372 template<
bool HasHndl>
374 Arg<std::string>, Arg<uint32_t>, Arg<uint32_t>, Arg<const void*>>
408 std::string &fn = std::get<FnArg>( this->
args ).Get();
409 uint32_t crc32 = std::get<CrcArg>( this->
args ).Get();
410 uint32_t size = std::get<SizeArg>( this->
args ).Get();
411 const void *buffer = std::get<BufferArg>( this->
args ).Get();
412 uint16_t
timeout = pipelineTimeout < this->timeout ?
413 pipelineTimeout : this->
timeout;
426 std::move( size ), std::move( buffer ) ).
Timeout( timeout );
433 template<
bool HasHndl>
448 return "ZipCloseFile";
470 if( !st.
IsOK() )
return st;
481 template<
bool HasHndl>
512 if( !st.
IsOK() )
return st;
532 template<
bool HasHndl>
563 if( !st.
IsOK() )
return st;
583 template<
bool HasHndl>
612 uint16_t
timeout = pipelineTimeout < this->timeout ?
613 pipelineTimeout : this->
timeout;
614 return this->
zip->CloseArchive( handler,
timeout );
void Set(Type object, bool own=true)
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
CloseArchive operation (.
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
std::tuple< Args... > args
Operation arguments.
uint16_t timeout
Operation timeout.
Derived< HasHndl > Timeout(uint16_t timeout)
Set operation timeout.
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
std::unique_ptr< PipelineHandler > handler
Operation handler.
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
ZipOperation(ZipOperation< Derived, from, Response, Arguments... > &&op)
friend class ZipOperation
ZipOperation(Ctx< ZipArchive > zip, Arguments... args)
virtual ~ZipOperation()
Destructor.
Ctx< ZipArchive > zip
The file object itself.
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
XRootDStatus RunImpl(PipelineHandler *handler, uint16_t pipelineTimeout)
StatImpl< false > Stat(Ctx< File > file, Arg< bool > force, uint16_t timeout=0)
WriteImpl< false > Write(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< const void * > buffer, uint16_t timeout=0)
Factory for creating WriteImpl objects.
CloseArchiveImpl< false > CloseArchive(Ctx< ZipArchive > zip, uint16_t timeout=0)
Factory for creating CloseFileImpl objects.
ReadImpl< false > Read(Ctx< File > file, Arg< uint64_t > offset, Arg< uint32_t > size, Arg< void * > buffer, uint16_t timeout=0)
Factory for creating ReadImpl objects.
CloseFileImpl< false > CloseFile
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.
OpenFileImpl< false > OpenFile(Ctx< ZipArchive > zip, Arg< std::string > fn, Arg< OpenFlags::Flags > flags=OpenFlags::None, Arg< uint64_t > size=0, Arg< uint32_t > crc32=0, uint16_t timeout=0)
Factory for creating OpenFileImpl objects.
AppendFileImpl< false > AppendFile(Ctx< ZipArchive > zip, Arg< std::string > fn, Arg< uint32_t > crc32, Arg< uint32_t > size, Arg< const void * > buffer, uint16_t timeout=0)
Factory for creating ArchiveReadImpl objects.
OpenArchiveImpl< false > OpenArchive(Ctx< ZipArchive > zip, Arg< std::string > fn, Arg< OpenFlags::Flags > flags, uint16_t timeout=0)
Factory for creating OpenArchiveImpl objects.
ZipListImpl< false > List(Ctx< ZipArchive > zip)
Factory for creating ZipStatImpl objects.
Utility class for storing a pointer to operation context.
Flags
Open flags, may be or'd when appropriate.
bool IsOK() const
We're fine.