2016-02-18 16:18:50 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "binary-cache-store.hh"
|
|
|
|
|
|
|
|
namespace Aws { namespace Client { class ClientConfiguration; } }
|
|
|
|
namespace Aws { namespace S3 { class S3Client; } }
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
class S3BinaryCacheStore : public BinaryCacheStore
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
std::string bucketName;
|
|
|
|
|
|
|
|
ref<Aws::Client::ClientConfiguration> config;
|
|
|
|
ref<Aws::S3::S3Client> client;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-02-18 17:31:19 +01:00
|
|
|
S3BinaryCacheStore(const StoreFactory & storeFactory,
|
2016-02-18 16:18:50 +01:00
|
|
|
const Path & secretKeyFile, const Path & publicKeyFile,
|
|
|
|
const std::string & bucketName);
|
|
|
|
|
|
|
|
void init() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
ref<Aws::Client::ClientConfiguration> makeConfig();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool fileExists(const std::string & path) override;
|
|
|
|
|
|
|
|
void upsertFile(const std::string & path, const std::string & data) override;
|
|
|
|
|
|
|
|
std::string getFile(const std::string & path) override;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|