Arbiter  0.0.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
arbiter::drivers::Http Class Reference

HTTP driver. Intended as both a standalone driver as well as a base for derived drivers build atop HTTP. More...

#include <arbiter/drivers/http.hpp>

Inheritance diagram for arbiter::drivers::Http:
arbiter::Driver arbiter::drivers::Dropbox arbiter::drivers::S3

Public Member Functions

 Http (http::Pool &pool)
 
virtual std::string type () const override
 
virtual std::unique_ptr< std::size_t > tryGetSize (std::string path) const override
 
virtual void put (std::string path, const std::vector< char > &data) const final override
 
std::string get (std::string path, http::Headers headers, http::Query query) const
 
std::unique_ptr< std::string > tryGet (std::string path, http::Headers headers, http::Query query) const
 
std::vector< char > getBinary (std::string path, http::Headers headers, http::Query query) const
 
std::unique_ptr< std::vector< char > > tryGetBinary (std::string path, http::Headers headers, http::Query query) const
 
void put (std::string path, const std::string &data, http::Headers headers, http::Query query) const
 
virtual void put (std::string path, const std::vector< char > &data, http::Headers headers, http::Query query) const
 
- Public Member Functions inherited from arbiter::Driver
std::string get (std::string path) const
 
std::unique_ptr< std::string > tryGet (std::string path) const
 
std::vector< char > getBinary (std::string path) const
 
std::unique_ptr< std::vector< char > > tryGetBinary (std::string path) const
 
virtual bool isRemote () const
 
std::size_t getSize (std::string path) const
 
void put (std::string path, const std::string &data) const
 
std::vector< std::string > resolve (std::string path, bool verbose=false) const
 Resolve a possibly globbed path. More...
 

Static Public Member Functions

static std::unique_ptr< Httpcreate (http::Pool &pool, const Json::Value &json)
 

Protected Member Functions

virtual bool get (std::string path, std::vector< char > &data, http::Headers headers, http::Query query) const
 
http::Response internalGet (std::string path, http::Headers headers=http::Headers(), http::Query query=http::Query()) const
 
http::Response internalPut (std::string path, const std::vector< char > &data, http::Headers headers=http::Headers(), http::Query query=http::Query()) const
 
http::Response internalHead (std::string path, http::Headers headers=http::Headers(), http::Query query=http::Query()) const
 
http::Response internalPost (std::string path, const std::vector< char > &data, http::Headers headers=http::Headers(), http::Query query=http::Query()) const
 
- Protected Member Functions inherited from arbiter::Driver
virtual std::vector< std::string > glob (std::string path, bool verbose) const
 Resolve a wildcard path. More...
 

Detailed Description

HTTP driver. Intended as both a standalone driver as well as a base for derived drivers build atop HTTP.

Derivers should overload the HTTP-specific put/get methods that accept headers and query parameters rather than Driver::put and Driver::get.

Internal methods for derivers are provided as protected methods.

Member Function Documentation

std::string arbiter::drivers::Http::get ( std::string  path,
http::Headers  headers,
http::Query  query 
) const

Perform an HTTP GET request.

bool arbiter::drivers::Http::get ( std::string  path,
std::vector< char > &  data,
http::Headers  headers,
http::Query  query 
) const
protectedvirtual

HTTP-derived Drivers should override this version of GET to allow for custom headers and query parameters.

std::vector< char > arbiter::drivers::Http::getBinary ( std::string  path,
http::Headers  headers,
http::Query  query 
) const

Perform an HTTP GET request.

virtual void arbiter::drivers::Http::put ( std::string  path,
const std::vector< char > &  data 
) const
inlinefinaloverridevirtual

Write data to the given path.

Note
Derived classes must override.
Parameters
pathPath with the type-specifying prefix information stripped.

Implements arbiter::Driver.

void arbiter::drivers::Http::put ( std::string  path,
const std::string &  data,
http::Headers  headers,
http::Query  query 
) const

Perform an HTTP PUT request.

void arbiter::drivers::Http::put ( std::string  path,
const std::vector< char > &  data,
http::Headers  headers,
http::Query  query 
) const
virtual

HTTP-derived Drivers should override this version of PUT to allow for custom headers and query parameters.Perform an HTTP PUT request.

Reimplemented in arbiter::drivers::S3, and arbiter::drivers::Dropbox.

std::unique_ptr< std::string > arbiter::drivers::Http::tryGet ( std::string  path,
http::Headers  headers,
http::Query  query 
) const

Perform an HTTP GET request.

std::unique_ptr< std::vector< char > > arbiter::drivers::Http::tryGetBinary ( std::string  path,
http::Headers  headers,
http::Query  query 
) const

Perform an HTTP GET request.

std::unique_ptr< std::size_t > arbiter::drivers::Http::tryGetSize ( std::string  path) const
overridevirtual

By default, performs a HEAD request and returns the contents of the Content-Length header.

Implements arbiter::Driver.

Reimplemented in arbiter::drivers::S3.

virtual std::string arbiter::drivers::Http::type ( ) const
inlineoverridevirtual

Returns a string identifying this driver type, which should be unique among all other drivers. Paths that begin with the substring <type>:// will be routed to this driver. For example, fs, s3, or http.

Note
Derived classes must override.

Implements arbiter::Driver.

Reimplemented in arbiter::drivers::S3, and arbiter::drivers::Dropbox.


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