summaryrefslogtreecommitdiff
path: root/internal/storage/storage_interface.go
blob: 91eeedbd9e4fa383a158582b905a404926860a0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package storage

import (
	"io"

	"github.com/SayaAndy/saya-today-article-metadata-add/config"
	"github.com/SayaAndy/saya-today-article-metadata-add/internal/frontmatter"
)

type StorageClient interface {
	Scan() (paths []string, err error)
	GetReader(path string) (reader io.ReadCloser, sz int64, err error)
	WriteMetadata(path string, metadata *frontmatter.Metadata) error
	FileHasChanged(path string) bool
}

var NewStorageClientMap = map[string]func(cfg *config.StorageConfig) (StorageClient, error){
	"b2": NewB2StorageClient,
}