datasource

package
v0.2.44 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0, MIT Imports: 54 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionsToCLIFlags

func OptionsToCLIFlags(regInfo *fs.RegInfo) *cli.Command

Types

type DefaultHandlerResolver

type DefaultHandlerResolver struct {
}

func (DefaultHandlerResolver) Resolve

type EmptyReadCloser

type EmptyReadCloser struct{}

EmptyReadCloser is a ReadCloser that always returns EOF.

func (*EmptyReadCloser) Close

func (e *EmptyReadCloser) Close() error

func (*EmptyReadCloser) Read

func (e *EmptyReadCloser) Read(p []byte) (n int, err error)

type Entry

type Entry struct {
	Error error
	Info  fs.Object
}

Entry is a struct that represents a single item during a data source scan

type Handler

type Handler interface {
	// List lists the items at the given path.
	List(ctx context.Context, path string) ([]fs.DirEntry, error)

	// Scan scans the data source starting at the given path and returns a channel of entries.
	// The `last` parameter is used to resume scanning from the last entry returned by a previous scan. It is exclusive.
	// The returned entries must be sorted by path in ascending order.
	Scan(ctx context.Context, path string, last string) <-chan Entry

	// Check checks the size and last modified time of the item at the given path.
	Check(ctx context.Context, path string) (fs.DirEntry, error)

	ReadHandler
}

Handler is an interface for scanning, reading, opening, and checking items in a data source.

type HandlerResolver

type HandlerResolver interface {
	Resolve(ctx context.Context, source model.Source) (Handler, error)
}

type RCloneHandler

type RCloneHandler struct {
	fs.Fs
}

func NewRCloneHandler

func NewRCloneHandler(ctx context.Context, source model.Source) (*RCloneHandler, error)

func (RCloneHandler) Check

func (h RCloneHandler) Check(ctx context.Context, path string) (fs.DirEntry, error)

func (RCloneHandler) List

func (h RCloneHandler) List(ctx context.Context, path string) ([]fs.DirEntry, error)

func (RCloneHandler) Read

func (h RCloneHandler) Read(ctx context.Context, path string, offset int64, length int64) (io.ReadCloser, fs.Object, error)

func (RCloneHandler) Scan

func (h RCloneHandler) Scan(ctx context.Context, path string, last string) <-chan Entry

type ReadHandler added in v0.1.0

type ReadHandler interface {
	// Read reads data from the data source starting at the given path and offset, and returns a ReadCloser.
	// The `length` parameter specifies the number of bytes to read.
	// This method is most likely used for retrieving a single block of data.
	Read(ctx context.Context, path string, offset int64, length int64) (io.ReadCloser, fs.Object, error)
}

Jump to

Keyboard shortcuts

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