Documentation ¶
Index ¶
- Constants
- func GetTaskResourceManager(r pluginCore.ResourceManager, ...) pluginCore.ResourceManager
- func NewRedisClient(ctx context.Context, config config.RedisConfig) (*redis.Client, error)
- type Builder
- type Metrics
- type NoopResourceManager
- type NoopResourceManagerBuilder
- func (r *NoopResourceManagerBuilder) BuildResourceManager(ctx context.Context) (pluginCore.ResourceManager, error)
- func (r *NoopResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
- func (r *NoopResourceManagerBuilder) ResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
- type Proxy
- type RedisResourceManager
- type RedisResourceManagerBuilder
- func (r *RedisResourceManagerBuilder) BuildResourceManager(ctx context.Context) (pluginCore.ResourceManager, error)
- func (r *RedisResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
- func (r *RedisResourceManagerBuilder) ResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
- type RedisResourceManagerMetrics
- type Resource
- type ResourceRegistrarProxy
- type TokenPrefix
Constants ¶
View Source
const RedisSetKeyPrefix = "resourcemanager"
This is the key that will point to the Redis Set. https://redis.io/commands#set
Variables ¶
This section is empty.
Functions ¶
func GetTaskResourceManager ¶
func GetTaskResourceManager(r pluginCore.ResourceManager, resourceNamespacePrefix pluginCore.ResourceNamespace, allocationTokenPrefix TokenPrefix) pluginCore.ResourceManager
func NewRedisClient ¶
Types ¶
type Builder ¶
type Builder interface { ResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar BuildResourceManager(ctx context.Context) (pluginCore.ResourceManager, error) }
type NoopResourceManager ¶
type NoopResourceManager struct { }
func (*NoopResourceManager) AllocateResource ¶
func (*NoopResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) ( pluginCore.AllocationStatus, error)
func (*NoopResourceManager) ReleaseResource ¶
func (*NoopResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) error
type NoopResourceManagerBuilder ¶
type NoopResourceManagerBuilder struct { }
func (*NoopResourceManagerBuilder) BuildResourceManager ¶
func (r *NoopResourceManagerBuilder) BuildResourceManager(ctx context.Context) (pluginCore.ResourceManager, error)
func (*NoopResourceManagerBuilder) RegisterResourceQuota ¶
func (r *NoopResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
func (*NoopResourceManagerBuilder) ResourceRegistrar ¶
func (r *NoopResourceManagerBuilder) ResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
type Proxy ¶
type Proxy struct { pluginCore.ResourceManager ResourceNamespacePrefix pluginCore.ResourceNamespace TokenPrefix TokenPrefix }
A proxy will be created for each TaskExecutionContext
func (Proxy) AllocateResource ¶
func (p Proxy) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) (pluginCore.AllocationStatus, error)
func (Proxy) ReleaseResource ¶
func (p Proxy) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) error
type RedisResourceManager ¶
type RedisResourceManager struct { MetricsScope promutils.Scope // contains filtered or unexported fields }
func (*RedisResourceManager) AllocateResource ¶
func (r *RedisResourceManager) AllocateResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) ( pluginCore.AllocationStatus, error)
func (*RedisResourceManager) ReleaseResource ¶
func (r *RedisResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken string) error
type RedisResourceManagerBuilder ¶
type RedisResourceManagerBuilder struct { MetricsScope promutils.Scope // contains filtered or unexported fields }
func (*RedisResourceManagerBuilder) BuildResourceManager ¶
func (r *RedisResourceManagerBuilder) BuildResourceManager(ctx context.Context) (pluginCore.ResourceManager, error)
func (*RedisResourceManagerBuilder) RegisterResourceQuota ¶
func (r *RedisResourceManagerBuilder) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
func (*RedisResourceManagerBuilder) ResourceRegistrar ¶
func (r *RedisResourceManagerBuilder) ResourceRegistrar(namespacePrefix pluginCore.ResourceNamespace) pluginCore.ResourceRegistrar
type RedisResourceManagerMetrics ¶
type RedisResourceManagerMetrics struct { Scope promutils.Scope RedisSizeCheckTime promutils.StopWatch AllocatedTokensGauge prometheus.Gauge ApproximateBackedUpLength prometheus.Gauge }
func NewRedisResourceManagerMetrics ¶
func NewRedisResourceManagerMetrics(scope promutils.Scope) *RedisResourceManagerMetrics
func (RedisResourceManagerMetrics) GetScope ¶
func (rrmm RedisResourceManagerMetrics) GetScope() promutils.Scope
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
This struct is designed to serve as the identifier of an user of resource manager
type ResourceRegistrarProxy ¶
type ResourceRegistrarProxy struct { pluginCore.ResourceRegistrar ResourceNamespacePrefix pluginCore.ResourceNamespace TokenPrefix TokenPrefix }
func (ResourceRegistrarProxy) RegisterResourceQuota ¶
func (p ResourceRegistrarProxy) RegisterResourceQuota(ctx context.Context, namespace pluginCore.ResourceNamespace, quota int) error
type TokenPrefix ¶ added in v0.1.23
type TokenPrefix string
func ComposeTokenPrefix ¶ added in v0.1.23
func ComposeTokenPrefix(id *core.TaskExecutionIdentifier) TokenPrefix
Source Files ¶
Click to show internal directories.
Click to hide internal directories.