new game, fs repo layer
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package repo
|
||||
|
||||
import "github.com/iliadenisov/galaxy/pkg/repo/fs"
|
||||
|
||||
type Storage interface {
|
||||
Lock() (func() error, error)
|
||||
Write(string, []byte) error
|
||||
}
|
||||
|
||||
type repo struct {
|
||||
s Storage
|
||||
}
|
||||
|
||||
func NewRepo(s Storage) (*repo, error) {
|
||||
r := &repo{
|
||||
s: s,
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func NewFileRepo(path string) (*repo, error) {
|
||||
s, err := fs.NewFileStorage(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewRepo(s)
|
||||
}
|
||||
Reference in New Issue
Block a user