diff --git a/Makefile b/Makefile index 44b0b4d..b72942d 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,7 @@ source: # Builds the source package for the app store, ignores php and js tests .PHONY: appstore appstore: + composer install --optimize-autoloader --no-dev rm -rf $(appstore_build_directory) mkdir -p $(appstore_build_directory) tar cvzf $(appstore_package_name).tar.gz \ diff --git a/README.md b/README.md index be4742d..e5d0089 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # Storj NextCloud App -**EXPERIMENTAL** +Adds external storage support for Storj Decentralized Cloud Storage. -A Storj Community contributed decentralized storage backend for Nextcloud built on Storj DCS. +Storj Community contributed. ## Prerequisites +Currently only works on x64. + The PHP installation should have the FFI extension loaded and enabled unconditionally in php.ini: ``` @@ -16,7 +18,7 @@ ffi.enable=true ## Installation -Install from the app store or place this app in the folder `apps` of the nextcloud installation +Install from the [App store](https://apps.nextcloud.com/apps/storj) or place this app in the folder `apps` of the nextcloud installation ## Configuration @@ -72,7 +74,6 @@ or: for integration tests -## Known issues and improvements +## Known issues -- Using external storage is slower than necessary because NextCloud request objects metadata separately during the same HTTP request. This can be improved by caching the results at the initial list operation. -- Under unknown circumstances a segfault seems to occur. +- Enabling Xdebug profiling or debugging will cause a segfault diff --git a/appinfo/info.xml b/appinfo/info.xml index 4d533e9..0896b32 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,9 +3,46 @@ xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> storj Storj - Storage backend built on Storj DCS. - - 0.0.3 + Decentralized storage backend + [ + 'class' => \OCA\Storj\StorjObjectStore::class, + 'arguments' => [ + 'serialized_access' => 'myaccessgrant', + 'bucket' => 'mynextcloudbucket', + ] + ] +]; +``` + +]]> + 0.0.4 agpl Erik van Velzen Storj diff --git a/lib/StorjBackend.php b/lib/StorjBackend.php index c2b07c0..a3cf521 100644 --- a/lib/StorjBackend.php +++ b/lib/StorjBackend.php @@ -2,6 +2,8 @@ namespace OCA\Storj; +use ErrorException; +use Exception; use OCA\Files_External\Lib\DefinitionParameter; use OCA\Files_External\Lib\StorageConfig; use OCP\Files\StorageNotAvailableException; @@ -33,15 +35,29 @@ public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = n $accessGrant = $storage->getBackendOption('serialized_access'); try { - $uplink = Uplink::create(); - $access = $uplink->parseAccess($accessGrant); - $project = $access->openProject(); - $project->ensureBucket($bucket); - } catch (Throwable $exception) { + try { + $uplink = Uplink::create(); + $access = $uplink->parseAccess($accessGrant); + $project = $access->openProject(); + $project->ensureBucket($bucket); + } catch (\Error $e) { + // convert to exception or it will fail type check + throw new ErrorException( + $e->getMessage(), + $e->getCode(), + 1, + $e->getFile(), + $e->getLine(), + $e + ); + } + } catch (Exception $exception) { // Will display important information for the user to fix the problemn throw new StorageNotAvailableException( $exception->getMessage(), - $exception->getCode(), + // code must be nonzero to display error icon + $exception->getCode() ?: 1, + $exception ); } } diff --git a/lib/StorjStorage.php b/lib/StorjStorage.php index 5c04f07..a5e92a7 100644 --- a/lib/StorjStorage.php +++ b/lib/StorjStorage.php @@ -131,7 +131,7 @@ public function rmdir($path): bool $this->project->deleteObject($this->bucket, $object->getKey()); $this->objectInfoCache->remove($object->getKey()); } - + try { $this->project->deleteObject($this->bucket, $path); } catch (Throwable $e) {