Documentation ¶
Index ¶
- func GetNextcloudServerMock(called *[]string) http.Handler
- func New(ctx context.Context, m map[string]interface{}) (storage.FS, error)
- func TestingHTTPClient(handler http.Handler) (*http.Client, func())
- type CreateReferenceRequest
- type GetMDRequest
- type GrantRequest
- type InitiateUploadRequest
- type ListRecycleRequest
- type MDFromEFSS
- type MoveRequest
- type PurgeRecycleItemRequest
- type Response
- type RestoreRecycleItemRequest
- type RestoreRevisionRequest
- type SetArbitraryMetadataRequest
- 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) 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) 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, _ *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, basePath, key, 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, basePath, 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, basePath, 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
- type UnsetArbitraryMetadataRequest
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 CreateReferenceRequest ¶ added in v1.26.0
type GetMDRequest ¶ added in v1.26.0
type GrantRequest ¶ added in v1.26.0
type InitiateUploadRequest ¶ added in v1.26.0
type ListRecycleRequest ¶ added in v1.26.0
type MDFromEFSS ¶ added in v1.26.0
type MDFromEFSS struct { Type int `json:"type"` ID struct { OpaqueID string `json:"opaque_id"` } `json:"id"` Checksum struct { Type int `json:"type"` Sum string `json:"sum"` } `json:"checksum"` Etag string `json:"etag"` MimeType string `json:"mime_type"` Mtime struct { Seconds int `json:"seconds"` } `json:"mtime"` Path string `json:"path"` Permissions int `json:"permissions"` Size int `json:"size"` CanonicalMetadata struct { Target any `json:"target"` } `json:"canonical_metadata"` ArbitraryMetadata struct { Metadata struct { Placeholder string `json:".placeholder"` } `json:"metadata"` } `json:"arbitrary_metadata"` Owner struct { OpaqueID string `json:"opaque_id"` Idp string `json:"idp"` } `json:"owner"` }
MDFromEFSS is returned by the EFSS to represent a resource.
type MoveRequest ¶ added in v1.26.0
type PurgeRecycleItemRequest ¶ added in v1.26.0
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 RestoreRecycleItemRequest ¶ added in v1.26.0
type RestoreRevisionRequest ¶ added in v1.26.0
type SetArbitraryMetadataRequest ¶ added in v1.26.0
type SetArbitraryMetadataRequest struct { Ref *provider.Reference `json:"ref"` Md *provider.ArbitraryMetadata `json:"md"` }
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) 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 ¶
func (nc *StorageDriver) EmptyRecycle(ctx context.Context) error
EmptyRecycle as defined in the storage.FS interface.
func (*StorageDriver) GetHome ¶
func (nc *StorageDriver) GetHome(ctx context.Context) (string, error)
GetHome should return the home path of the given user. As it is not implemented in the EFSS API, we return an empty string.
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, _ *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, basePath, key, relativePath string, from, to *types.Timestamp) ([]*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, basePath, 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, existingLockID string) 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, basePath, 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. Obviously we don't shutdown the EFSS...
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.