Add version to job archive

This commit is contained in:
2023-03-27 13:24:06 +02:00
parent ff8f013b56
commit 8447d011ad
3 changed files with 37 additions and 7 deletions

View File

@@ -8,12 +8,15 @@ import (
"encoding/json"
"fmt"
"github.com/ClusterCockpit/cc-backend/pkg/log"
"github.com/ClusterCockpit/cc-backend/pkg/lrucache"
"github.com/ClusterCockpit/cc-backend/pkg/schema"
)
const Version = 1
type ArchiveBackend interface {
Init(rawConfig json.RawMessage) error
Init(rawConfig json.RawMessage) (int, error)
LoadJobMeta(job *schema.Job) (*schema.JobMeta, error)
@@ -50,9 +53,11 @@ func Init(rawConfig json.RawMessage) error {
return fmt.Errorf("unkown archive backend '%s''", kind.Kind)
}
if err := ar.Init(rawConfig); err != nil {
version, err := ar.Init(rawConfig)
if err != nil {
return err
}
log.Infof("Load archive version %d", version)
return initClusterConfig()
}