metadata

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CS3

type CS3 struct {
	SpaceRoot *provider.ResourceId
	// contains filtered or unexported fields
}

CS3 represents a metadata storage with a cs3 storage backend

func (*CS3) Backend

func (cs3 *CS3) Backend() string

Backend returns the backend name of the storage

func (cs3 *CS3) CreateSymlink(ctx context.Context, oldname, newname string) error

CreateSymlink creates a symlink

func (*CS3) Delete

func (cs3 *CS3) Delete(ctx context.Context, path string) error

Delete deletes a path

func (*CS3) Init

func (cs3 *CS3) Init(ctx context.Context, spaceid string) (err error)

Init creates the metadata space

func (*CS3) MakeDirIfNotExist

func (cs3 *CS3) MakeDirIfNotExist(ctx context.Context, folder string) error

MakeDirIfNotExist will create a root node in the metadata storage. Requires an authenticated context.

func (*CS3) ReadDir

func (cs3 *CS3) ReadDir(ctx context.Context, path string) ([]string, error)

ReadDir returns the entries in a given directory

func (cs3 *CS3) ResolveSymlink(ctx context.Context, name string) (string, error)

ResolveSymlink resolves a symlink

func (*CS3) SimpleDownload

func (cs3 *CS3) SimpleDownload(ctx context.Context, downloadpath string) (content []byte, err error)

SimpleDownload reads a file from the metadata storage

func (*CS3) SimpleUpload

func (cs3 *CS3) SimpleUpload(ctx context.Context, uploadpath string, content []byte) error

SimpleUpload uploads a file to the metadata storage

type Disk

type Disk struct {
	// contains filtered or unexported fields
}

Disk represents a disk metadata storage

func (*Disk) Backend

func (disk *Disk) Backend() string

Backend returns the backend name of the storage

func (disk *Disk) CreateSymlink(_ context.Context, oldname, newname string) error

CreateSymlink creates a symlink

func (*Disk) Delete

func (disk *Disk) Delete(_ context.Context, path string) error

Delete deletes a path

func (*Disk) Init

func (disk *Disk) Init(_ context.Context, _ string) (err error)

Init creates the metadata space

func (*Disk) MakeDirIfNotExist

func (disk *Disk) MakeDirIfNotExist(_ context.Context, path string) error

MakeDirIfNotExist will create a root node in the metadata storage. Requires an authenticated context.

func (*Disk) ReadDir

func (disk *Disk) ReadDir(_ context.Context, p string) ([]string, error)

ReadDir returns the resource infos in a given directory

func (disk *Disk) ResolveSymlink(_ context.Context, path string) (string, error)

ResolveSymlink resolves a symlink

func (*Disk) SimpleDownload

func (disk *Disk) SimpleDownload(_ context.Context, downloadpath string) ([]byte, error)

SimpleDownload reads a file from disk

func (*Disk) SimpleUpload

func (disk *Disk) SimpleUpload(_ context.Context, uploadpath string, content []byte) error

SimpleUpload stores a file on disk

type Storage

type Storage interface {
	Backend() string

	Init(ctx context.Context, name string) (err error)
	SimpleUpload(ctx context.Context, uploadpath string, content []byte) error
	SimpleDownload(ctx context.Context, path string) ([]byte, error)
	Delete(ctx context.Context, path string) error

	ReadDir(ctx context.Context, path string) ([]string, error)

	CreateSymlink(ctx context.Context, oldname, newname string) error
	ResolveSymlink(ctx context.Context, name string) (string, error)

	MakeDirIfNotExist(ctx context.Context, name string) error
}

Storage is the interface to maintain metadata in a storage

func NewCS3Storage

func NewCS3Storage(gwAddr, providerAddr, serviceUserID, serviceUserIDP, machineAuthAPIKey string) (s Storage, err error)

NewCS3Storage returns a new cs3 storage instance

func NewDiskStorage

func NewDiskStorage(dataDir string) (s Storage, err error)

NewDiskStorage returns a new disk storage instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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