Documentation ¶
Index ¶
- Constants
- Variables
- func NewRedisClient(ctx context.Context, host string, key string, maxRetries int) (*redis.Client, error)
- type AllocationStatus
- type ExecutionLooksideBuffer
- type NoopResourceManager
- type RedisLookasideBuffer
- type RedisResourceManager
- type RedisResourceManagerMetrics
- type ResourceManager
Constants ¶
View Source
const RedisSetKey = "qubole"
This is the key that will point to the Redis Set. https://redis.io/commands#set
Variables ¶
View Source
var ExecutionNotFoundError = fmt.Errorf("Execution not found")
This error will be returned when a key is not found in the buffer
Functions ¶
Types ¶
type AllocationStatus ¶
type AllocationStatus string
const ( // This is the enum returned when there's an error AllocationUndefined AllocationStatus = "ResourceGranted" // Go for it AllocationStatusGranted AllocationStatus = "ResourceGranted" // This means that no resources are available globally. This is the only rejection message we use right now. AllocationStatusExhausted AllocationStatus = "ResourceExhausted" // We're not currently using this - but this would indicate that things globally are okay, but that your // own namespace is too busy AllocationStatusNamespaceQuotaExceeded AllocationStatus = "NamespaceQuotaExceeded" )
type ExecutionLooksideBuffer ¶
type ExecutionLooksideBuffer interface { ConfirmExecution(ctx context.Context, executionKey string, executionValue string) error RetrieveExecution(ctx context.Context, executionKey string) (string, error) }
Remembers an execution key to a value. Specifically for example in the Qubole case, the key will be the same key that's used in the AutoRefreshCache
type NoopResourceManager ¶
type NoopResourceManager struct { }
func (NoopResourceManager) AllocateResource ¶
func (NoopResourceManager) AllocateResource(ctx context.Context, namespace string, allocationToken string) ( AllocationStatus, error)
func (NoopResourceManager) ReleaseResource ¶
type RedisLookasideBuffer ¶
type RedisLookasideBuffer struct {
// contains filtered or unexported fields
}
func NewRedisLookasideBuffer ¶
func (RedisLookasideBuffer) ConfirmExecution ¶
func (RedisLookasideBuffer) RetrieveExecution ¶
type RedisResourceManager ¶
type RedisResourceManager struct { Metrics RedisResourceManagerMetrics // contains filtered or unexported fields }
func NewRedisResourceManager ¶
func (RedisResourceManager) AllocateResource ¶
func (r RedisResourceManager) AllocateResource(ctx context.Context, namespace string, allocationToken string) ( AllocationStatus, error)
func (RedisResourceManager) ReleaseResource ¶
type RedisResourceManagerMetrics ¶
type RedisResourceManagerMetrics struct { Scope promutils.Scope RedisSizeCheckTime promutils.StopWatch AllocatedTokensGauge prometheus.Gauge }
func NewRedisResourceManagerMetrics ¶
func NewRedisResourceManagerMetrics(scope promutils.Scope) RedisResourceManagerMetrics
type ResourceManager ¶
type ResourceManager interface { AllocateResource(ctx context.Context, namespace string, allocationToken string) (AllocationStatus, error) ReleaseResource(ctx context.Context, namespace string, allocationToken string) error }
Resource Manager manages a single resource type, and each allocation is of size one
func GetOrCreateResourceManagerFor ¶
func GetOrCreateResourceManagerFor(ctx context.Context, resourceName string) (ResourceManager, error)
Gets or creates a resource manager to the given resource name. This function is thread-safe and calling it with the same resource name will return the same instance of resource manager every time.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.