Documentation
¶
Index ¶
- func CalculateFileMD5(filePath string) (string, error)
- func CalculateStreamMD5(r io.Reader) (string, error)
- func DefaultCachePath() string
- type Checker
- type FileInfo
- type RemoteChecker
- type SQLiteCache
- func (c *SQLiteCache) Check(ctx context.Context, md5Hash string) (*Upload, error)
- func (c *SQLiteCache) Close() error
- func (c *SQLiteCache) FindByFilename(ctx context.Context, filename string) ([]*Upload, error)
- func (c *SQLiteCache) FindByRemoteID(ctx context.Context, service, remoteID string) (*Upload, error)
- func (c *SQLiteCache) GetThumbnail(ctx context.Context, md5Hash string) (*Thumbnail, error)
- func (c *SQLiteCache) Record(upload *Upload) error
- func (c *SQLiteCache) SaveThumbnail(thumb *Thumbnail) error
- type Thumbnail
- type Upload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateFileMD5 ¶
CalculateFileMD5 computes the MD5 hash of a file
func CalculateStreamMD5 ¶
CalculateStreamMD5 computes the MD5 hash from a reader
func DefaultCachePath ¶
func DefaultCachePath() string
DefaultCachePath returns the default cache database path
Types ¶
type Checker ¶
type Checker interface {
// Check looks for an existing upload by file hash
Check(ctx context.Context, filePath string) (*Upload, error)
// Record saves an upload to the cache
Record(upload *Upload) error
}
Checker provides duplicate detection functionality
type FileInfo ¶
FileInfo contains file metadata used for duplicate detection
func GetFileInfo ¶
GetFileInfo retrieves file information including MD5 hash
type RemoteChecker ¶
type RemoteChecker struct {
// contains filtered or unexported fields
}
RemoteChecker implements duplicate checking with local cache only
func NewRemoteChecker ¶
func NewRemoteChecker(cache *SQLiteCache, service string) *RemoteChecker
NewRemoteChecker creates a new checker with cache
func SetupFlickrDuplicateChecker ¶
func SetupFlickrDuplicateChecker(cfg *config.FlickrConfig) (*RemoteChecker, error)
SetupFlickrDuplicateChecker creates a duplicate checker for Flickr (local cache only)
func SetupSmugMugDuplicateChecker ¶
func SetupSmugMugDuplicateChecker(cfg *config.SmugMugConfig) (*RemoteChecker, error)
SetupSmugMugDuplicateChecker creates a duplicate checker for SmugMug (local cache only)
func (*RemoteChecker) Close ¶
func (r *RemoteChecker) Close() error
Close closes the underlying cache connection
func (*RemoteChecker) Record ¶
func (r *RemoteChecker) Record(upload *Upload) error
Record saves an upload to the cache
func (*RemoteChecker) SetService ¶
func (r *RemoteChecker) SetService(service string)
SetService changes the active service
type SQLiteCache ¶
type SQLiteCache struct {
// contains filtered or unexported fields
}
SQLiteCache implements local duplicate checking via SQLite
func NewSQLiteCache ¶
func NewSQLiteCache(dbPath string) (*SQLiteCache, error)
NewSQLiteCache creates a new SQLite-based cache
func (*SQLiteCache) Close ¶
func (c *SQLiteCache) Close() error
Close closes the database connection
func (*SQLiteCache) FindByFilename ¶
FindByFilename searches for uploads with matching filename
func (*SQLiteCache) FindByRemoteID ¶
func (c *SQLiteCache) FindByRemoteID(ctx context.Context, service, remoteID string) (*Upload, error)
FindByRemoteID looks up an upload by service and remote ID
func (*SQLiteCache) GetThumbnail ¶ added in v0.8.0
GetThumbnail retrieves a cached thumbnail by MD5 hash
func (*SQLiteCache) Record ¶
func (c *SQLiteCache) Record(upload *Upload) error
Record saves an upload to the cache
func (*SQLiteCache) SaveThumbnail ¶ added in v0.8.0
func (c *SQLiteCache) SaveThumbnail(thumb *Thumbnail) error
SaveThumbnail stores a thumbnail in the cache