Save state

This commit is contained in:
Jan Eitzinger 2023-04-18 07:43:21 +02:00
parent a8980c7a5e
commit 7c2171afda
4 changed files with 53 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"addr": "127.0.0.1:8080",
"archive": {
"job-archive": {
"kind": "file",
"path": "./var/job-archive"
},

View File

@ -30,6 +30,8 @@ type ArchiveBackend interface {
GetClusters() []string
CleanUp() error
Iter(loadMetricData bool) <-chan JobContainer
}

View File

@ -147,6 +147,10 @@ func (fsa *FsArchive) Init(rawConfig json.RawMessage) (uint64, error) {
return version, nil
}
func (fsa *FsArchive) CleanUp() error {
}
func (fsa *FsArchive) LoadJobData(job *schema.Job) (schema.JobData, error) {
var isCompressed bool = true
filename := getPath(job, fsa.path, "data.json.gz")

View File

@ -3,7 +3,7 @@
"$id": "embedfs://config.schema.json",
"title": "cc-backend configuration file schema",
"type": "object",
"properties":{
"properties": {
"addr": {
"description": "Address where the http (or https) server will listen on (for example: 'localhost:80').",
"type": "string"
@ -41,8 +41,51 @@
"type": "string"
},
"job-archive": {
"description": "Path to the job-archive.",
"type": "string"
"description": "Configuration keys for job-archive",
"type": "object",
"properties": {
"kind": {
"description": "Backend type for job-archive",
"type": "string",
"enum": [
"file",
"s3"
]
},
"path": {
"description": "Path to job archive for file backend",
"type": "string"
},
"retention": {
"description": "Configuration keys for retention",
"type": "object",
"properties": {
"policy": {
"description": "Retention policy",
"type": "string",
"enum": [
"none",
"delete",
"move"
]
},
"time": {
"description": "Act on jobs with startTime older than time",
"type": "integer"
},
"directory": {
"description": "The target directory for retention. Only applicable for retention move.",
"type": "string"
}
},
"required": [
"policy"
]
}
},
"required": [
"kind"
]
},
"disable-archive": {
"description": "Keep all metric data in the metric data repositories, do not write to the job-archive.",