Skip to content

Commit

Permalink
Fix: unmarshalling of backups from meta.json
Browse files Browse the repository at this point in the history
  • Loading branch information
yunginnanet committed Jul 4, 2024
1 parent 42a604c commit 7f71ab5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bitcask/bitcask_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (db *DB) BackupAll(archivePath string) (models.Backup, error) {
return nil, err
}
if db.meta.Backups == nil {
db.meta.Backups = make(map[string]models.Backup)
db.meta.Backups = make(map[string]any)
}
db.meta.Backups[bu.FilePath] = bu
err = db.meta.Sync()
Expand Down
18 changes: 9 additions & 9 deletions metadata/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (
// This is critical for migrating data between [Keeper]s.
// The only absolute requirement is that the [Type] field is set.
type Metadata struct {
KeeperType string `json:"type"`
Created time.Time `json:"created,omitempty"`
LastOpened time.Time `json:"last_opened,omitempty"`
KnownStores []string `json:"stores,omitempty"`
Backups map[string]models.Backup `json:"backups,omitempty"`
Extra map[string]interface{} `json:"extra,omitempty"`
DefStoreOpts any `json:"default_store_opts,omitempty"`
KeeperType string `json:"type"`
Created time.Time `json:"created,omitempty"`
LastOpened time.Time `json:"last_opened,omitempty"`
KnownStores []string `json:"stores,omitempty"`
Backups map[string]any `json:"backups,omitempty"`
Extra map[string]interface{} `json:"extra,omitempty"`
DefStoreOpts any `json:"default_store_opts,omitempty"`
w io.WriteSeeker
path string
}
Expand Down Expand Up @@ -62,7 +62,7 @@ func NewMeta(keeperType KeeperType) *Metadata {
Created: time.Now(),
LastOpened: time.Now(),
KnownStores: make([]string, 0),
Backups: make(map[string]models.Backup),
Backups: make(map[string]any),
}
}

Expand Down Expand Up @@ -94,7 +94,7 @@ func NewMetaFile(keeperType, path string) (*Metadata, error) {
Created: time.Now(),
LastOpened: time.Now(),
KnownStores: make([]string, 0),
Backups: make(map[string]models.Backup),
Backups: make(map[string]any),
path: path,
}
stat, err := os.Stat(path)
Expand Down
2 changes: 1 addition & 1 deletion pogreb/pogreb_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (db *DB) BackupAll(archivePath string) (models.Backup, error) {
return nil, err
}
if db.meta.Backups == nil {
db.meta.Backups = make(map[string]models.Backup)
db.meta.Backups = make(map[string]any)
}
db.meta.Backups[bu.FilePath] = bu
err = db.meta.Sync()
Expand Down

0 comments on commit 7f71ab5

Please sign in to comment.