Replaced the dynamic table type ArtifactLocation with struct keys

The original is present in comment form for reference
This commit is contained in:
Michael Hohn
2024-07-10 13:08:40 -07:00
committed by =Michael Hohn
parent 2df48b9f98
commit 8965725e42
4 changed files with 44 additions and 21 deletions

View File

@@ -56,8 +56,10 @@ 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]
// bucket := location.Data[AF_KEY_BUCKET]
// key := location.Data[AF_KEY_KEY]
bucket := location.Bucket
key := location.Key
objectInfo, err := store.client.StatObject(context.Background(), bucket, key, minio.StatObjectOptions{})
if err != nil {
@@ -76,8 +78,10 @@ func (store *MinIOArtifactStore) SaveResult(jobSpec common.JobSpec, data []byte)
}
func (store *MinIOArtifactStore) getArtifact(location ArtifactLocation) ([]byte, error) {
bucket := location.Data[AF_KEY_BUCKET]
key := location.Data[AF_KEY_KEY]
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 {
@@ -105,10 +109,12 @@ func (store *MinIOArtifactStore) saveArtifact(bucket, key string, data []byte,
// XX: static types
location := ArtifactLocation{
Data: map[string]string{
AF_KEY_BUCKET: bucket,
AF_KEY_KEY: key,
},
Bucket: bucket,
Key: key,
// Data: map[string]string{
// AF_KEY_BUCKET: bucket,
// AF_KEY_KEY: key,
// },
}
return location, nil