Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 28 generic s3 #45

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Storage/Device/BackBlaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Utopia\Storage\Device;

use Utopia\Storage\Device\S3;
use Utopia\Storage\Device\Generic;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a better name for Generic?
Can we use S3 as base instead of creating new Generic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S3 is also one of Generic child's.
Can be S3Base? or S3Compatible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference in S3 itself and Generic? if there is a difference then yes Generic can S3Base - S3Base sounds more reasonable than S3Compatible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


class BackBlaze extends S3

class BackBlaze extends Generic
{
/**
* Regions constants
Expand All @@ -31,8 +32,8 @@ class BackBlaze extends S3
*/
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::US_WEST_004, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl);
$this->headers['host'] = $bucket . '.' . 's3' . '.' . $region . '.backblazeb2.com';
$hostName = $bucket . '.' . 's3' . '.' . $region . '.backblazeb2.com';
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl, $hostName);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions src/Storage/Device/DOSpaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Utopia\Storage\Device;

use Utopia\Storage\Device\S3;
use Utopia\Storage\Device\Generic;

class DOSpaces extends S3

class DOSpaces extends Generic
{
/**
* Regions constants
Expand All @@ -29,8 +30,8 @@ class DOSpaces extends S3
*/
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::NYC3, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl);
$this->headers['host'] = $bucket . '.' . $region . '.digitaloceanspaces.com';
$hostName = $bucket . '.' . $region . '.digitaloceanspaces.com';
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl, $hostName);
}

/**
Expand Down
Loading