-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdae7bf
commit 58f2b4b
Showing
3 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Utopia\Storage\Device; | ||
|
||
use Utopia\Storage\Storage; | ||
|
||
class Honeycomb extends S3 | ||
{ | ||
/** | ||
* Regions constants | ||
*/ | ||
|
||
//atm there is only one region. new regions will appear soon. | ||
const EU_CENTRAL_1 = 'eu-de-fsn'; | ||
|
||
/** | ||
* Honeycomb Constructor | ||
* | ||
* @param string $root | ||
* @param string $accessKey | ||
* @param string $secretKey | ||
* @param string $bucket | ||
* @param string $region | ||
* @param string $acl | ||
*/ | ||
|
||
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::EU_CENTRAL_1, string $acl = self::ACL_PRIVATE) | ||
{ | ||
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl); | ||
//https://s3.honeycomb-cloud.de/bucketname | ||
$this->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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Utopia\Tests\Storage\Device; | ||
|
||
use Utopia\Storage\Device\Honeycomb; | ||
use Utopia\Tests\Storage\S3Base; | ||
|
||
class HoneycombTest extends S3Base | ||
{ | ||
protected function init(): void | ||
{ | ||
$this->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'; | ||
} | ||
} |