davix
0.3.4
|
Davix File Interface. More...
#include <davfile.hpp>
Public Member Functions | |
DavFile (Context &c, const Uri &url) | |
default constructor More... | |
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) |
return all replicas associated to this file More... | |
dav_ssize_t | readPartialBufferVec (const RequestParams *params, const DavIOVecInput *input_vec, DavIOVecOuput *ioutput_vec, const dav_size_t count_vec, DavixError **err) |
Vector read operation Allow to do several read several data chunk in one single operation Use Http multi-part when supported by the server, simulate a vector read operation in the other case. More... | |
dav_ssize_t | readPartial (const RequestParams *params, void *buff, dav_size_t count, dav_off_t offset, DavixError **err) |
Partial position independant read. More... | |
dav_ssize_t | getToFd (const RequestParams *params, int fd, DavixError **err) |
Get the full file content and write it to fd. More... | |
dav_ssize_t | getToFd (const RequestParams *params, int fd, dav_size_t size_read, DavixError **err) |
Get the first 'size_read' bytes of the file and write it to fd. More... | |
dav_ssize_t | getFull (const RequestParams *params, std::vector< char > &buffer, DavixError **err) |
Get the full file content in a dynamically allocated buffer. More... | |
int | putFromFd (const RequestParams *params, int fd, dav_size_t size_write, DavixError **err) |
create and replace the file with the content of the file descriptor fd More... | |
void | deletion (const RequestParams *params=NULL) |
Suppress the current entity. able to suppress collection too. More... | |
int | deletion (const RequestParams *params, DavixError **err) throw () |
Suppress the current entity. able to suppress collection too Exception safe version of deletion(const RequestParams* params = NULL) | |
void | makeCollection (const RequestParams *params=NULL) |
create a collection ( directory or bucket) at the current url More... | |
int | makeCollection (const RequestParams *params, DavixError **err) throw () |
create a collection ( directory or bucket) at the current url More... | |
int | stat (const RequestParams *params, struct stat *st, DavixError **err) |
execute a POSIX-like stat() query More... | |
std::string & | checksum (const RequestParams *params, std::string &checksm, const std::string &chk_algo) |
compute checksum of the file with the given algorithm (MD5, CRC32, ADLER32) More... | |
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) More... | |
void | prefetchInfo (off_t offset, dav_size_t size_read, advise_t adv) |
provide informations on the next file operation More... | |
dav_ssize_t | getAllReplicas (const RequestParams *params, ReplicaVec &vec, DavixError **err) |
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)
Depend of server implementation
params | request parameters |
checksm | checksum buffer |
chk_algo | string of the algorithm (eg: "MD5" ) |
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
void Davix::DavFile::deletion | ( | const RequestParams * | params = NULL | ) |
Suppress the current entity. able to suppress collection too.
params | Davix request Parameters |
throw | DavixException if error occurs |
dav_ssize_t Davix::DavFile::getAllReplicas | ( | const RequestParams * | params, |
ReplicaVec & | vec, | ||
DavixError ** | err | ||
) |
dav_ssize_t Davix::DavFile::getFull | ( | const RequestParams * | params, |
std::vector< char > & | buffer, | ||
DavixError ** | err | ||
) |
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 | ||
) |
return all replicas associated to this file
Replicas are found using a corresponding The MetaLink standard ( rfc5854, rfc6249 )
params | Davix Request parameters |
err | DavixError error report |
dav_ssize_t Davix::DavFile::getToFd | ( | const RequestParams * | params, |
int | fd, | ||
DavixError ** | err | ||
) |
Get the full file content and write it to fd.
params | Davix request Parameters |
fd | file descriptor for write operation |
err | Davix Error report |
dav_ssize_t Davix::DavFile::getToFd | ( | const RequestParams * | params, |
int | fd, | ||
dav_size_t | size_read, | ||
DavixError ** | err | ||
) |
Get the first 'size_read' bytes of the file and write it to fd.
params | Davix request Parameters |
fd | file descriptor for write operation |
size_read | number of bytes to read |
err | Davix Error report |
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 |
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::prefetchInfo | ( | off_t | offset, |
dav_size_t | size_read, | ||
advise_t | adv | ||
) |
provide informations on the next file operation
provide informations on the next file operations for optimizations and prefetching
offset | |
size_read | |
adv |
int Davix::DavFile::putFromFd | ( | const RequestParams * | params, |
int | fd, | ||
dav_size_t | size_write, | ||
DavixError ** | err | ||
) |
create and replace the file with the content of the file descriptor fd
params | Davix request Parameters |
fd | file descriptor |
size_write | number of bytes to write |
err | Davix Error report |
dav_ssize_t Davix::DavFile::readPartial | ( | const RequestParams * | params, |
void * | buff, | ||
dav_size_t | count, | ||
dav_off_t | offset, | ||
DavixError ** | err | ||
) |
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 | start 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 | ||
) |
Vector read operation Allow to do several read several data chunk in one single operation Use Http multi-part when supported by the server, simulate a vector read operation in the other case.
params | Davix request Parameters |
input_vec | input vectors, parameters |
ioutput_vec | output vectors, results |
count_vec | number of vector struct |
err | Davix Error report |
int Davix::DavFile::stat | ( | const RequestParams * | params, |
struct stat * | st, | ||
DavixError ** | err | ||
) |
execute a POSIX-like stat() query
params | Davix request Parameters |
st | stat struct |
err | Davix Error report |