48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package archiver
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.nakama.town/fmartingr/hako/internal/model"
|
|
"git.nakama.town/fmartingr/hako/internal/storage"
|
|
)
|
|
|
|
// Archiver defines the interface for archival tools
|
|
type Archiver interface {
|
|
// Key returns the unique identifier for this archiver
|
|
Key() string
|
|
|
|
// Name returns the human-readable name for this archiver
|
|
Name() string
|
|
|
|
// IsEnabled checks if this archiver is available and can be used
|
|
IsEnabled(ctx context.Context) bool
|
|
|
|
// Archive performs the archival operation
|
|
Archive(ctx context.Context, link *model.Link, storage storage.Storage) (*ArchiveResult, error)
|
|
|
|
// GetDefaultConfig returns the default configuration for this archiver
|
|
GetDefaultConfig() any
|
|
|
|
// ApplyConfig applies the provided configuration to the archiver
|
|
// The config parameter should be a map[string]any with archiver-specific settings
|
|
ApplyConfig(config map[string]any) error
|
|
|
|
// Init initializes the archiver on startup
|
|
Init() error
|
|
}
|
|
|
|
// ArchiveResult represents the result of an archival operation
|
|
type ArchiveResult struct {
|
|
Title string
|
|
Files []FileInfo
|
|
}
|
|
|
|
// FileInfo contains metadata about an archived file
|
|
type FileInfo struct {
|
|
Filename string
|
|
MimeType string
|
|
FileSize int64
|
|
HashSha256 string
|
|
Path string // Storage path
|
|
}
|