Documentation ¶
Index ¶
- func GetNextcloudServerMock(called *[]string) http.Handler
- func New(m map[string]interface{}) (storage.FS, error)
- func TestingHTTPClient(handler http.Handler) (*http.Client, func())
- type Action
- type Response
- type StorageDriver
- func (nc *StorageDriver) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
- func (nc *StorageDriver) CreateDir(ctx context.Context, ref *provider.Reference) error
- func (nc *StorageDriver) CreateHome(ctx context.Context) error
- func (nc *StorageDriver) CreateReference(ctx context.Context, path string, targetURI *url.URL) error
- func (nc *StorageDriver) CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error)
- func (nc *StorageDriver) Delete(ctx context.Context, ref *provider.Reference) error
- func (nc *StorageDriver) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) error
- func (nc *StorageDriver) DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error
- func (nc *StorageDriver) Download(ctx context.Context, ref *provider.Reference) (io.ReadCloser, error)
- func (nc *StorageDriver) DownloadRevision(ctx context.Context, ref *provider.Reference, key string) (io.ReadCloser, error)
- func (nc *StorageDriver) EmptyRecycle(ctx context.Context, ref *provider.Reference) error
- func (nc *StorageDriver) GetHome(ctx context.Context) (string, error)
- func (nc *StorageDriver) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error)
- func (nc *StorageDriver) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []string) (*provider.ResourceInfo, error)
- func (nc *StorageDriver) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error)
- func (nc *StorageDriver) GetQuota(ctx context.Context, ref *provider.Reference) (uint64, uint64, error)
- func (nc *StorageDriver) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, ...) (map[string]string, error)
- func (nc *StorageDriver) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string) ([]*provider.ResourceInfo, error)
- func (nc *StorageDriver) ListGrants(ctx context.Context, ref *provider.Reference) ([]*provider.Grant, error)
- func (nc *StorageDriver) ListRecycle(ctx context.Context, ref *provider.Reference, key string, relativePath string) ([]*provider.RecycleItem, error)
- func (nc *StorageDriver) ListRevisions(ctx context.Context, ref *provider.Reference) ([]*provider.FileVersion, error)
- func (nc *StorageDriver) ListStorageSpaces(ctx context.Context, f []*provider.ListStorageSpacesRequest_Filter) ([]*provider.StorageSpace, error)
- func (nc *StorageDriver) Move(ctx context.Context, oldRef, newRef *provider.Reference) error
- func (nc *StorageDriver) PurgeRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string) error
- func (nc *StorageDriver) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
- func (nc *StorageDriver) RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
- func (nc *StorageDriver) RestoreRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string, ...) error
- func (nc *StorageDriver) RestoreRevision(ctx context.Context, ref *provider.Reference, key string) error
- func (nc *StorageDriver) SetArbitraryMetadata(ctx context.Context, ref *provider.Reference, md *provider.ArbitraryMetadata) error
- func (nc *StorageDriver) SetHTTPClient(c *http.Client)
- func (nc *StorageDriver) SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
- func (nc *StorageDriver) Shutdown(ctx context.Context) error
- func (nc *StorageDriver) TouchFile(ctx context.Context, ref *provider.Reference) error
- func (nc *StorageDriver) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
- func (nc *StorageDriver) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Reference, keys []string) error
- func (nc *StorageDriver) UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
- func (nc *StorageDriver) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error)
- func (nc *StorageDriver) Upload(ctx context.Context, ref *provider.Reference, r io.ReadCloser) error
- type StorageDriverConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNextcloudServerMock ¶
GetNextcloudServerMock returns a handler that pretends to be a remote Nextcloud server
func New ¶
New returns an implementation to of the storage.FS interface that talks to a Nextcloud instance over http.
func TestingHTTPClient ¶
TestingHTTPClient thanks to https://itnext.io/how-to-stub-requests-to-remote-hosts-with-go-6c2c1db32bf2 Ideally, this function would live in tests/helpers, but if we put it there, it gets excluded by .dockerignore, and the Docker build fails (see https://github.com/cs3org/reva/issues/1999) So putting it here for now - open to suggestions if someone knows a better way to inject this.
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
Action describes a REST request to forward to the Nextcloud backend
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response contains data for the Nextcloud mock server to respond and to switch to a new server state
type StorageDriver ¶
type StorageDriver struct {
// contains filtered or unexported fields
}
StorageDriver implements the storage.FS interface and connects with a StorageDriver server as its backend
func NewStorageDriver ¶
func NewStorageDriver(c *StorageDriverConfig) (*StorageDriver, error)
NewStorageDriver returns a new NextcloudStorageDriver
func (*StorageDriver) AddGrant ¶
func (nc *StorageDriver) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
AddGrant as defined in the storage.FS interface
func (*StorageDriver) CreateHome ¶
func (nc *StorageDriver) CreateHome(ctx context.Context) error
CreateHome as defined in the storage.FS interface
func (*StorageDriver) CreateReference ¶
func (nc *StorageDriver) CreateReference(ctx context.Context, path string, targetURI *url.URL) error
CreateReference as defined in the storage.FS interface
func (*StorageDriver) CreateStorageSpace ¶
func (nc *StorageDriver) CreateStorageSpace(ctx context.Context, req *provider.CreateStorageSpaceRequest) (*provider.CreateStorageSpaceResponse, error)
CreateStorageSpace creates a storage space
func (*StorageDriver) DeleteStorageSpace ¶
func (nc *StorageDriver) DeleteStorageSpace(ctx context.Context, req *provider.DeleteStorageSpaceRequest) error
DeleteStorageSpace deletes a storage space
func (*StorageDriver) DenyGrant ¶
func (nc *StorageDriver) DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error
DenyGrant as defined in the storage.FS interface
func (*StorageDriver) Download ¶
func (nc *StorageDriver) Download(ctx context.Context, ref *provider.Reference) (io.ReadCloser, error)
Download as defined in the storage.FS interface
func (*StorageDriver) DownloadRevision ¶
func (nc *StorageDriver) DownloadRevision(ctx context.Context, ref *provider.Reference, key string) (io.ReadCloser, error)
DownloadRevision as defined in the storage.FS interface
func (*StorageDriver) EmptyRecycle ¶
EmptyRecycle as defined in the storage.FS interface
func (*StorageDriver) GetHome ¶
func (nc *StorageDriver) GetHome(ctx context.Context) (string, error)
GetHome as defined in the storage.FS interface
func (*StorageDriver) GetLock ¶
func (nc *StorageDriver) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error)
GetLock returns an existing lock on the given reference
func (*StorageDriver) GetMD ¶
func (nc *StorageDriver) GetMD(ctx context.Context, ref *provider.Reference, mdKeys []string) (*provider.ResourceInfo, error)
GetMD as defined in the storage.FS interface
func (*StorageDriver) GetPathByID ¶
func (nc *StorageDriver) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error)
GetPathByID as defined in the storage.FS interface
func (*StorageDriver) GetQuota ¶
func (nc *StorageDriver) GetQuota(ctx context.Context, ref *provider.Reference) (uint64, uint64, error)
GetQuota as defined in the storage.FS interface
func (*StorageDriver) InitiateUpload ¶
func (nc *StorageDriver) InitiateUpload(ctx context.Context, ref *provider.Reference, uploadLength int64, metadata map[string]string) (map[string]string, error)
InitiateUpload as defined in the storage.FS interface
func (*StorageDriver) ListFolder ¶
func (nc *StorageDriver) ListFolder(ctx context.Context, ref *provider.Reference, mdKeys []string) ([]*provider.ResourceInfo, error)
ListFolder as defined in the storage.FS interface
func (*StorageDriver) ListGrants ¶
func (nc *StorageDriver) ListGrants(ctx context.Context, ref *provider.Reference) ([]*provider.Grant, error)
ListGrants as defined in the storage.FS interface
func (*StorageDriver) ListRecycle ¶
func (nc *StorageDriver) ListRecycle(ctx context.Context, ref *provider.Reference, key string, relativePath string) ([]*provider.RecycleItem, error)
ListRecycle as defined in the storage.FS interface
func (*StorageDriver) ListRevisions ¶
func (nc *StorageDriver) ListRevisions(ctx context.Context, ref *provider.Reference) ([]*provider.FileVersion, error)
ListRevisions as defined in the storage.FS interface
func (*StorageDriver) ListStorageSpaces ¶
func (nc *StorageDriver) ListStorageSpaces(ctx context.Context, f []*provider.ListStorageSpacesRequest_Filter) ([]*provider.StorageSpace, error)
ListStorageSpaces as defined in the storage.FS interface
func (*StorageDriver) PurgeRecycleItem ¶
func (nc *StorageDriver) PurgeRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string) error
PurgeRecycleItem as defined in the storage.FS interface
func (*StorageDriver) RefreshLock ¶
func (nc *StorageDriver) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
RefreshLock refreshes an existing lock on the given reference
func (*StorageDriver) RemoveGrant ¶
func (nc *StorageDriver) RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
RemoveGrant as defined in the storage.FS interface
func (*StorageDriver) RestoreRecycleItem ¶
func (nc *StorageDriver) RestoreRecycleItem(ctx context.Context, ref *provider.Reference, key, relativePath string, restoreRef *provider.Reference) error
RestoreRecycleItem as defined in the storage.FS interface
func (*StorageDriver) RestoreRevision ¶
func (nc *StorageDriver) RestoreRevision(ctx context.Context, ref *provider.Reference, key string) error
RestoreRevision as defined in the storage.FS interface
func (*StorageDriver) SetArbitraryMetadata ¶
func (nc *StorageDriver) SetArbitraryMetadata(ctx context.Context, ref *provider.Reference, md *provider.ArbitraryMetadata) error
SetArbitraryMetadata as defined in the storage.FS interface
func (*StorageDriver) SetHTTPClient ¶
func (nc *StorageDriver) SetHTTPClient(c *http.Client)
SetHTTPClient sets the HTTP client
func (*StorageDriver) SetLock ¶
func (nc *StorageDriver) SetLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
SetLock puts a lock on the given reference
func (*StorageDriver) Shutdown ¶
func (nc *StorageDriver) Shutdown(ctx context.Context) error
Shutdown as defined in the storage.FS interface
func (*StorageDriver) Unlock ¶
func (nc *StorageDriver) Unlock(ctx context.Context, ref *provider.Reference, lock *provider.Lock) error
Unlock removes an existing lock from the given reference
func (*StorageDriver) UnsetArbitraryMetadata ¶
func (nc *StorageDriver) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Reference, keys []string) error
UnsetArbitraryMetadata as defined in the storage.FS interface
func (*StorageDriver) UpdateGrant ¶
func (nc *StorageDriver) UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error
UpdateGrant as defined in the storage.FS interface
func (*StorageDriver) UpdateStorageSpace ¶
func (nc *StorageDriver) UpdateStorageSpace(ctx context.Context, req *provider.UpdateStorageSpaceRequest) (*provider.UpdateStorageSpaceResponse, error)
UpdateStorageSpace updates a storage space
func (*StorageDriver) Upload ¶
func (nc *StorageDriver) Upload(ctx context.Context, ref *provider.Reference, r io.ReadCloser) error
Upload as defined in the storage.FS interface
type StorageDriverConfig ¶
type StorageDriverConfig struct { EndPoint string `mapstructure:"endpoint"` // e.g. "http://nc/apps/sciencemesh/~alice/" MockHTTP bool `mapstructure:"mock_http"` }
StorageDriverConfig is the configuration struct for a NextcloudStorageDriver