awsfs

package
v0.0.0-...-0c00bfe Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchReference = errors.New("no such reference")
	ErrNoSuchEntry     = errors.New("no such entry")
)
View Source
var ErrNotSupported = errors.New("not supported")

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID        string            `dynamodbav:"id"`
	ParentID  string            `dynamodbav:"parent_id"`
	Name      string            `dynamodbav:"name"`
	Type      EntryType         `dynamodbav:"type"`
	Size      int64             `dynamodbav:"size"`
	Modify    time.Time         `dynamodbav:"modify"`
	DeadProps map[string]string `dynamodbav:"dead_props"`
	Version   int               `dynamodbav:"version"`
}

func (Entry) IsDir

func (e Entry) IsDir() bool

type EntryType

type EntryType string
const (
	EntryTypeFile EntryType = "file"
	EntryTypeDir  EntryType = "dir"
)

type FileInfo

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

func (FileInfo) IsDir

func (f FileInfo) IsDir() bool

func (FileInfo) ModTime

func (f FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (f FileInfo) Mode() fs.FileMode

func (FileInfo) Name

func (f FileInfo) Name() string

func (FileInfo) Size

func (f FileInfo) Size() int64

func (FileInfo) Sys

func (f FileInfo) Sys() any

type FileReader

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

func (FileReader) Close

func (f FileReader) Close() error

func (FileReader) DeadProps

func (f FileReader) DeadProps() (map[xml.Name]webdav.Property, error)

func (FileReader) Patch

func (f FileReader) Patch(patches []webdav.Proppatch) ([]webdav.Propstat, error)

func (FileReader) Read

func (f FileReader) Read(p []byte) (n int, err error)

func (FileReader) Readdir

func (f FileReader) Readdir(count int) ([]fs.FileInfo, error)

func (FileReader) Seek

func (f FileReader) Seek(offset int64, whence int) (int64, error)

func (FileReader) Stat

func (f FileReader) Stat() (fs.FileInfo, error)

func (FileReader) Write

func (f FileReader) Write(p []byte) (n int, err error)

type MetadataStore

type MetadataStore struct {
	EntryTableName     string
	ReferenceTableName string
	DynamoDBClient     *dynamodb.Client
}

func (MetadataStore) AddEntry

func (m MetadataStore) AddEntry(ctx context.Context, entry Entry, path string) error

func (MetadataStore) AddReference

func (m MetadataStore) AddReference(ctx context.Context, ref Reference) error

func (MetadataStore) DeleteEntries

func (m MetadataStore) DeleteEntries(ctx context.Context, ids []string, ref Reference) error

func (MetadataStore) GetEntriesByParentID

func (m MetadataStore) GetEntriesByParentID(ctx context.Context, id string) ([]Entry, error)

func (MetadataStore) GetEntry

func (m MetadataStore) GetEntry(ctx context.Context, id string) (Entry, error)

func (MetadataStore) GetReference

func (m MetadataStore) GetReference(ctx context.Context, id string) (Reference, error)

func (MetadataStore) Init

func (m MetadataStore) Init(ctx context.Context) error

func (MetadataStore) UpdateEntry

func (m MetadataStore) UpdateEntry(ctx context.Context, entry Entry) error

func (MetadataStore) UpdateEntryName

func (m MetadataStore) UpdateEntryName(ctx context.Context, entry Entry, ref Reference) error

type PhysicalStore

type PhysicalStore struct {
	BucketName string
	S3Client   *s3.Client
}

func (PhysicalStore) GetObject

func (s PhysicalStore) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, error)

func (PhysicalStore) PutObject

func (s PhysicalStore) PutObject(ctx context.Context, objectKey string, r io.Reader) error

func (PhysicalStore) PutObjectLarge

func (s PhysicalStore) PutObjectLarge(ctx context.Context, objectKey string, r io.Reader) error

type Reference

type Reference struct {
	ID      string            `dynamodbav:"id"`
	Entries map[string]string `dynamodbav:"entries"`
	Version int               `dynamodbav:"version"`
}

type Server

type Server struct {
	MetadataStore MetadataStore
	PhysicalStore PhysicalStore
	TempDir       string
}

func (*Server) Create

func (s *Server) Create(ctx context.Context, path string, flag int, perm os.FileMode, r io.Reader) (os.FileInfo, error)

func (*Server) Mkdir

func (s *Server) Mkdir(ctx context.Context, path string, perm os.FileMode) error

func (*Server) OpenFile

func (s *Server) OpenFile(ctx context.Context, path string, flag int, perm os.FileMode) (webdav.File, error)

func (*Server) RemoveAll

func (s *Server) RemoveAll(ctx context.Context, path string) error

func (*Server) Rename

func (s *Server) Rename(ctx context.Context, oldPath, newPath string) error

func (*Server) Stat

func (s *Server) Stat(ctx context.Context, path string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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