1
0
Fork 0
mirror of https://github.com/Luzifer/preserve.git synced 2024-11-08 06:10:02 +00:00
preserve/pkg/storage/storage.go
Knut Ahlers bf88873cc1
Modernize code, update dependencies
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-12-29 17:58:30 +01:00

24 lines
607 B
Go

// 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
}
)