storage

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateCS3

func AuthenticateCS3(ctx context.Context, su config.ServiceUser, tm token.Manager) (token string, err error)

AuthenticateCS3 mints an auth token for communicating with cs3 storage based on a service user from config

func IsNotFoundErr

func IsNotFoundErr(e error) bool

IsNotFoundErr can be returned by repo Load and Delete operations

func MakeDirIfNotExist

func MakeDirIfNotExist(ctx context.Context, sp provider.ProviderAPIClient, folder string) error

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

Types

type CS3Repo

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

CS3Repo provides a cs3 implementation of the Repo interface

func (CS3Repo) DeleteAccount

func (r CS3Repo) DeleteAccount(ctx context.Context, id string) (err error)

DeleteAccount deletes an account via cs3 by id

func (CS3Repo) DeleteGroup

func (r CS3Repo) DeleteGroup(ctx context.Context, id string) (err error)

DeleteGroup deletes a group via cs3 by id

func (CS3Repo) LoadAccount

func (r CS3Repo) LoadAccount(ctx context.Context, id string, a *proto.Account) (err error)

LoadAccount loads an account via cs3 by id and writes it to the provided account

func (CS3Repo) LoadAccounts

func (r CS3Repo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err error)

LoadAccounts loads all the accounts from the cs3 api

func (CS3Repo) LoadGroup

func (r CS3Repo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err error)

LoadGroup loads a group via cs3 by id and writes it to the provided group

func (CS3Repo) LoadGroups

func (r CS3Repo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)

LoadGroups loads all the groups from the cs3 api

func (CS3Repo) WriteAccount

func (r CS3Repo) WriteAccount(ctx context.Context, a *proto.Account) (err error)

WriteAccount writes an account via cs3 and modifies the provided account (e.g. with a generated id).

func (CS3Repo) WriteGroup

func (r CS3Repo) WriteGroup(ctx context.Context, g *proto.Group) (err error)

WriteGroup writes a group via cs3 and modifies the provided group (e.g. with a generated id).

type DiskRepo

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

DiskRepo provides a local filesystem implementation of the Repo interface

func NewDiskRepo

func NewDiskRepo(cfg *config.Config, log olog.Logger) DiskRepo

NewDiskRepo creates a new disk repo

func (DiskRepo) DeleteAccount

func (r DiskRepo) DeleteAccount(ctx context.Context, id string) (err error)

DeleteAccount from the local filesystem

func (DiskRepo) DeleteGroup

func (r DiskRepo) DeleteGroup(ctx context.Context, id string) (err error)

DeleteGroup from the local filesystem

func (DiskRepo) LoadAccount

func (r DiskRepo) LoadAccount(ctx context.Context, id string, a *proto.Account) (err error)

LoadAccount from the local filesystem

func (DiskRepo) LoadAccounts

func (r DiskRepo) LoadAccounts(ctx context.Context, a *[]*proto.Account) (err error)

LoadAccounts loads all the accounts from the local filesystem

func (DiskRepo) LoadGroup

func (r DiskRepo) LoadGroup(ctx context.Context, id string, g *proto.Group) (err error)

LoadGroup from the local filesystem

func (DiskRepo) LoadGroups

func (r DiskRepo) LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)

LoadGroups loads all the groups from the local filesystem

func (DiskRepo) WriteAccount

func (r DiskRepo) WriteAccount(ctx context.Context, a *proto.Account) (err error)

WriteAccount to the local filesystem

func (DiskRepo) WriteGroup

func (r DiskRepo) WriteGroup(ctx context.Context, g *proto.Group) (err error)

WriteGroup to the local filesystem

type Repo

type Repo interface {
	WriteAccount(ctx context.Context, a *proto.Account) (err error)
	LoadAccount(ctx context.Context, id string, a *proto.Account) (err error)
	LoadAccounts(ctx context.Context, a *[]*proto.Account) (err error)
	DeleteAccount(ctx context.Context, id string) (err error)
	WriteGroup(ctx context.Context, g *proto.Group) (err error)
	LoadGroup(ctx context.Context, id string, g *proto.Group) (err error)
	LoadGroups(ctx context.Context, g *[]*proto.Group) (err error)
	DeleteGroup(ctx context.Context, id string) (err error)
}

Repo defines the storage operations

func NewCS3Repo

func NewCS3Repo(cfg *config.Config) (Repo, error)

NewCS3Repo creates a new cs3 repo

Jump to

Keyboard shortcuts

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