database/keeper.go

22 lines
910 B
Go
Raw Normal View History

2022-01-09 03:01:15 +00:00
package database
// Keeper will be in charge of the more meta operations involving Filers.
// This includes operations like initialization, syncing to disk if applicable, and backing up.
type Keeper interface {
2022-01-19 09:46:51 +00:00
// Path should return the base path where all stores should be stored under. (likely as subdirectories)
2022-01-09 03:01:15 +00:00
Path() string
2022-01-19 09:46:51 +00:00
// Init should initialize our Filer at the given path, to be referenced and called by storeName.
Init(storeName string) error
// With provides access to the given storeName by providing a pointer to the related Filer.
With(storeName string) Filer
// Close should safely end any Filer operations of the given storeName and close any relevant handlers.
Close(storeName string) error
2022-01-09 03:01:15 +00:00
// Sync should take any volatile data and solidify it somehow if relevant. (ram to disk in most cases)
2022-01-19 09:46:51 +00:00
Sync(storeName string) error
2022-01-09 03:01:15 +00:00
// TODO: Backups
CloseAll() error
SyncAll() error
}