mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-01-13 13:09:05 +01:00
Start to port API
This commit is contained in:
parent
77d550ca4b
commit
578a270932
@ -4,10 +4,73 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
package archive
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/log"
|
||||
"github.com/ClusterCockpit/cc-backend/pkg/schema"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
)
|
||||
|
||||
type S3ArchiveConfig struct {
|
||||
Path string `json:"filePath"`
|
||||
Endpoint string `json:"endpoint"`
|
||||
AccessKeyID string `json:"accessKeyID"`
|
||||
SecretAccessKey string `json:"secretAccessKey"`
|
||||
UseSSL bool `json:"useSSL"`
|
||||
}
|
||||
|
||||
type S3Archive struct {
|
||||
path string
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) Init(rawConfig json.RawMessage) (uint64, error) {
|
||||
var config S3ArchiveConfig
|
||||
if err := json.Unmarshal(rawConfig, &config); err != nil {
|
||||
log.Warnf("Init() > Unmarshal error: %#v", err)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
client, err := minio.New(config.Endpoint, &minio.Options{
|
||||
Creds: credentials.NewStaticV4(config.AccessKeyID, config.SecretAccessKey, ""),
|
||||
Secure: config.UseSSL,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
return 0, err
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) Info() {
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) Exists(job *schema.Job) bool {
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) LoadJobMeta(job *schema.Job) (*schema.JobMeta, error) {
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) LoadJobData(job *schema.Job) (schema.JobData, error) {
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) LoadClusterCfg(name string) (*schema.Cluster, error) {
|
||||
}
|
||||
|
||||
func (s3a *S3Archive) StoreJobMeta(jobMeta *schema.JobMeta) error
|
||||
|
||||
func (s3a *S3Archive) ImportJob(jobMeta *schema.JobMeta, jobData *schema.JobData) error
|
||||
|
||||
func (s3a *S3Archive) GetClusters() []string
|
||||
|
||||
func (s3a *S3Archive) CleanUp(jobs []*schema.Job)
|
||||
|
||||
func (s3a *S3Archive) Move(jobs []*schema.Job, path string)
|
||||
|
||||
func (s3a *S3Archive) Clean(before int64, after int64)
|
||||
|
||||
func (s3a *S3Archive) Compress(jobs []*schema.Job)
|
||||
|
||||
func (s3a *S3Archive) CompressLast(starttime int64) int64
|
||||
|
||||
func (s3a *S3Archive) Iter(loadMetricData bool) <-chan JobContainer
|
||||
|
Loading…
Reference in New Issue
Block a user