davix  0.4.0
Data Structures | Public Member Functions
Davix::DavFile Class Reference

Davix File Interface. More...

#include <davfile.hpp>

Data Structures

class  Iterator
 

Public Member Functions

 DavFile (Context &c, const Uri &url)
 default constructor More...
 
 DavFile (Context &c, const RequestParams &params, const Uri &url)
 
 DavFile (const DavFile &orig)
 
virtual ~DavFile ()
 destructor
 
const UrigetUri () const
 return Uri of the current file
 
std::vector< DavFilegetReplicas (const RequestParams *params, DavixError **err) throw ()
 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) throw ()
 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) throw ()
 Partial position independant read. More...
 
dav_ssize_t getToFd (const RequestParams *params, int fd, DavixError **err) throw ()
 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) throw ()
 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) throw ()
 Get the full file content in a dynamically allocated buffer. More...
 
dav_ssize_t get (const RequestParams *params, std::vector< char > &buffer)
 Get the full file content. More...
 
void put (const RequestParams *params, int fd, dav_size_t size_write)
 Create/Replace file content. More...
 
void put (const RequestParams *params, const char *buffer, dav_size_t size_write)
 Create/Replace file content. More...
 
void move (const RequestParams *params, DavFile &destination)
 move 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...
 
StatInfostatInfo (const RequestParams *params, StatInfo &info)
 execute a file meta-data query More...
 
int stat (const RequestParams *params, struct stat *st, DavixError **err) throw ()
 execute a POSIX-like stat() query More...
 
Iterator listCollection (const RequestParams *params)
 Collection listing. 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...
 
 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())
 

Detailed Description

Davix File Interface.

Davix File interface

Constructor & Destructor Documentation

Davix::DavFile::DavFile ( Context c,
const Uri url 
)

default constructor

Parameters
ccontext
urlRemote File URL

Member Function Documentation

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

Parameters
paramsrequest parameters
checksmchecksum buffer
chk_algostring of the algorithm (eg: "MD5" )
Returns
reference to checksm, 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

void Davix::DavFile::deletion ( const RequestParams params = NULL)

Suppress the current entity. able to suppress collection too.

Parameters
paramsDavix request Parameters
Exceptions
throwDavixException if error occurs
Davix::DavFile::DEPRECATED ( dav_ssize_t   getAllReplicasconst RequestParams *params, ReplicaVec &vec, DavixError **err)
Deprecated:
deprecated, will be removed in 2.0
Davix::DavFile::DEPRECATED ( int   putFromFdconst RequestParams *params, int fd, dav_size_t size_write, DavixError **err) throw()
Deprecated:
please use put() as a replacer, will be removed in 2.0
dav_ssize_t Davix::DavFile::get ( const RequestParams params,
std::vector< char > &  buffer 
)

Get the full file content.

Parameters
paramsDavix request Parameters
bufferreference to a vector for the result
Returns
total number of bytes read, or -1 if error occures

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.

Parameters
paramsDavix request Parameters
bufferreference to a vector for the result
errDavix Error report
Returns
total number of bytes read, or -1 if error occures
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 )

Parameters
paramsDavix Request parameters
errDavixError error report
Returns
Replica vector, if error is found return empty vector and set err properly
dav_ssize_t Davix::DavFile::getToFd ( const RequestParams params,
int  fd,
DavixError **  err 
)
throw (
)

Get the full file content and write it to fd.

Parameters
paramsDavix request Parameters
fdfile descriptor for write operation
errDavix Error report
Returns
total number of bytes read, or -1 if error occures
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 fd.

Parameters
paramsDavix request Parameters
fdfile descriptor for write operation
size_readnumber of bytes to read
errDavix Error report
Returns
total number of bytes read, or -1 if error occures
Iterator Davix::DavFile::listCollection ( const RequestParams params)

Collection listing.

Parameters
paramsDaviX request parameters
Returns
Iterator to the collection
void Davix::DavFile::makeCollection ( const RequestParams params = NULL)

create a collection ( directory or bucket) at the current url

Parameters
paramsDavix request Parameters
Exceptions
throwDavixException 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::move ( const RequestParams params,
DavFile destination 
)

move

Parameters
paramsDavix request Parameters
destinationDestination Resource

Move the current resource to Destination The result of the operation depend of the protocol used. Protocol supported currently: WebDav

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

Parameters
offset
size_read
adv
void Davix::DavFile::put ( const RequestParams params,
int  fd,
dav_size_t  size_write 
)

Create/Replace file content.

Parameters
paramsDavix request Parameters
fdfile descriptor
size_writenumber of bytes to write
Exceptions
DavixExceptionif an error occurs

Create / Replace the file. Read the new content from the file descriptor fd for a maximum of size_write bytes.

void Davix::DavFile::put ( const RequestParams params,
const char *  buffer,
dav_size_t  size_write 
)

Create/Replace file content.

Parameters
paramsDavix request Parameters
bufferbuffer with data to write
size_writenumber of bytes to write
Exceptions
DavixExceptionif an error occurs

Set a new content for the file. The new content comes from buffer

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

Parameters
paramsDavix request Parameters
buffbuffer
countmaximum read size
offsetstart offset for the read operation
errDavix Error report
Returns
total number of bytes read, or -1 if error occures
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 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.

Parameters
paramsDavix request Parameters
input_vecinput vectors, parameters
ioutput_vecoutput vectors, results
count_vecnumber of vector struct
errDavix Error report
Returns
total number of bytes read, or -1 if error occures
int Davix::DavFile::stat ( const RequestParams params,
struct stat *  st,
DavixError **  err 
)
throw (
)

execute a POSIX-like stat() query

Parameters
paramsDaviX request parameters
ststat struct
errDavix Error report
Returns
0 if success, or -1 if error occures
StatInfo& Davix::DavFile::statInfo ( const RequestParams params,
StatInfo info 
)

execute a file meta-data query

Parameters
paramsDavix request Parameters
ststat struct
errDavix Error report
Returns
0 if success, or -1 if error occures

The documentation for this class was generated from the following file: