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),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u *fakeScalingGroupUpdater) GetScalingGroupImage(ctx context.Context, scalingGroupID string) (string, error) {
|
|
|
|
u.RLock()
|
|
|
|
defer u.RUnlock()
|
|
|
|
return u.scalingGroupImage[scalingGroupID], nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (u *fakeScalingGroupUpdater) SetScalingGroupImage(ctx context.Context, scalingGroupID, imageURI string) error {
|
|
|
|
u.Lock()
|
|
|
|
defer u.Unlock()
|
|
|
|
u.scalingGroupImage[scalingGroupID] = imageURI
|
|
|
|
return nil
|
|
|
|
}
|