-
Notifications
You must be signed in to change notification settings - Fork 63
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
Added Oracle Object Storage adapter #91
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Utopia\Storage\Device; | ||
|
||
use Exception; | ||
use Utopia\Storage\Device; | ||
use Utopia\Storage\Storage; | ||
|
||
class OracleObject extends Device | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected string $root = 'oracle-object'; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't there be region constants? |
||
/** | ||
* OracleObject constructor. | ||
* | ||
* @param string $root | ||
*/ | ||
public function __construct(string $root = '') | ||
{ | ||
$this->root = $root; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should definitely be more parameters than this like some sort of key and bucket. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return 'Oracle Object Storage'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getType(): string | ||
{ | ||
return Storage::DEVICE_ORACLE_OBJECT; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription(): string | ||
{ | ||
return 'Adapter for Oracle Object Storage.'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getRoot(): string | ||
{ | ||
return $this->root; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,6 +21,8 @@ class Storage | |||||
|
||||||
const DEVICE_LINODE = 'linode'; | ||||||
|
||||||
const DEVICE_ORACLEOBJECT = 'oracleobject'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be
Suggested change
|
||||||
|
||||||
/** | ||||||
* Devices. | ||||||
* | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Utopia\Storage\Device\OracleObject; | ||
|
||
class OracleObjectTest extends TestCase | ||
{ | ||
/** | ||
* @var OracleObject | ||
*/ | ||
private $oracleObject; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->oracleObject = new OracleObject('oracle-object-root'); | ||
} | ||
|
||
public function testUploadFileToOracleObjectStorage() | ||
{ | ||
// Implement your test for the upload method here | ||
$localFilePath = 'local_file.txt'; | ||
$remoteFilePath = 'remote_file.txt'; | ||
|
||
// Call the method you want to test | ||
$result = $this->oracleObject->uploadFileToOracleObjectStorage($localFilePath, $remoteFilePath); | ||
|
||
// Assert that the upload was successful (you can customize this assertion) | ||
$this->assertTrue($result); | ||
} | ||
|
||
public function testDownloadFileFromOracleObjectStorage() | ||
{ | ||
// Implement your test for the download method here | ||
$remoteFilePath = 'remote_file.txt'; | ||
$localFilePath = 'downloaded_file.txt'; | ||
|
||
// Call the method you want to test | ||
$result = $this->oracleObject->downloadFileFromOracleObjectStorage($remoteFilePath, $localFilePath); | ||
|
||
// Assert that the download was successful (you can customize this assertion) | ||
$this->assertTrue($result); | ||
} | ||
|
||
public function testDeleteFileFromOracleObjectStorage() | ||
{ | ||
// Implement your test for the delete method here | ||
$remoteFilePath = 'remote_file.txt'; | ||
|
||
// Call the method you want to test | ||
$result = $this->oracleObject->deleteFileFromOracleObjectStorage($remoteFilePath); | ||
|
||
// Assert that the delete was successful (you can customize this assertion) | ||
$this->assertTrue($result); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably extend the S3 adapter because Oracle Object is an S3-compatible storage provider.