nextcloud

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNextcloudServerMock

func GetNextcloudServerMock(called *[]string) http.Handler

GetNextcloudServerMock returns a handler that pretends to be a remote Nextcloud server

func New

func New(m map[string]interface{}) (storage.FS, error)

New returns an implementation to of the storage.FS interface that talks to a Nextcloud instance over http.

func TestingHTTPClient

func TestingHTTPClient(handler http.Handler) (*http.Client, func())

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) CreateDir

func (nc *StorageDriver) CreateDir(ctx context.Context, ref *provider.Reference) error

CreateDir 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

CreateStorageSpace creates a storage space

func (*StorageDriver) Delete

func (nc *StorageDriver) Delete(ctx context.Context, ref *provider.Reference) error

Delete as defined in the storage.FS interface

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 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, basePath, 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

ListStorageSpaces as defined in the storage.FS interface

func (*StorageDriver) Move

func (nc *StorageDriver) Move(ctx context.Context, oldRef, newRef *provider.Reference) error

Move 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

func (*StorageDriver) TouchFile

func (nc *StorageDriver) TouchFile(ctx context.Context, ref *provider.Reference) error

TouchFile 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

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/"
	SharedSecret string `mapstructure:"shared_secret"`
	MockHTTP     bool   `mapstructure:"mock_http"`
}

StorageDriverConfig is the configuration struct for a NextcloudStorageDriver

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL