Arbiter
0.0.0
|
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>
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 |
![]() | |
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< Http > | create (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 |
![]() | |
virtual std::vector< std::string > | glob (std::string path, bool verbose) const |
Resolve a wildcard path. More... | |
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.
std::string arbiter::drivers::Http::get | ( | std::string | path, |
http::Headers | headers, | ||
http::Query | query | ||
) | const |
Perform an HTTP GET request.
|
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.
|
inlinefinaloverridevirtual |
Write data
to the given path
.
path | Path 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.
|
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.
|
overridevirtual |
By default, performs a HEAD request and returns the contents of the Content-Length header.
Implements arbiter::Driver.
Reimplemented in arbiter::drivers::S3.
|
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
.
Implements arbiter::Driver.
Reimplemented in arbiter::drivers::S3, and arbiter::drivers::Dropbox.