store

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Local

type Local struct {
	// contains filtered or unexported fields
}

Local ..

func (*Local) CurrentlyQueuedTasksCount added in v0.5.1

func (l *Local) CurrentlyQueuedTasksCount(_ context.Context) (count uint64, err error)

CurrentlyQueuedTasksCount ..

func (*Local) DelEnvironment

func (l *Local) DelEnvironment(_ context.Context, k schemas.EnvironmentKey) error

DelEnvironment ..

func (*Local) DelMetric

func (l *Local) DelMetric(_ context.Context, k schemas.MetricKey) error

DelMetric ..

func (*Local) DelProject

func (l *Local) DelProject(_ context.Context, k schemas.ProjectKey) error

DelProject ..

func (*Local) DelRef

func (l *Local) DelRef(_ context.Context, k schemas.RefKey) error

DelRef ..

func (*Local) EnvironmentExists

func (l *Local) EnvironmentExists(_ context.Context, k schemas.EnvironmentKey) (bool, error)

EnvironmentExists ..

func (*Local) Environments

func (l *Local) Environments(_ context.Context) (environments schemas.Environments, err error)

Environments ..

func (*Local) EnvironmentsCount

func (l *Local) EnvironmentsCount(_ context.Context) (int64, error)

EnvironmentsCount ..

func (*Local) ExecutedTasksCount added in v0.5.1

func (l *Local) ExecutedTasksCount(_ context.Context) (uint64, error)

ExecutedTasksCount ..

func (*Local) GetEnvironment

func (l *Local) GetEnvironment(ctx context.Context, environment *schemas.Environment) error

GetEnvironment ..

func (*Local) GetMetric

func (l *Local) GetMetric(ctx context.Context, m *schemas.Metric) error

GetMetric ..

func (*Local) GetProject

func (l *Local) GetProject(ctx context.Context, p *schemas.Project) error

GetProject ..

func (*Local) GetRef

func (l *Local) GetRef(ctx context.Context, ref *schemas.Ref) error

GetRef ..

func (*Local) MetricExists

func (l *Local) MetricExists(_ context.Context, k schemas.MetricKey) (bool, error)

MetricExists ..

func (*Local) Metrics

func (l *Local) Metrics(_ context.Context) (metrics schemas.Metrics, err error)

Metrics ..

func (*Local) MetricsCount

func (l *Local) MetricsCount(_ context.Context) (int64, error)

MetricsCount ..

func (*Local) ProjectExists

func (l *Local) ProjectExists(_ context.Context, k schemas.ProjectKey) (bool, error)

ProjectExists ..

func (*Local) Projects

func (l *Local) Projects(_ context.Context) (projects schemas.Projects, err error)

Projects ..

func (*Local) ProjectsCount

func (l *Local) ProjectsCount(_ context.Context) (int64, error)

ProjectsCount ..

func (*Local) QueueTask added in v0.5.1

func (l *Local) QueueTask(_ context.Context, tt schemas.TaskType, uniqueID, _ string) (bool, error)

QueueTask registers that we are queueing the task. It returns true if it managed to schedule it, false if it was already scheduled.

func (*Local) RefExists

func (l *Local) RefExists(_ context.Context, k schemas.RefKey) (bool, error)

RefExists ..

func (*Local) Refs

func (l *Local) Refs(_ context.Context) (refs schemas.Refs, err error)

Refs ..

func (*Local) RefsCount

func (l *Local) RefsCount(_ context.Context) (int64, error)

RefsCount ..

func (*Local) SetEnvironment

func (l *Local) SetEnvironment(_ context.Context, environment schemas.Environment) error

SetEnvironment ..

func (*Local) SetMetric

func (l *Local) SetMetric(_ context.Context, m schemas.Metric) error

SetMetric ..

func (*Local) SetProject

func (l *Local) SetProject(_ context.Context, p schemas.Project) error

SetProject ..

func (*Local) SetRef

func (l *Local) SetRef(_ context.Context, ref schemas.Ref) error

SetRef ..

func (*Local) UnqueueTask added in v0.5.1

func (l *Local) UnqueueTask(_ context.Context, tt schemas.TaskType, uniqueID string) error

UnqueueTask removes the task from the tracker.

type Redis

type Redis struct {
	*redis.Client
}

Redis ..

func (*Redis) CurrentlyQueuedTasksCount added in v0.5.1

func (r *Redis) CurrentlyQueuedTasksCount(ctx context.Context) (count uint64, err error)

CurrentlyQueuedTasksCount ..

func (*Redis) DelEnvironment

func (r *Redis) DelEnvironment(ctx context.Context, k schemas.EnvironmentKey) error

DelEnvironment ..

func (*Redis) DelMetric

func (r *Redis) DelMetric(ctx context.Context, k schemas.MetricKey) error

DelMetric ..

func (*Redis) DelProject

func (r *Redis) DelProject(ctx context.Context, k schemas.ProjectKey) error

DelProject ..

func (*Redis) DelRef

func (r *Redis) DelRef(ctx context.Context, k schemas.RefKey) error

DelRef ..

func (*Redis) EnvironmentExists

func (r *Redis) EnvironmentExists(ctx context.Context, k schemas.EnvironmentKey) (bool, error)

EnvironmentExists ..

func (*Redis) Environments

func (r *Redis) Environments(ctx context.Context) (schemas.Environments, error)

Environments ..

func (*Redis) EnvironmentsCount

func (r *Redis) EnvironmentsCount(ctx context.Context) (int64, error)

EnvironmentsCount ..

func (*Redis) ExecutedTasksCount added in v0.5.1

func (r *Redis) ExecutedTasksCount(ctx context.Context) (uint64, error)

ExecutedTasksCount ..

func (*Redis) GetEnvironment

func (r *Redis) GetEnvironment(ctx context.Context, e *schemas.Environment) error

GetEnvironment ..

func (*Redis) GetMetric

func (r *Redis) GetMetric(ctx context.Context, m *schemas.Metric) error

GetMetric ..

func (*Redis) GetProject

func (r *Redis) GetProject(ctx context.Context, p *schemas.Project) error

GetProject ..

func (*Redis) GetRef

func (r *Redis) GetRef(ctx context.Context, ref *schemas.Ref) error

GetRef ..

func (*Redis) KeepaliveExists added in v0.5.3

func (r *Redis) KeepaliveExists(ctx context.Context, uuid string) (bool, error)

KeepaliveExists returns whether a keepalive exists or not for a particular UUID.

func (*Redis) MetricExists

func (r *Redis) MetricExists(ctx context.Context, k schemas.MetricKey) (bool, error)

MetricExists ..

func (*Redis) Metrics

func (r *Redis) Metrics(ctx context.Context) (schemas.Metrics, error)

Metrics ..

func (*Redis) MetricsCount

func (r *Redis) MetricsCount(ctx context.Context) (int64, error)

MetricsCount ..

func (*Redis) ProjectExists

func (r *Redis) ProjectExists(ctx context.Context, k schemas.ProjectKey) (bool, error)

ProjectExists ..

func (*Redis) Projects

func (r *Redis) Projects(ctx context.Context) (schemas.Projects, error)

Projects ..

func (*Redis) ProjectsCount

func (r *Redis) ProjectsCount(ctx context.Context) (int64, error)

ProjectsCount ..

func (*Redis) QueueTask added in v0.5.1

func (r *Redis) QueueTask(ctx context.Context, tt schemas.TaskType, taskUUID, processUUID string) (set bool, err error)

QueueTask registers that we are queueing the task. It returns true if it managed to schedule it, false if it was already scheduled.

func (*Redis) RefExists

func (r *Redis) RefExists(ctx context.Context, k schemas.RefKey) (bool, error)

RefExists ..

func (*Redis) Refs

func (r *Redis) Refs(ctx context.Context) (schemas.Refs, error)

Refs ..

func (*Redis) RefsCount

func (r *Redis) RefsCount(ctx context.Context) (int64, error)

RefsCount ..

func (*Redis) SetEnvironment

func (r *Redis) SetEnvironment(ctx context.Context, e schemas.Environment) error

SetEnvironment ..

func (*Redis) SetKeepalive added in v0.5.3

func (r *Redis) SetKeepalive(ctx context.Context, uuid string, ttl time.Duration) (bool, error)

SetKeepalive sets a key with an UUID corresponding to the currently running process.

func (*Redis) SetMetric

func (r *Redis) SetMetric(ctx context.Context, m schemas.Metric) error

SetMetric ..

func (*Redis) SetProject

func (r *Redis) SetProject(ctx context.Context, p schemas.Project) error

SetProject ..

func (*Redis) SetRef

func (r *Redis) SetRef(ctx context.Context, ref schemas.Ref) error

SetRef ..

func (*Redis) UnqueueTask added in v0.5.1

func (r *Redis) UnqueueTask(ctx context.Context, tt schemas.TaskType, taskUUID string) (err error)

UnqueueTask removes the task from the tracker.

type Store

type Store interface {
	SetProject(context.Context, schemas.Project) error
	DelProject(context.Context, schemas.ProjectKey) error
	GetProject(context.Context, *schemas.Project) error
	ProjectExists(context.Context, schemas.ProjectKey) (bool, error)
	Projects(context.Context) (schemas.Projects, error)
	ProjectsCount(context.Context) (int64, error)
	SetEnvironment(context.Context, schemas.Environment) error
	DelEnvironment(context.Context, schemas.EnvironmentKey) error
	GetEnvironment(context.Context, *schemas.Environment) error
	EnvironmentExists(context.Context, schemas.EnvironmentKey) (bool, error)
	Environments(context.Context) (schemas.Environments, error)
	EnvironmentsCount(context.Context) (int64, error)
	SetRef(context.Context, schemas.Ref) error
	DelRef(context.Context, schemas.RefKey) error
	GetRef(context.Context, *schemas.Ref) error
	RefExists(context.Context, schemas.RefKey) (bool, error)
	Refs(context.Context) (schemas.Refs, error)
	RefsCount(context.Context) (int64, error)
	SetMetric(context.Context, schemas.Metric) error
	DelMetric(context.Context, schemas.MetricKey) error
	GetMetric(context.Context, *schemas.Metric) error
	MetricExists(context.Context, schemas.MetricKey) (bool, error)
	Metrics(context.Context) (schemas.Metrics, error)
	MetricsCount(context.Context) (int64, error)

	// Helpers to keep track of currently queued tasks and avoid scheduling them
	// twice at the risk of ending up with loads of dangling goroutines being locked
	QueueTask(context.Context, schemas.TaskType, string, string) (bool, error)
	UnqueueTask(context.Context, schemas.TaskType, string) error
	CurrentlyQueuedTasksCount(context.Context) (uint64, error)
	ExecutedTasksCount(context.Context) (uint64, error)
}

Store ..

func New

func New(
	ctx context.Context,
	r *redis.Client,
	projects config.Projects,
) (s Store)

New creates a new store and populates it with provided []schemas.Project.

func NewLocalStore

func NewLocalStore() Store

NewLocalStore ..

func NewRedisStore

func NewRedisStore(client *redis.Client) Store

NewRedisStore ..

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL