nextcloud

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(ctx context.Context, 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 CreateReferenceRequest added in v1.26.0

type CreateReferenceRequest struct {
	Path string `json:"path"`
	URL  string `json:"url"`
}

type GetMDRequest added in v1.26.0

type GetMDRequest struct {
	Ref    *provider.Reference `json:"ref"`
	MdKeys []string            `json:"mdKeys"`
}

type GrantRequest added in v1.26.0

type GrantRequest struct {
	Ref *provider.Reference `json:"ref"`
	G   *provider.Grant     `json:"g"`
}

type InitiateUploadRequest added in v1.26.0

type InitiateUploadRequest struct {
	Ref          *provider.Reference `json:"ref"`
	UploadLength int64               `json:"uploadLength"`
	Metadata     map[string]string   `json:"metadata"`
}

type ListRecycleRequest added in v1.26.0

type ListRecycleRequest struct {
	Key  string `json:"key"`
	Path string `json:"path"`
}

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 MoveRequest struct {
	OldRef *provider.Reference `json:"oldRef"`
	NewRef *provider.Reference `json:"newRef"`
}

type PurgeRecycleItemRequest added in v1.26.0

type PurgeRecycleItemRequest struct {
	Key  string `json:"key"`
	Path string `json:"path"`
}

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 RestoreRecycleItemRequest struct {
	Key        string              `json:"key"`
	Path       string              `json:"path"`
	RestoreRef *provider.Reference `json:"restoreRef"`
}

type RestoreRevisionRequest added in v1.26.0

type RestoreRevisionRequest struct {
	Ref *provider.Reference `json:"ref"`
	Key string              `json:"key"`
}

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

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. Obviously we don't shutdown the EFSS...

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, _ map[string]string) error

Upload as defined in the storage.FS interface. The metadata parameters (e.g. lock context) are ignored.

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.

type UnsetArbitraryMetadataRequest added in v1.26.0

type UnsetArbitraryMetadataRequest struct {
	Ref  *provider.Reference `json:"ref"`
	Keys []string            `json:"keys"`
}

Jump to

Keyboard shortcuts

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