Do you know good C/C++ library for Google Cloud Storage?
I can find Python library for it, but I can't find with C/C++ (or Objective-C).
Do you know good C/C++ library for Google Cloud Storage?
I can find Python library for it, but I can't find with C/C++ (or Objective-C).
GCS has a supported C++ client library. The source is here: https://github.com/googleapis/google-cloud-cpp
The full documentation is here: https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-cpp
Here's an example of downloading an object and counting the number of lines:
#include "google/cloud/storage/client.h"
#include <iostream>
namespace gcs = google::cloud::storage;
int countLines(std::string bucket_name, std::string object_name) {
// Create aliases to make the code easier to read.
namespace gcs = google::cloud::storage;
// Create a client to communicate with Google Cloud Storage. This client
// uses the default configuration for authentication and project id.
google::cloud::StatusOr<gcs::Client> client =
gcs::Client::CreateDefaultClient();
if (!client) {
std::cerr << "Failed to create Storage Client, status=" << client.status()
<< "\n";
return 1;
}
gcs::ObjectReadStream stream = client.ReadObject(bucket_name, object_name);
int count = 0;
std::string line;
while (std::getline(stream, line, '\n')) {
++count;
}
return count;
}
In the Gnome tree there is an OAuth2 library written in C:
http://git.gnome.org/browse/librest/tree/
This is part of Gnome's librest package, a library that facilitates REST transactions. I have not used it myself, but here are a few observations:
It looks like you will need to use automake to build a .configure. The docs say to just run the configure script but the docs are pretty old. It is still being developed (the most recent check in was December 2012).
If you do try it please report your experiences. (Thank you in advance!)