diff --git a/pkg/config/config.go b/pkg/config/config.go index 7a6f946..2fb19ff 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -12,7 +12,8 @@ import ( ) type Config struct { - Server *server.Config `yaml:"server"` + DataDir *string `yaml:"data_dir,omitempty"` + Server *server.Config `yaml:"server"` } const ( diff --git a/pkg/server/server.go b/pkg/server/server.go index fe7b266..aa5d478 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -33,7 +33,10 @@ func (s *Server) installRoutes() { } func New(cfg *config.Config) (s *Server, err error) { - b := blas.New(cfg) + b, err := blas.New(cfg) + if err != nil { + return nil, err + } s = &Server{ Blas: b, diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go new file mode 100644 index 0000000..7e2cd13 --- /dev/null +++ b/pkg/storage/storage.go @@ -0,0 +1,28 @@ +package storage + +import ( + "io/fs" +) + +type Data interface { +} + +type Item struct { + Version int `json:"version"` + MinorVersion *int `json:"minor_version,omitempty"` + Key string `json:"key"` + Data Data `json:"data"` +} + +type Store struct { + fs.FS +} + +func Open(dir fs.FS) (*Store, error) { + stor, err := fs.Sub(dir, ".storage") + if err != nil { + return nil, err + } + + return &Store{stor}, nil +}