RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
Classes | |
struct | Content |
struct | MultiPartUpload |
struct | MultiPartUploadPart |
struct | ObjectInfo |
struct | ObjectMetadata |
struct | RequestParams |
struct | Response |
struct | SignedRequest |
Public Types | |
enum | Redundancy { REDUNDANCY_STANDARD, REDUNDANCY_REDUCED, REDUNDANCY_GLACIER } |
enum | ServerSideEncryption { SSE_NONE, SSE_AES256 } |
enum | CheckMethod { CM_SIZE, CM_MD5_ETAG, CM_ASSUME_INVALID } |
typedef std::vector< std::pair < std::string, std::string > > | StrPairVector |
typedef std::function< void(const char *chunk, size_t size, int chunkIndex, uint64_t offset, uint64_t totalSize) | OnChunk ) |
typedef std::function< bool(const std::string &prefix, const std::string &objectName, const ObjectInfo &info, int depth)> | OnObject |
typedef std::function< bool(const std::string &prefix, const std::string &dirName, int depth)> | OnSubdir |
typedef std::function< bool(std::string bucket)> | OnBucket |
Public Member Functions | |
S3Api (const std::string &accessKeyId, const std::string &accessKey, double bandwidthToServiceMbps=defaultBandwidthToServiceMbps, const std::string &defaultProtocol="http", const std::string &serviceUri="s3.amazonaws.com") | |
void | init (const std::string &accessKeyId, const std::string &accessKey, double bandwidthToServiceMbps=defaultBandwidthToServiceMbps, const std::string &defaultProtocol="http", const std::string &serviceUri="s3.amazonaws.com") |
std::string | signature (const RequestParams &request) const |
SignedRequest | prepare (const RequestParams &request) const |
Response | get (const std::string &bucket, const std::string &resource, uint64_t expectedBytesToTransfer, const std::string &subResource="", const StrPairVector &headers=StrPairVector(), const StrPairVector &queryParams=StrPairVector()) const |
Response | post (const std::string &bucket, const std::string &resource, const std::string &subResource="", const StrPairVector &headers=StrPairVector(), const StrPairVector &queryParams=StrPairVector(), const Content &content=Content()) const |
Response | put (const std::string &bucket, const std::string &resource, const std::string &subResource="", const StrPairVector &headers=StrPairVector(), const StrPairVector &queryParams=StrPairVector(), const Content &content=Content()) const |
Response | erase (const std::string &bucket, const std::string &resource, const std::string &subResource="", const StrPairVector &headers=StrPairVector(), const StrPairVector &queryParams=StrPairVector(), const Content &content=Content()) const |
std::string | upload (const char *data, size_t bytes, const std::string &bucket, const std::string &resource, CheckMethod check=CM_SIZE, const ObjectMetadata &md=ObjectMetadata(), int numInParallel=-1) |
std::string | upload (const char *data, size_t bytes, const std::string &uri, CheckMethod check=CM_SIZE, const ObjectMetadata &md=ObjectMetadata(), int numInParallel=-1) |
void | download (const std::string &bucket, const std::string &object, const OnChunk &onChunk, ssize_t startOffset=0, ssize_t endOffset=-1) const |
void | download (const std::string &uri, const OnChunk &onChunk, ssize_t startOffset=0, ssize_t endOffset=-1) const |
void | downloadToFile (const std::string &uri, const std::string &outfile, ssize_t endOffset=-1) const |
std::auto_ptr< std::streambuf > | streamingDownload (const std::string &bucket, const std::string &object, ssize_t startOffset=0, ssize_t endOffset=-1, const OnChunk &onChunk=OnChunk()) const |
std::auto_ptr< std::streambuf > | streamingDownload (const std::string &uri, ssize_t startOffset=0, ssize_t endOffset=-1, const OnChunk &onChunk=OnChunk()) const |
std::auto_ptr< std::streambuf > | streamingUpload (const std::string &uri, const ObjectMetadata &md=ObjectMetadata()) const |
std::auto_ptr< std::streambuf > | streamingUpload (const std::string &bucket, const std::string &object, const ObjectMetadata &md=ObjectMetadata()) const |
void | forEachObject (const std::string &bucket, const std::string &prefix="", const OnObject &onObject=OnObject(), const OnSubdir &onSubdir=OnSubdir(), const std::string &delimiter="/", int depth=1) const |
ObjectInfo | tryGetObjectInfo (const std::string &bucket, const std::string &object) const |
ObjectInfo | tryGetObjectInfo (const std::string &uri) const |
ObjectInfo | getObjectInfo (const std::string &bucket, const std::string &object) const |
ObjectInfo | getObjectInfo (const std::string &uri) const |
bool | forEachBucket (const OnBucket &bucket) const |
MultiPartUpload | obtainMultiPartUpload (const std::string &bucket, const std::string &resource, const ObjectMetadata &metadata) const |
std::string | finishMultiPartUpload (const std::string &bucket, const std::string &resource, const std::string &uploadId, const std::vector< std::string > &etags) const |
void | uploadRecursive (std::string dirSrc, std::string bucketDest, bool includeDir) |
void | setDefaultBandwidthToServiceMbps (double mpbs) |
Static Public Member Functions | |
static std::string | sign (const std::string &stringToSign, const std::string &accessKey) |
static OnChunk | writeToFile (const std::string &filename) |
static std::string | getDigestMulti (const std::string &verb, const std::string &bucket, const std::string &resource, const std::string &subResource, const std::string &contentType, const std::string &contentMd5, const std::string &date, const std::vector< std::pair< std::string, std::string > > &headers) |
static std::string | getDigest (const std::string &verb, const std::string &bucket, const std::string &resource, const std::string &subResource, const std::string &contentType, const std::string &contentMd5, const std::string &date, const std::map< std::string, std::string > &headers) |
static std::pair< std::string, std::string > | parseUri (const std::string &uri) |
Public Attributes | |
std::string | accessKeyId |
std::string | accessKey |
std::string | defaultProtocol |
std::string | serviceUri |
double | bandwidthToServiceMbps |
Static Public Attributes | |
static double | defaultBandwidthToServiceMbps = 20.0 |
Datacratic::S3Api::S3Api | ( | const std::string & | accessKeyId, |
const std::string & | accessKey, | ||
double | bandwidthToServiceMbps = defaultBandwidthToServiceMbps , |
||
const std::string & | defaultProtocol = "http" , |
||
const std::string & | serviceUri = "s3.amazonaws.com" |
||
) |
void Datacratic::S3Api::download | ( | const std::string & | bucket, |
const std::string & | object, | ||
const OnChunk & | onChunk, | ||
ssize_t | startOffset = 0 , |
||
ssize_t | endOffset = -1 |
||
) | const |
void Datacratic::S3Api::downloadToFile | ( | const std::string & | uri, |
const std::string & | outfile, | ||
ssize_t | endOffset = -1 |
||
) | const |
S3Api::Response Datacratic::S3Api::erase | ( | const std::string & | bucket, |
const std::string & | resource, | ||
const std::string & | subResource = "" , |
||
const StrPairVector & | headers = StrPairVector() , |
||
const StrPairVector & | queryParams = StrPairVector() , |
||
const Content & | content = Content() |
||
) | const |
bool Datacratic::S3Api::forEachBucket | ( | const OnBucket & | bucket | ) | const |
void Datacratic::S3Api::forEachObject | ( | const std::string & | bucket, |
const std::string & | prefix = "" , |
||
const OnObject & | onObject = OnObject() , |
||
const OnSubdir & | onSubdir = OnSubdir() , |
||
const std::string & | delimiter = "/" , |
||
int | depth = 1 |
||
) | const |
S3Api::Response Datacratic::S3Api::get | ( | const std::string & | bucket, |
const std::string & | resource, | ||
uint64_t | expectedBytesToTransfer, | ||
const std::string & | subResource = "" , |
||
const StrPairVector & | headers = StrPairVector() , |
||
const StrPairVector & | queryParams = StrPairVector() |
||
) | const |
std::string Datacratic::S3Api::getDigest | ( | const std::string & | verb, |
const std::string & | bucket, | ||
const std::string & | resource, | ||
const std::string & | subResource, | ||
const std::string & | contentType, | ||
const std::string & | contentMd5, | ||
const std::string & | date, | ||
const std::map< std::string, std::string > & | headers | ||
) | [static] |
std::string Datacratic::S3Api::getDigestMulti | ( | const std::string & | verb, |
const std::string & | bucket, | ||
const std::string & | resource, | ||
const std::string & | subResource, | ||
const std::string & | contentType, | ||
const std::string & | contentMd5, | ||
const std::string & | date, | ||
const std::vector< std::pair< std::string, std::string > > & | headers | ||
) | [static] |
S3Api::ObjectInfo Datacratic::S3Api::getObjectInfo | ( | const std::string & | bucket, |
const std::string & | object | ||
) | const |
Return the ObjectInfo about the object. Throws an exception if it doesn't exist.
void Datacratic::S3Api::init | ( | const std::string & | accessKeyId, |
const std::string & | accessKey, | ||
double | bandwidthToServiceMbps = defaultBandwidthToServiceMbps , |
||
const std::string & | defaultProtocol = "http" , |
||
const std::string & | serviceUri = "s3.amazonaws.com" |
||
) |
S3Api::MultiPartUpload Datacratic::S3Api::obtainMultiPartUpload | ( | const std::string & | bucket, |
const std::string & | resource, | ||
const ObjectMetadata & | metadata | ||
) | const |
std::pair< std::string, std::string > Datacratic::S3Api::parseUri | ( | const std::string & | uri | ) | [static] |
S3Api::Response Datacratic::S3Api::post | ( | const std::string & | bucket, |
const std::string & | resource, | ||
const std::string & | subResource = "" , |
||
const StrPairVector & | headers = StrPairVector() , |
||
const StrPairVector & | queryParams = StrPairVector() , |
||
const Content & | content = Content() |
||
) | const |
S3Api::SignedRequest Datacratic::S3Api::prepare | ( | const RequestParams & | request | ) | const |
S3Api::Response Datacratic::S3Api::put | ( | const std::string & | bucket, |
const std::string & | resource, | ||
const std::string & | subResource = "" , |
||
const StrPairVector & | headers = StrPairVector() , |
||
const StrPairVector & | queryParams = StrPairVector() , |
||
const Content & | content = Content() |
||
) | const |
std::string Datacratic::S3Api::sign | ( | const std::string & | stringToSign, |
const std::string & | accessKey | ||
) | [static] |
std::string Datacratic::S3Api::signature | ( | const RequestParams & | request | ) | const |
std::auto_ptr< std::streambuf > Datacratic::S3Api::streamingDownload | ( | const std::string & | bucket, |
const std::string & | object, | ||
ssize_t | startOffset = 0 , |
||
ssize_t | endOffset = -1 , |
||
const OnChunk & | onChunk = OnChunk() |
||
) | const |
std::auto_ptr< std::streambuf > Datacratic::S3Api::streamingDownload | ( | const std::string & | uri, |
ssize_t | startOffset = 0 , |
||
ssize_t | endOffset = -1 , |
||
const OnChunk & | onChunk = OnChunk() |
||
) | const |
std::auto_ptr< std::streambuf > Datacratic::S3Api::streamingUpload | ( | const std::string & | uri, |
const ObjectMetadata & | md = ObjectMetadata() |
||
) | const |
std::auto_ptr< std::streambuf > Datacratic::S3Api::streamingUpload | ( | const std::string & | bucket, |
const std::string & | object, | ||
const ObjectMetadata & | md = ObjectMetadata() |
||
) | const |
S3Api::ObjectInfo Datacratic::S3Api::tryGetObjectInfo | ( | const std::string & | bucket, |
const std::string & | object | ||
) | const |
std::string Datacratic::S3Api::upload | ( | const char * | data, |
size_t | bytes, | ||
const std::string & | bucket, | ||
const std::string & | resource, | ||
CheckMethod | check = CM_SIZE , |
||
const ObjectMetadata & | md = ObjectMetadata() , |
||
int | numInParallel = -1 |
||
) |
Upload a memory buffer into an s3 bucket. Uses a multi-part upload algorithm that can achieve 200MB/second for data already in memory.
If the resource already exists, then it will use the given method to determine whether it's OK or not.
Returns the etag field of the uploaded file.
static OnChunk Datacratic::S3Api::writeToFile | ( | const std::string & | filename | ) | [static] |
OnChunk function that writes to the given file.
double Datacratic::S3Api::defaultBandwidthToServiceMbps = 20.0 [static] |