filewriter

package
v0.90.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 2 Imported by: 0

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