Code generalization: request db info from other source: remove unused constants
This commit is contained in:
committed by
=Michael Hohn
parent
52aafd6fc9
commit
e7d32861e5
@@ -29,12 +29,12 @@ func NewMinIOArtifactStore(endpoint, id, secret string) (*MinIOArtifactStore, er
|
||||
slog.Info("Connected to MinIO artifact store server")
|
||||
|
||||
// Create "results" bucket
|
||||
if err := common.CreateMinIOBucketIfNotExists(minioClient, AF_VAL_BUCKET_RESULTS); err != nil {
|
||||
if err := common.CreateMinIOBucketIfNotExists(minioClient, AF_BUCKETNAME_RESULTS); err != nil {
|
||||
return nil, fmt.Errorf("could not create results bucket: %v", err)
|
||||
}
|
||||
|
||||
// Create "packs" bucket
|
||||
if err := common.CreateMinIOBucketIfNotExists(minioClient, AF_VAL_BUCKET_PACKS); err != nil {
|
||||
if err := common.CreateMinIOBucketIfNotExists(minioClient, AF_BUCKETNAME_PACKS); err != nil {
|
||||
return nil, fmt.Errorf("could not create packs bucket: %v", err)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ func (store *MinIOArtifactStore) GetQueryPack(location ArtifactLocation) ([]byte
|
||||
}
|
||||
|
||||
func (store *MinIOArtifactStore) SaveQueryPack(jobId int, data []byte) (ArtifactLocation, error) {
|
||||
return store.saveArtifact(AF_VAL_BUCKET_PACKS, deriveKeyFromSessionId(jobId), data, "application/gzip")
|
||||
// xx: afl use
|
||||
return store.saveArtifact(AF_BUCKETNAME_PACKS, deriveKeyFromSessionId(jobId), data, "application/gzip")
|
||||
}
|
||||
|
||||
func (store *MinIOArtifactStore) GetResult(location ArtifactLocation) ([]byte, error) {
|
||||
@@ -56,8 +57,7 @@ func (store *MinIOArtifactStore) GetResult(location ArtifactLocation) ([]byte, e
|
||||
}
|
||||
|
||||
func (store *MinIOArtifactStore) GetResultSize(location ArtifactLocation) (int, error) {
|
||||
// bucket := location.Data[AF_KEY_BUCKET]
|
||||
// key := location.Data[AF_KEY_KEY]
|
||||
// xx: afl use
|
||||
bucket := location.Bucket
|
||||
key := location.Key
|
||||
|
||||
@@ -74,14 +74,14 @@ func (store *MinIOArtifactStore) GetResultSize(location ArtifactLocation) (int,
|
||||
}
|
||||
|
||||
func (store *MinIOArtifactStore) SaveResult(jobSpec common.JobSpec, data []byte) (ArtifactLocation, error) {
|
||||
return store.saveArtifact(AF_VAL_BUCKET_RESULTS, deriveKeyFromJobSpec(jobSpec), data, "application/zip")
|
||||
// xx: afl use
|
||||
return store.saveArtifact(AF_BUCKETNAME_RESULTS, deriveKeyFromJobSpec(jobSpec), data, "application/zip")
|
||||
}
|
||||
|
||||
func (store *MinIOArtifactStore) getArtifact(location ArtifactLocation) ([]byte, error) {
|
||||
// xx: afl use
|
||||
bucket := location.Bucket
|
||||
key := location.Key
|
||||
// bucket := location.Data[AF_KEY_BUCKET]
|
||||
// key := location.Data[AF_KEY_KEY]
|
||||
|
||||
object, err := store.client.GetObject(context.Background(), bucket, key, minio.GetObjectOptions{})
|
||||
if err != nil {
|
||||
@@ -107,14 +107,11 @@ func (store *MinIOArtifactStore) saveArtifact(bucket, key string, data []byte,
|
||||
return ArtifactLocation{}, err
|
||||
}
|
||||
|
||||
// XX: afl use
|
||||
// XX: static types
|
||||
location := ArtifactLocation{
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
// Data: map[string]string{
|
||||
// AF_KEY_BUCKET: bucket,
|
||||
// AF_KEY_KEY: key,
|
||||
// },
|
||||
}
|
||||
|
||||
return location, nil
|
||||
|
||||
Reference in New Issue
Block a user