1
0
Fork 0
mirror of https://github.com/Luzifer/preserve.git synced 2024-11-08 14:20:05 +00:00
preserve/pkg/storage/storage.go

25 lines
607 B
Go
Raw Normal View History

// Package storage defines the interface to talk to the storage backends
package storage
import (
"context"
"io"
"time"
)
type (
// Meta contains the metadata to be written / read
Meta struct {
ContentType string
LastCached time.Time
LastModified time.Time
}
// Storage is the interface to implement when building a storage backend
Storage interface {
GetFile(ctx context.Context, cachePath string) (io.ReadSeekCloser, error)
LoadMeta(ctx context.Context, cachePath string) (*Meta, error)
StoreFile(ctx context.Context, cachePath string, metadata *Meta, data io.Reader) error
}
)