你知道Google Cloud Storage的好的C / C ++库吗?
我可以找到Python library,但我找不到C / C ++(或Objective-C)。
答案 0 :(得分:1)
有一个Google的图书馆列表(包括目标C)here。
答案 1 :(得分:1)
GCS具有受支持的C ++客户端库。来源在这里:https://github.com/googleapis/google-cloud-cpp
完整的文档在这里:https://cloud.google.com/storage/docs/reference/libraries#client-libraries-install-cpp
下面是一个下载对象并计算行数的示例:
#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;
}
答案 2 :(得分:0)
在Gnome树中有一个用C:
编写的OAuth2库http://git.gnome.org/browse/librest/tree/
这是Gnome的librest包的一部分,这是一个促进REST事务的库。我自己没有用过,但这里有一些观察:
看起来您需要使用automake来构建.configure。文档说只是运行配置脚本,但文档很旧。 它仍在开发中(最近一次检查是2012年12月)。
如果您尝试过,请报告您的经历。 (提前谢谢!)