about summary refs log tree commit diff
path: root/src/libstore/s3-binary-cache-store.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-21T14·02+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-21T14·08+0200
commitd155d8015578c43953e4a9d1867e49c0b71534d7 (patch)
treebbadff08b737660f6aa44a37e4b46a31a02d1fcb /src/libstore/s3-binary-cache-store.hh
parent1a714952732c56b4735f65dea49d406aacc7c595 (diff)
Move S3BinaryCacheStore from Hydra
This allows running arbitrary Nix commands against an S3 binary cache.

To do: make this a compile time option to prevent a dependency on
aws-sdk-cpp.
Diffstat (limited to 'src/libstore/s3-binary-cache-store.hh')
-rw-r--r--src/libstore/s3-binary-cache-store.hh34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libstore/s3-binary-cache-store.hh b/src/libstore/s3-binary-cache-store.hh
new file mode 100644
index 000000000000..0425f6bb95d9
--- /dev/null
+++ b/src/libstore/s3-binary-cache-store.hh
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "binary-cache-store.hh"
+
+#include <atomic>
+
+namespace nix {
+
+class S3BinaryCacheStore : public BinaryCacheStore
+{
+protected:
+
+    S3BinaryCacheStore(std::shared_ptr<Store> localStore,
+        const Path & secretKeyFile)
+        : BinaryCacheStore(localStore, secretKeyFile)
+    { }
+
+public:
+
+    struct Stats
+    {
+        std::atomic<uint64_t> put{0};
+        std::atomic<uint64_t> putBytes{0};
+        std::atomic<uint64_t> putTimeMs{0};
+        std::atomic<uint64_t> get{0};
+        std::atomic<uint64_t> getBytes{0};
+        std::atomic<uint64_t> getTimeMs{0};
+        std::atomic<uint64_t> head{0};
+    };
+
+    const Stats & getS3Stats();
+};
+
+}