datboxcore

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: GPL-3.0 Imports: 7 Imported by: 2

README

datbox-core

Core types of "datbox" for implementing providers

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoggerExists = errors.New("Logger already exists")
)

Functions

This section is empty.

Types

type Logger

type Logger struct {
	Name string
}

func DefaultLogger

func DefaultLogger() *Logger

func NewLogger

func NewLogger(name string) (*Logger, error)

func (*Logger) Debug

func (logger *Logger) Debug(a ...any)

func (*Logger) Debugf

func (logger *Logger) Debugf(format string, a ...any)

func (*Logger) Error

func (logger *Logger) Error(a ...any)

func (*Logger) Errorf

func (logger *Logger) Errorf(format string, a ...any)

func (*Logger) Fatal

func (logger *Logger) Fatal(a ...any)

func (*Logger) Fatalf

func (logger *Logger) Fatalf(format string, a ...any)

func (*Logger) Info

func (logger *Logger) Info(a ...any)

func (*Logger) Infof

func (logger *Logger) Infof(format string, a ...any)

func (*Logger) Print

func (logger *Logger) Print(a ...any)

func (*Logger) Printf

func (logger *Logger) Printf(format string, a ...any)

func (*Logger) Println

func (logger *Logger) Println(a ...any)

func (*Logger) Warn

func (logger *Logger) Warn(a ...any)

func (*Logger) Warnf

func (logger *Logger) Warnf(format string, a ...any)

type Progress added in v0.2.0

type Progress struct {
	StartTime     time.Time
	CurrentBytes  int64
	TotalBytes    int64
	CurrentChunks int
	TotalChunks   int
}

type Provider

type Provider interface {
	Get(path string, writer io.WriteCloser, progressCallback func(progress Progress)) error            // Get a file at the path and write to the writer
	Put(path string, size int64, reader io.ReadCloser, progressCallback func(progress Progress)) error // Put a file to the path using the reader

	List(path string) ([]fs.DirEntry, error)          // List files under a directory
	Move(src, dst string) error                       // Move file from src to dst
	Delete(path string, recursive, remote bool) error // Delete file at the path, optionally recursively and remotely
	Mkdir(path string, parents bool) error            // Create a directory, optionally create parents if they don't exist
	Copy(src, dst string) error                       // Copy file (reference) from src to dst

	Info() (ProviderInfo, error) // Fetch info of the provider
}

type ProviderInfo

type ProviderInfo struct {
	Root        string // Root path of the file system of this provider
	Encrypted   bool   // Whether the provider is encrypting uploaded files
	StoredFiles uint   // Number of files stored within this provider
	StoredBytes uint   // Total bytes of files stored within this provider
}

Jump to

Keyboard shortcuts

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