From 58f2b4bb4a0ec8f01fb2a15343afd40861580e4f Mon Sep 17 00:00:00 2001 From: Manuel Wimmer <47821216+mwimmer-bcx@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:33:57 +0000 Subject: [PATCH] added honeycomb storage provider --- src/Storage/Device/Honeycomb.php | 57 ++++++++++++++++++++++++++ src/Storage/Storage.php | 4 +- tests/Storage/Device/HoneycombTest.php | 34 +++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 src/Storage/Device/Honeycomb.php create mode 100644 tests/Storage/Device/HoneycombTest.php diff --git a/src/Storage/Device/Honeycomb.php b/src/Storage/Device/Honeycomb.php new file mode 100644 index 00000000..37d17cc6 --- /dev/null +++ b/src/Storage/Device/Honeycomb.php @@ -0,0 +1,57 @@ +headers['host'] = 's3.honeycomb-cloud.de/'.$bucket; + } + + /** + * @return string + */ + public function getName(): string + { + return 'Honeycomb Storage'; + } + + /** + * @return string + */ + public function getDescription(): string + { + return 'Honeycomb Storage'; + } + + /** + * @return string + */ + public function getType(): string + { + return Storage::DEVICE_HONEYCOMB; + } +} \ No newline at end of file diff --git a/src/Storage/Storage.php b/src/Storage/Storage.php index cabd18c8..40f28487 100644 --- a/src/Storage/Storage.php +++ b/src/Storage/Storage.php @@ -21,6 +21,8 @@ class Storage const DEVICE_LINODE = 'linode'; + const DEVICE_HONEYCOMB = 'honeycomb'; + /** * Devices. * @@ -121,4 +123,4 @@ public static function human(int $bytes, $decimals = 2, $system = 'metric') return sprintf("%.{$decimals}f%s", $bytes / pow($mod, $factor), $units[$system][$factor]); } -} +} \ No newline at end of file diff --git a/tests/Storage/Device/HoneycombTest.php b/tests/Storage/Device/HoneycombTest.php new file mode 100644 index 00000000..5944db5c --- /dev/null +++ b/tests/Storage/Device/HoneycombTest.php @@ -0,0 +1,34 @@ +root = '/root'; + $key = $_SERVER['HONEYCOMB_ACCESS_KEY'] ?? ''; + $secret = $_SERVER['HONEYCOMB_SECRET'] ?? ''; + $bucket = 'utopia-storage-tests'; + + $this->object = new Honeycomb($this->root, $key, $secret, $bucket, Honeycomb::EU_CENTRAL_1, HONEYCOMB::ACL_PRIVATE); + } + + protected function getAdapterName(): string + { + return 'Honeycomb Storage'; + } + + protected function getAdapterType(): string + { + return $this->object->getType(); + } + + protected function getAdapterDescription(): string + { + return 'Honeycomb Storage'; + } +} \ No newline at end of file