Switch to cc-lib v2

This commit is contained in:
2025-12-24 09:24:18 +01:00
parent 9bf5c5dc1a
commit 8576ae458d
110 changed files with 261 additions and 311 deletions

View File

@@ -85,9 +85,9 @@ import (
"sync"
"github.com/ClusterCockpit/cc-backend/internal/config"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/lrucache"
"github.com/ClusterCockpit/cc-lib/schema"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/ClusterCockpit/cc-lib/v2/lrucache"
"github.com/ClusterCockpit/cc-lib/v2/schema"
)
// Version is the current archive schema version.

View File

@@ -11,8 +11,8 @@ import (
"testing"
"github.com/ClusterCockpit/cc-backend/pkg/archive"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/util"
"github.com/ClusterCockpit/cc-lib/v2/schema"
"github.com/ClusterCockpit/cc-lib/v2/util"
)
var jobs []*schema.Job

View File

@@ -8,8 +8,8 @@ package archive
import (
"fmt"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/ClusterCockpit/cc-lib/v2/schema"
)
var (

View File

@@ -23,9 +23,9 @@ import (
"time"
"github.com/ClusterCockpit/cc-backend/internal/config"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/util"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/ClusterCockpit/cc-lib/v2/schema"
"github.com/ClusterCockpit/cc-lib/v2/util"
"github.com/santhosh-tekuri/jsonschema/v5"
)

View File

@@ -10,8 +10,8 @@ import (
"path/filepath"
"testing"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/util"
"github.com/ClusterCockpit/cc-lib/v2/schema"
"github.com/ClusterCockpit/cc-lib/v2/util"
)
func TestInitEmptyPath(t *testing.T) {

View File

@@ -10,8 +10,8 @@ import (
"io"
"time"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/ClusterCockpit/cc-lib/v2/schema"
)
func DecodeJobData(r io.Reader, k string) (schema.JobData, error) {

View File

@@ -10,7 +10,7 @@ import (
"strconv"
"strings"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
)
type NodeList [][]interface {

View File

@@ -22,9 +22,9 @@ import (
"time"
"github.com/ClusterCockpit/cc-backend/internal/config"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/util"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/ClusterCockpit/cc-lib/v2/schema"
"github.com/ClusterCockpit/cc-lib/v2/util"
"github.com/aws/aws-sdk-go-v2/aws"
awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"

View File

@@ -13,7 +13,7 @@ import (
"strings"
"testing"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/v2/schema"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"

View File

@@ -21,9 +21,9 @@ import (
"time"
"github.com/ClusterCockpit/cc-backend/internal/config"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/util"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/ClusterCockpit/cc-lib/v2/schema"
"github.com/ClusterCockpit/cc-lib/v2/util"
_ "github.com/mattn/go-sqlite3"
)

View File

@@ -9,7 +9,7 @@ import (
"os"
"testing"
"github.com/ClusterCockpit/cc-lib/schema"
"github.com/ClusterCockpit/cc-lib/v2/schema"
)
func TestSqliteInitEmptyPath(t *testing.T) {

View File

@@ -54,7 +54,7 @@ import (
"fmt"
"sync"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
"github.com/nats-io/nats.go"
)

View File

@@ -9,7 +9,7 @@ import (
"bytes"
"encoding/json"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
cclog "github.com/ClusterCockpit/cc-lib/v2/ccLogger"
)
// NatsConfig holds the configuration for connecting to a NATS server.

View File

@@ -1,59 +0,0 @@
// Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
// All rights reserved. This file is part of cc-backend.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package nats
import (
"time"
lp "github.com/ClusterCockpit/cc-lib/ccMessage"
influx "github.com/influxdata/line-protocol/v2/lineprotocol"
)
// DecodeInfluxMessage decodes a single InfluxDB line protocol message from the decoder
// Returns the decoded CCMessage or an error if decoding fails
func DecodeInfluxMessage(d *influx.Decoder) (lp.CCMessage, error) {
measurement, err := d.Measurement()
if err != nil {
return nil, err
}
tags := make(map[string]string)
for {
key, value, err := d.NextTag()
if err != nil {
return nil, err
}
if key == nil {
break
}
tags[string(key)] = string(value)
}
fields := make(map[string]interface{})
for {
key, value, err := d.NextField()
if err != nil {
return nil, err
}
if key == nil {
break
}
fields[string(key)] = value.Interface()
}
t, err := d.Time(influx.Nanosecond, time.Time{})
if err != nil {
return nil, err
}
return lp.NewMessage(
string(measurement),
tags,
nil,
fields,
t,
)
}