fs

package
v0.0.0-...-c858694 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package fs implements an in-memory user store backed by a virtual filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func NewStore

func NewStore(root webdav.FileSystem) (*Store, error)

NewStore creates an in-memory user store backed by a virtual filesystem root for storage.

func (*Store) Create

func (s *Store) Create(ctx context.Context, user users.User) error

Create creates the specified user. UserSpec must specify a valid (i.e., non-zero) user. It returns os.ErrExist if the user already exists.

func (*Store) Get

func (s *Store) Get(_ context.Context, user users.UserSpec) (users.User, error)

Get fetches the specified user.

func (*Store) InsertByCanonicalMe

func (s *Store) InsertByCanonicalMe(ctx context.Context, user users.User) (users.User, error)

InsertByCanonicalMe inserts a user identified by the CanonicalMe field into the user store. If a user with the same CanonicalMe value doesn't exist yet, a new user is created. Otherwise, the existing user is updated. CanonicalMe must not be empty.

The user ID must be 0 and domain must be non-empty. The returned user keeps the same domain and gets assigned a unique persistent non-zero ID.

Jump to

Keyboard shortcuts

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