local

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// Optional parameters.
	ioStorage.Options
	// contains filtered or unexported fields
}

Reader represents local storage reader.

func NewReader

func NewReader(ctx context.Context, opts ...ioStorage.Opt) (*Reader, error)

NewReader creates a new local directory/file Reader. Must be called with WithDir(path string) or WithFile(path string) - mandatory. Can be called with WithValidator(v validator) - optional.

func (*Reader) GetNumber

func (r *Reader) GetNumber() int64

GetNumber returns the number of asb/asbx files/dirs that was initialized.

func (*Reader) GetSize

func (r *Reader) GetSize() int64

GetSize returns the size of asb/asbx file/dir that was initialized.

func (*Reader) GetType

func (r *Reader) GetType() string

GetType returns the type of the reader.

func (*Reader) ListObjects

func (r *Reader) ListObjects(ctx context.Context, path string) ([]string, error)

ListObjects list all object in the path.

func (*Reader) SetObjectsToStream

func (r *Reader) SetObjectsToStream(list []string)

SetObjectsToStream sets objects to stream.

func (*Reader) StreamFile

func (r *Reader) StreamFile(
	ctx context.Context, filename string, readersCh chan<- models.File, errorsCh chan<- error)

StreamFile opens single file and sends io.Readers to the `readersCh` In case of an error, it is sent to the `errorsCh` channel.

func (*Reader) StreamFiles

func (r *Reader) StreamFiles(
	ctx context.Context, readersCh chan<- models.File, errorsCh chan<- error,
)

StreamFiles reads file/directory from disk and sends io.Readers to the `readersCh` communication channel for lazy loading. In case of an error, it is sent to the `errorsCh` channel.

type Writer

type Writer struct {
	// Optional parameters.
	ioStorage.Options
	// contains filtered or unexported fields
}

Writer represents a local storage writer.

func NewWriter

func NewWriter(ctx context.Context, opts ...ioStorage.Opt) (*Writer, error)

NewWriter creates a new writer for local directory/file writes. Must be called with WithDir(path string) or WithFile(path string) - mandatory. Can be called with WithRemoveFiles() - optional.

func (*Writer) GetType

func (w *Writer) GetType() string

GetType returns the `localType` type of storage. Used in logging.

func (*Writer) NewWriter

func (w *Writer) NewWriter(ctx context.Context, fileName string) (io.WriteCloser, error)

NewWriter creates a new backup file in the given directory. The file name is based on the specified fileName.

func (*Writer) Remove

func (w *Writer) Remove(ctx context.Context, targetPath string) error

Remove deletes the file or directory contents specified by path.

func (*Writer) RemoveFiles

func (w *Writer) RemoveFiles(ctx context.Context) error

RemoveFiles removes a backup file or files from directory.

Jump to

Keyboard shortcuts

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