davix  0.2.6
Davix Documentation
Author
Devresse Adrien ( adrie.nosp@m.n.de.nosp@m.vress.nosp@m.e@ce.nosp@m.rn.ch )

From CERN IT-GT-DMS ( lcgut.nosp@m.il-s.nosp@m.uppor.nosp@m.t@ce.nosp@m.rn.ch ) mailing list : davix.nosp@m.-dev.nosp@m.el@ce.nosp@m.rn.c.nosp@m.h

DAVIX

Davix is a lightweight toolkit for remote file interactions with HTTP based protocols.

Davix aims to supports all the needed features for an efficient file access and file management in grid and clouds : SSL Session reuse, X509 client auth, VOMS credential, S3 auth, Vector operations (Partial reads, multi-range, single range), Partial PUT / PATCH, Fail-over, Multi-streams ( Metalinks), Redirection support for all operations, Redirections caching, Webdav parsing, Right Management (ACL), Meta-data functions ( mkdir, rmdir, unlink, etc.. ), Chunked transfert, etc....

Davix supports the protocols

The Davix philosophy can be summarized as

DAVIX API :

File API : Davix::DavFile

Posix-like API : Davix::DavPosix

Entry point API : davix.hpp

Davix is yet an other libcurl ?

In short : No

Libcurl defines itself as a "client side URL transfer".
it provides "protocol level" API, you compose your http queries mannually.

Examples :

File Usage

Create a directory :

DavixError* tmp_err=NULL;
DavFile f(context, url);
// creat directory
p.makeCollection(NULL, &tmp_err);

Get a full file content:

DavixError* tmp_err=NULL;
DavFile f(context, "http://mysite.org/file");
int fd = open("/tmp/local_file", O_WRONLY | O_CREAT);
// get full file
if( p.getToFd(NULL,fd, &tmp_err) < 0)
std::cerr << "Error: " << tmp_err->getErrMsg() << std::endl;

Execute a partial GET :

char buffer[255] = {0}
DavixError* tmp_err=NULL;
DavFile f(context, "http://mysite.org/file");
// get 100 bytes from http://mysite.org/file after an offset of 200 bytes
if( p.readPartial(NULL, buffer, 100, 200
&tmp_err) <0 )
std::cerr << "Error: " << tmp_err->getErrMsg() << std::endl;
else
std::cout << "Content: " << buffer << std::endl;

Execute a Vector Operation :

char buffer[255] = {0}
DavixError* tmp_err=NULL;
DavFile f(context, "http://mysite.org/file");
DavIOVecInput in[3];
DavIOVecOutput ou[3];
// get 100 bytes from http://mysite.org/file after an offset of 200 bytes
if( p.readPartial(NULL, buffer, 100, 200
&tmp_err) <0 )
std::cerr << "Error: " << tmp_err->getErrMsg() << std::endl;
else
std::cout << "Content: " << buffer << std::endl;

POSIX Usage

Stat query :

// state quer
p.stat("https://mywebdav-server.org/mydir/", &stat, &tmp_err);

random I/O :

//
// read ops
fd= p.open(NULL, "https://mywebdav-server.org/myfile.jpg", O_RDONLY, &tmp_err);
p.read(fd, buffer, size, &tmp_err);
p.pread(fd, buffer, size2, offset, &tmp_err);
p.close(fd);
//

LOW LEVEL Usage

Davix::HttpRequest req("https://restapi-server.org/rest")
req.addHeaderField(...)
req.setRequestMethod("PUT")
// .. configure ....
//
//
// execute your request
req.executeRequest(...);

How to compile :

Play with davix command line tool :

davix has a set of command line tools for testing purpose and demonstration

-> davix-ls: file listing
-> davix-get: download operations
-> davix-put: upload operations
-> davix: low level query composition

TODO in Davix :

- MacOSX portability check
- Kerberos support
- Metalink support
- map S3 bucket operations
- ACL support
- (?) CDMI support

please contact us on davix-devel@cern.ch ( CERN e-group & mailing list ) or on adrien.devresse@cern.ch

Any contribution is welcome

Davix Website :

    https://svnweb.cern.ch/trac/lcgutil/wiki/davix