filestore

package
v0.1.21-0...-e75468c Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStateTokenMismatch = errors.New("state token mismatch")

Functions

This section is empty.

Types

type DriveFileStore

type DriveFileStore struct {
	Logger utils.Logger
	// contains filtered or unexported fields
}

File store that uses Google Drive.

func (*DriveFileStore) DeleteAllFiles

func (d *DriveFileStore) DeleteAllFiles() error

func (*DriveFileStore) DeleteFile

func (d *DriveFileStore) DeleteFile(file string) error

func (*DriveFileStore) FileExists

func (d *DriveFileStore) FileExists(path string) (bool, error)

func (*DriveFileStore) GetFileContents

func (d *DriveFileStore) GetFileContents(path string) (io.ReadCloser, error)

func (*DriveFileStore) GetFiles

func (d *DriveFileStore) GetFiles() ([]*StoredFile, error)

func (*DriveFileStore) GetModifiedTime

func (d *DriveFileStore) GetModifiedTime(path string) (time.Time, error)

func (*DriveFileStore) WriteFileContents

func (d *DriveFileStore) WriteFileContents(path string, reader io.Reader) error

type FileStore

type FileStore interface {
	// GetFiles returns the list of file that are stored in this file store.
	GetFiles() ([]*StoredFile, error)
	// GetFileContents returns the contents of the file that are stored in this file store.
	GetFileContents(path string) (io.ReadCloser, error)
	// WriteFileContents writes the contents to the file store. Creates the file if it doesn't exist. Also creates any
	// parent directories that do not exist.
	WriteFileContents(path string, contentReader io.Reader) error
	// DeleteFile deletes the file in this file store.
	DeleteFile(path string) error
	// DeleteAllFiles deletes all files in this file store.
	DeleteAllFiles() error
	// GetModifiedTime returns the time the file was last modified.
	GetModifiedTime(path string) (time.Time, error)
	// FileExists returns true if the file exists in this file store.
	FileExists(path string) (bool, error)
}

type LocalFileStore

type LocalFileStore struct{}

For accessing local files.

func (*LocalFileStore) DeleteAllFiles

func (l *LocalFileStore) DeleteAllFiles() error

func (*LocalFileStore) DeleteFile

func (l *LocalFileStore) DeleteFile(path string) error

func (*LocalFileStore) FileExists

func (l *LocalFileStore) FileExists(path string) (bool, error)

func (*LocalFileStore) GetFileContents

func (l *LocalFileStore) GetFileContents(path string) (io.ReadCloser, error)

func (*LocalFileStore) GetFiles

func (l *LocalFileStore) GetFiles() ([]*StoredFile, error)

func (*LocalFileStore) GetModifiedTime

func (l *LocalFileStore) GetModifiedTime(path string) (time.Time, error)

func (*LocalFileStore) WriteFileContents

func (l *LocalFileStore) WriteFileContents(path string, contentReader io.Reader) error

type StoredFile

type StoredFile struct {
	Path  string
	IsDir bool
}

Jump to

Keyboard shortcuts

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