2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-06-29 10:47:13 -04:00
|
|
|
package controllers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
type fakeScalingGroupUpdater struct {
|
|
|
|
sync.RWMutex
|
|
|
|
scalingGroupImage map[string]string
|
|
|
|
}
|
|
|
|
|
|
|
|
func newFakeScalingGroupUpdater() *fakeScalingGroupUpdater {
|
|
|
|
return &fakeScalingGroupUpdater{
|
|
|
|
scalingGroupImage: make(map[string]string),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-20 06:03:36 -04:00
|
|
|
func (u *fakeScalingGroupUpdater) GetScalingGroupImage(_ context.Context, scalingGroupID string) (string, error) {
|
2022-06-29 10:47:13 -04:00
|
|
|
u.RLock()
|
|
|
|
defer u.RUnlock()
|
|
|
|
return u.scalingGroupImage[scalingGroupID], nil
|
|
|
|
}
|
|
|
|
|
2023-03-20 06:03:36 -04:00
|
|
|
func (u *fakeScalingGroupUpdater) SetScalingGroupImage(_ context.Context, scalingGroupID, imageURI string) error {
|
2022-06-29 10:47:13 -04:00
|
|
|
u.Lock()
|
|
|
|
defer u.Unlock()
|
|
|
|
u.scalingGroupImage[scalingGroupID] = imageURI
|
|
|
|
return nil
|
|
|
|
}
|