filewriter

package
v0.76.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 2 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

This section is empty.

Types

type BackupManager

type BackupManager interface {
	CreateBackup(ctx context.Context, originalPath string) (string, error)
	RestoreBackup(ctx context.Context, backupPath string, originalPath string) error
	CleanupBackup(backupPath string) error
}

BackupManager handles file backup operations

type ChunkManager

type ChunkManager interface {
	WriteChunk(ctx context.Context, req ChunkWriteRequest) error
	FinalizeChunks(ctx context.Context, sessionID string, targetPath string) (*WriteResult, error)
	CleanupSession(sessionID string) error
	GetSessionInfo(sessionID string) (*ChunkSessionInfo, error)
}

ChunkManager defines the interface for handling chunked file writes

type ChunkSessionInfo

type ChunkSessionInfo struct {
	SessionID      string
	TotalChunks    int
	ReceivedChunks int
	TempPath       string
	Created        bool
}

ChunkSessionInfo provides information about an active chunk session

type ChunkWriteRequest

type ChunkWriteRequest struct {
	SessionID  string
	ChunkIndex int
	Data       []byte
	IsLast     bool
}

ChunkWriteRequest represents a chunk write operation

type FileWriter

type FileWriter interface {
	Write(ctx context.Context, req WriteRequest) (*WriteResult, error)
	ValidatePath(path string) error
}

FileWriter defines the interface for file writing operations

type PathValidator

type PathValidator interface {
	Validate(path string) error
	IsWritable(path string) bool
	IsInSandbox(path string) bool
}

PathValidator validates file paths for security and accessibility

type StreamWriter

type StreamWriter interface {
	io.Writer
	io.Closer
	Sync() error
	Path() string
}

StreamWriter provides streaming write capabilities

type WriteRequest

type WriteRequest struct {
	Path      string
	Content   string
	Overwrite bool
	Backup    bool
}

WriteRequest represents a file write operation request

type WriteResult

type WriteResult struct {
	Path         string
	BytesWritten int64
	BackupPath   string
	Created      bool
}

WriteResult represents the result of a file write operation

Jump to

Keyboard shortcuts

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