Files
photocli/internal/manifest/manifest.go
T
Ein Anderssono 7555b561bd
pipeline / build (push) Has been cancelled
pipeline / test (push) Has been cancelled
v0.9.0: add manifest checksums
2026-06-15 02:19:47 +02:00

52 lines
972 B
Go

package manifest
import "time"
type Entry struct {
ID string
Filename string
Path string
Size int64
Cloud string
Checksum string
Exported int64
}
type Manifest interface {
Has(id string) bool
Add(id string, filename string, size int64, cloud string)
AddEntry(entry Entry)
Save() error
Close()
OpenAppend() error
}
type EntryReader interface {
Entries() map[string]Entry
}
func newEntry(id, filename string, size int64, cloud string) Entry {
return Entry{
ID: id,
Filename: filename,
Path: filename,
Size: size,
Cloud: cloud,
Exported: time.Now().Unix(),
}
}
func NewEntry(id, filename, path string, size int64, cloud string) Entry {
e := newEntry(id, filename, size, cloud)
if path != "" {
e.Path = path
}
return e
}
func NewEntryWithChecksum(id, filename, path string, size int64, cloud, checksum string) Entry {
e := NewEntry(id, filename, path, size, cloud)
e.Checksum = checksum
return e
}