This repository was archived by the owner on Nov 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeeper.go
More file actions
41 lines (30 loc) · 1.52 KB
/
keeper.go
File metadata and controls
41 lines (30 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package encryptdb
import "github.com/EncrypteDL/EncryptDB/models"
// 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.
// - When opening a folder of Filers, it should be able to discover and initialize all of them.
// - Additionally, it should be able to confirm the type of the underlying key/value store.
type Keeper interface {
// Path should return the base path where all stores should be stored under. (likely as subdirectories)
Path() string
// Init should initialize our Filer at the given path, to be referenced and called by dataStore.
Init(name string, options ...any) error
// With provides access to the given dataStore by providing a pointer to the related Filer.
With(name string) Filer
// WithNew should initialize a new Filer at the given path and return a pointer to it.
WithNew(name string, options ...any) Filer
// Destroy should remove the Filer by the given name.
// It is up to the implementation to decide if the data should be removed or not.
Destroy(name string) error
Discover() ([]string, error)
AllStores() map[string]Filer
// BackupAll should create a backup of all [Filer] instances in the [Keeper].
BackupAll(archivePath string) (models.Backup, error)
// RestoreAll should restore all [Filer] instances from the given archive.
RestoreAll(archivePath string) error
Meta() models.Metadata
Close(name string) error
CloseAll() error
SyncAll() error
SyncAndCloseAll() error
}