Arbiter provides simple/fast/thread-safe C++ access to filesystem, HTTP, S3, and Dropbox resources in a uniform way. It is designed to be extendible, so other resource types may also be abstracted.
Full docs live here. The core API is intended to be as simple as possible.
using namespace arbiter; Arbiter a; std::string fsPath, httpPath, s3Path; std::string fsData, httpData, s3Data; std::vector<std::string> fsGlob, s3Glob; // Read and write data. fsPath = "~/fs.txt"; // Tilde expansion is supported on both Unix and Windows. a.put(fsPath, "Filesystem contents!"); fsData = a.get(fsPath); httpPath = "http://some-server.com/http.txt"; a.put(httpPath, "HTTP contents!"); httpData = a.get(httpPath); // S3 credentials can be inferred from the environment or well-known FS paths. s3Path = "s3://some-bucket/s3.txt"; a.put(s3Path, "S3 contents!"); s3Data = a.get(s3Path); // Resolve globbed directory paths. fsGlob = a.resolve("~/data/*"); s3Glob = a.resolve("s3://some-bucket/some-dir/*");
Some drivers accept (or might require) explicit values for configuration.
using namespace arbiter; Json::Value config; config["dropbox"]["token"] = "My dropbox token"; config["s3"]["access"] = "My access key"; config["s3"]["hidden"] = "My secret key"; Arbiter a(config); // Now dropbox and S3 paths are accessible. auto data = a.get("dropbox://my-file.txt");
Using Arbiter in your project
Arbiter uses CMake for its build process. To build and install, run from the top level:
mkdir build && cd build cmake -G "<CMake generator type>" .. # For example: cmake -G "Unix Makefiles" .. make make install
Then simply include the header in your project:
...and link with the library with
The amalgamation method lets you integrate Arbiter into your project by adding a single source and a single header to your project. Create the amalgamation by running from the top level:
dist/arbiter.cpp into your project tree and include them in your build system like any other source files. With this method you'll need to link the Curl dependency into your project manually.
Once the amalgamated files are integrated with your source tree, simply
#include "arbiter.hpp" and get to work.
Arbiter depends on Curl, which comes preinstalled on most UNIX-based machines. To manually link (for amalgamated usage) on Unix-based operating systems, link with
-lcurl. Arbiter also works on Windows, but you'll have to obtain Curl yourself there.
Arbiter requires C++11.