davix
|
Davix File Interface. More...
#include <davfile.hpp>
Data Structures | |
class | Iterator |
Public Member Functions | |
DavFile (Context &c, const Uri &url) | |
default constructor | |
DavFile (Context &c, const RequestParams ¶ms, const Uri &url) | |
DavFile (const DavFile &orig) | |
virtual | ~DavFile () |
destructor | |
const Uri & | getUri () const |
return Uri of the current file | |
std::vector< DavFile > | getReplicas (const RequestParams *params, DavixError **err) throw () |
return all replicas associated to this file | |
dav_ssize_t | readPartialBufferVec (const RequestParams *params, const DavIOVecInput *input_vec, DavIOVecOuput *ioutput_vec, const dav_size_t count_vec, DavixError **err) throw () |
Vector read operation Able to do several read on several data chunk in one single operation. Uses Http multi-part when supported by the server, simulate a vector read operation otherwise. | |
dav_ssize_t | readPartial (const RequestParams *params, void *buff, dav_size_t count, dav_off_t offset, DavixError **err) throw () |
Partial position independant read. | |
dav_ssize_t | getToFd (const RequestParams *params, int fd, DavixError **err) throw () |
Get the full file content and write it to file descriptor. | |
dav_ssize_t | getToFd (const RequestParams *params, int fd, dav_size_t size_read, DavixError **err) throw () |
Get the first 'size_read' bytes of the file and write it to file descriptor. | |
dav_ssize_t | getFull (const RequestParams *params, std::vector< char > &buffer, DavixError **err) throw () |
Get the full file content in a dynamically allocated buffer. | |
dav_ssize_t | get (const RequestParams *params, std::vector< char > &buffer) |
Get the full file content to buffer. | |
void | put (const RequestParams *params, int fd, dav_size_t size_write) |
Create/Replace file content. | |
void | put (const RequestParams *params, const char *buffer, dav_size_t size_write) |
Create/Replace file content. | |
void | move (const RequestParams *params, DavFile &destination) |
move | |
void | deletion (const RequestParams *params=NULL) |
Suppress the current entity or collection. | |
int | deletion (const RequestParams *params, DavixError **err) throw () |
Suppress the current entity or collection. | |
void | makeCollection (const RequestParams *params=NULL) |
create a collection (directory or bucket) at the current url | |
int | makeCollection (const RequestParams *params, DavixError **err) throw () |
create a collection (directory or bucket) at the current url | |
StatInfo & | statInfo (const RequestParams *params, StatInfo &info) |
execute a file meta-data query | |
int | stat (const RequestParams *params, struct stat *st, DavixError **err) throw () |
execute a POSIX-like stat() query | |
Iterator | listCollection (const RequestParams *params) |
Collection listing. | |
std::string & | checksum (const RequestParams *params, std::string &checksm, const std::string &chk_algo) |
compute checksum of the file | |
int | checksum (const RequestParams *params, std::string &checksm, const std::string &chk_algo, DavixError **err) throw () |
compute checksum of the file with the given algorithm (MD5, CRC32, ADLER32) | |
void | prefetchInfo (off_t offset, dav_size_t size_read, advise_t adv) |
provide information on the next file operation | |
QuotaInfo & | quotaInfo (const RequestParams *params, QuotaInfo &info) |
retrieve quota information | |
DEPRECATED (dav_ssize_t getAllReplicas(const RequestParams *params, ReplicaVec &vec, DavixError **err)) | |
DEPRECATED (int putFromFd(const RequestParams *params, int fd, dav_size_t size_write, DavixError **err) throw()) | |
Davix File Interface.
Davix File interface
default constructor
c | context |
url | remote file URL |
std::string & Davix::DavFile::checksum | ( | const RequestParams * | params, |
std::string & | checksm, | ||
const std::string & | chk_algo | ||
) |
compute checksum of the file
with the given algorithm (MD5, CRC32, ADLER32)
server implementation dependend
Davix::checksum support LCGDM-DAV, dCache Jetty and Aws S3 checksum support
params | request parameters |
checksm | checksum buffer |
chk_algo | string of the algorithm (eg: "MD5" ) |
throw | DavixException if error occurs |
int Davix::DavFile::checksum | ( | const RequestParams * | params, |
std::string & | checksm, | ||
const std::string & | chk_algo, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
compute checksum of the file with the given algorithm (MD5, CRC32, ADLER32)
Exception safe version of checksum
int Davix::DavFile::deletion | ( | const RequestParams * | params, |
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
Suppress the current entity or collection.
Exception safe version of deletion(const RequestParams* params = NULL)
void Davix::DavFile::deletion | ( | const RequestParams * | params = NULL | ) |
Suppress the current entity or collection.
params | Davix request Parameters |
throw | DavixException if error occurs |
Davix::DavFile::DEPRECATED | ( | dav_ssize_t | getAllReplicasconst RequestParams *params, ReplicaVec &vec, DavixError **err | ) |
Davix::DavFile::DEPRECATED | ( | int | putFromFdconst RequestParams *params, int fd, dav_size_t size_write, DavixError **err) throw( | ) |
dav_ssize_t Davix::DavFile::get | ( | const RequestParams * | params, |
std::vector< char > & | buffer | ||
) |
Get the full file content to buffer.
params | Davix request Parameters |
buffer | reference to a vector for storing the result |
Get the file content in a dynamically allocated buffer
WARNING: this operation is without size limit for the content
dav_ssize_t Davix::DavFile::getFull | ( | const RequestParams * | params, |
std::vector< char > & | buffer, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
Get the full file content in a dynamically allocated buffer.
params | Davix request Parameters |
buffer | reference to a vector for the result |
err | Davix error report |
std::vector< DavFile > Davix::DavFile::getReplicas | ( | const RequestParams * | params, |
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
return all replicas associated to this file
Replicas are found using a corresponding The MetaLink standard ( rfc5854, rfc6249 )
params | Davix Request parameters |
err | Davix error report |
dav_ssize_t Davix::DavFile::getToFd | ( | const RequestParams * | params, |
int | fd, | ||
dav_size_t | size_read, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
Get the first 'size_read' bytes of the file and write it to file descriptor.
params | Davix request Parameters |
fd | file descriptor for write operation |
size_read | number of bytes to read |
err | Davix error report |
dav_ssize_t Davix::DavFile::getToFd | ( | const RequestParams * | params, |
int | fd, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
Get the full file content and write it to file descriptor.
params | Davix request Parameters |
fd | file descriptor for write operation |
err | Davix error report |
Iterator Davix::DavFile::listCollection | ( | const RequestParams * | params | ) |
Collection listing.
params | Davix request parameters |
int Davix::DavFile::makeCollection | ( | const RequestParams * | params, |
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
create a collection (directory or bucket) at the current url
Exception safe version of makeCollection(const RequestParams *params = NULL)
void Davix::DavFile::makeCollection | ( | const RequestParams * | params = NULL | ) |
create a collection (directory or bucket) at the current url
params | Davix request Parameters |
throw | DavixException if error occurs |
void Davix::DavFile::move | ( | const RequestParams * | params, |
DavFile & | destination | ||
) |
move
params | Davix request Parameters |
destination | destination resource |
Move the current resource to Destination.
The result of the operation depend of the protocol used.
Protocol supported currently: WebDav, S3
void Davix::DavFile::prefetchInfo | ( | off_t | offset, |
dav_size_t | size_read, | ||
advise_t | adv | ||
) |
provide information on the next file operation
provide information on the next file operations for optimizations and prefetching
offset | |
size_read | |
adv |
void Davix::DavFile::put | ( | const RequestParams * | params, |
const char * | buffer, | ||
dav_size_t | size_write | ||
) |
Create/Replace file content.
params | Davix request Parameters |
buffer | buffer with data to write |
size_write | number of bytes to write |
throw | DavixException if an error occurs |
Set a new content for the file. The new content comes from buffer.
void Davix::DavFile::put | ( | const RequestParams * | params, |
int | fd, | ||
dav_size_t | size_write | ||
) |
Create/Replace file content.
params | Davix request Parameters |
fd | file descriptor |
size_write | number of bytes to write |
throw | DavixException if an error occurs |
Create / Replace the file. Read the new content from the file descriptor fd for a maximum of size_write bytes.
QuotaInfo & Davix::DavFile::quotaInfo | ( | const RequestParams * | params, |
QuotaInfo & | info | ||
) |
retrieve quota information
retrieve quota information about a directory
params | |
info |
dav_ssize_t Davix::DavFile::readPartial | ( | const RequestParams * | params, |
void * | buff, | ||
dav_size_t | count, | ||
dav_off_t | offset, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
Partial position independant read.
Use ranged request when supported by the server, simulate a ranged request when not supported
params | Davix request Parameters |
buff | buffer |
count | maximum read size |
offset | starting offset for the read operation |
err | Davix error report |
dav_ssize_t Davix::DavFile::readPartialBufferVec | ( | const RequestParams * | params, |
const DavIOVecInput * | input_vec, | ||
DavIOVecOuput * | ioutput_vec, | ||
const dav_size_t | count_vec, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
Vector read operation Able to do several read on several data chunk in one single operation. Uses Http multi-part when supported by the server, simulate a vector read operation otherwise.
NOTE: The return code is the number of data bytes received from the server, not the total number of bytes written into the buffers. The two might not be equal if range coalescing is performed. Check diov_size of the output vector to make sure the buffers contain the expected number of bytes.
params | Davix request Parameters |
input_vec | input vectors, parameters |
ioutput_vec | output vectors, results |
count_vec | number of vector |
err | Davix error report |
int Davix::DavFile::stat | ( | const RequestParams * | params, |
struct stat * | st, | ||
DavixError ** | err | ||
) | |||
throw | ( | ||
) |
execute a POSIX-like stat() query
params | Davix request parameters |
st | stat struct |
err | Davix error report |
StatInfo & Davix::DavFile::statInfo | ( | const RequestParams * | params, |
StatInfo & | info | ||
) |
execute a file meta-data query
params | Davix request Parameters |
info | stat struct |