Documentation ¶
Index ¶
- Constants
- type InstanceCache
- func (c *InstanceCache) Add(instance InstanceInfo, newlyCreated bool) error
- func (c *InstanceCache) Count() int
- func (c *InstanceCache) CountForTeam(teamID uuid.UUID) (count uint)
- func (c *InstanceCache) Exists(instanceID string) bool
- func (c *InstanceCache) Get(instanceID string) (*ttlcache.Item[string, InstanceInfo], error)
- func (c *InstanceCache) GetInstance(instanceID string) (InstanceInfo, error)
- func (c *InstanceCache) GetInstances(teamID *uuid.UUID) (instances []InstanceInfo)
- func (c *InstanceCache) KeepAliveFor(instanceID string, duration time.Duration, allowShorter bool) (*InstanceInfo, error)
- func (c *InstanceCache) Kill(instanceID string)
- func (c *InstanceCache) Reserve(instanceID string, team uuid.UUID, limit int64) (error, func())
- func (c *InstanceCache) Sync(instances []*InstanceInfo)
- func (c *InstanceCache) UpdateCounters(instance InstanceInfo, value int64, newlyCreated bool)
- type InstanceInfo
- type Reservation
- type ReservationCache
Constants ¶
View Source
const ( InstanceExpiration = time.Second * 15 CacheSyncTime = time.Minute * 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstanceCache ¶
type InstanceCache struct {
// contains filtered or unexported fields
}
func NewCache ¶
func NewCache(analytics analyticscollector.AnalyticsCollectorClient, logger *zap.SugaredLogger, deleteInstance func(data InstanceInfo, purge bool) *api.APIError, initialInstances []*InstanceInfo) *InstanceCache
func (*InstanceCache) Add ¶
func (c *InstanceCache) Add(instance InstanceInfo, newlyCreated bool) error
Add the instance to the cache and start expiration timer. If the instance already exists we do nothing - it was loaded from Orchestrator.
func (*InstanceCache) Count ¶
func (c *InstanceCache) Count() int
func (*InstanceCache) CountForTeam ¶
func (c *InstanceCache) CountForTeam(teamID uuid.UUID) (count uint)
func (*InstanceCache) Exists ¶
func (c *InstanceCache) Exists(instanceID string) bool
Check if the instance exists in the cache.
func (*InstanceCache) Get ¶
func (c *InstanceCache) Get(instanceID string) (*ttlcache.Item[string, InstanceInfo], error)
Get the item from the cache.
func (*InstanceCache) GetInstance ¶
func (c *InstanceCache) GetInstance(instanceID string) (InstanceInfo, error)
GetInstance from the cache.
func (*InstanceCache) GetInstances ¶
func (c *InstanceCache) GetInstances(teamID *uuid.UUID) (instances []InstanceInfo)
func (*InstanceCache) KeepAliveFor ¶
func (c *InstanceCache) KeepAliveFor(instanceID string, duration time.Duration, allowShorter bool) (*InstanceInfo, error)
KeepAliveFor the instance's expiration timer.
func (*InstanceCache) Kill ¶
func (c *InstanceCache) Kill(instanceID string)
Kill the instance and remove it from the cache.
func (*InstanceCache) Sync ¶
func (c *InstanceCache) Sync(instances []*InstanceInfo)
func (*InstanceCache) UpdateCounters ¶
func (c *InstanceCache) UpdateCounters(instance InstanceInfo, value int64, newlyCreated bool)
type InstanceInfo ¶
type Reservation ¶
type Reservation struct {
// contains filtered or unexported fields
}
type ReservationCache ¶
type ReservationCache struct {
// contains filtered or unexported fields
}
func NewReservationCache ¶
func NewReservationCache() *ReservationCache
Click to show internal directories.
Click to hide internal directories.