storage

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToExecutionFilter

func ToExecutionFilter(v interface{}) *cron.ExecutionFilter

ToExecutionFilter converts interface{} to *cron.ExecutionFilter

func ToJob

func ToJob(v interface{}) *cron.Job

ToJob converts interface{} to *cron.Job

func ToJobExecution

func ToJobExecution(v interface{}) *cron.JobExecution

ToJobExecution converts interface{} to *cron.JobExecution

func ToJobExecutions

func ToJobExecutions(v []interface{}) []*cron.JobExecution

ToJobExecutions converts []interface{} to []*cron.JobExecution

func ToJobStats

func ToJobStats(v interface{}) *cron.JobStats

ToJobStats converts interface{} to *cron.JobStats

func ToJobUpdate

func ToJobUpdate(v interface{}) *cron.JobUpdate

ToJobUpdate converts interface{} to *cron.JobUpdate

func ToJobs

func ToJobs(v []interface{}) []*cron.Job

ToJobs converts []interface{} to []*cron.Job

Types

type DatabaseStorage

type DatabaseStorage struct {
}

DatabaseStorage implements Storage using the database extension. This is a placeholder implementation that needs to be completed.

func NewDatabaseStorage

func NewDatabaseStorage() *DatabaseStorage

NewDatabaseStorage creates a new database storage. TODO: Implement full database storage with SQL/MongoDB support.

func (*DatabaseStorage) AcquireLock

func (s *DatabaseStorage) AcquireLock(ctx context.Context, jobID string, ttl time.Duration) (bool, error)

AcquireLock is not supported for database storage.

func (*DatabaseStorage) Connect

func (s *DatabaseStorage) Connect(ctx context.Context) error

Connect initializes the database connection.

func (*DatabaseStorage) DeleteExecution

func (s *DatabaseStorage) DeleteExecution(ctx context.Context, id string) error

DeleteExecution removes an execution from the database.

func (*DatabaseStorage) DeleteExecutionsBefore

func (s *DatabaseStorage) DeleteExecutionsBefore(ctx context.Context, before time.Time) (int64, error)

DeleteExecutionsBefore removes old executions from the database.

func (*DatabaseStorage) DeleteExecutionsByJob

func (s *DatabaseStorage) DeleteExecutionsByJob(ctx context.Context, jobID string) (int64, error)

DeleteExecutionsByJob removes executions for a job from the database.

func (*DatabaseStorage) DeleteJob

func (s *DatabaseStorage) DeleteJob(ctx context.Context, id string) error

DeleteJob removes a job from the database.

func (*DatabaseStorage) Disconnect

func (s *DatabaseStorage) Disconnect(ctx context.Context) error

Disconnect closes the database connection.

func (*DatabaseStorage) GetExecution

func (s *DatabaseStorage) GetExecution(ctx context.Context, id string) (interface{}, error)

GetExecution retrieves an execution from the database.

func (*DatabaseStorage) GetExecutionCount

func (s *DatabaseStorage) GetExecutionCount(ctx context.Context, filterInterface interface{}) (int64, error)

GetExecutionCount counts executions in the database.

func (*DatabaseStorage) GetJob

func (s *DatabaseStorage) GetJob(ctx context.Context, id string) (interface{}, error)

GetJob retrieves a job from the database.

func (*DatabaseStorage) GetJobStats

func (s *DatabaseStorage) GetJobStats(ctx context.Context, jobID string) (interface{}, error)

GetJobStats calculates job statistics from the database.

func (*DatabaseStorage) ListExecutions

func (s *DatabaseStorage) ListExecutions(ctx context.Context, filterInterface interface{}) ([]interface{}, error)

ListExecutions retrieves executions from the database.

func (*DatabaseStorage) ListJobs

func (s *DatabaseStorage) ListJobs(ctx context.Context) ([]interface{}, error)

ListJobs retrieves all jobs from the database.

func (*DatabaseStorage) Ping

func (s *DatabaseStorage) Ping(ctx context.Context) error

Ping checks database connectivity.

func (*DatabaseStorage) RefreshLock

func (s *DatabaseStorage) RefreshLock(ctx context.Context, jobID string, ttl time.Duration) error

RefreshLock is not supported for database storage.

func (*DatabaseStorage) ReleaseLock

func (s *DatabaseStorage) ReleaseLock(ctx context.Context, jobID string) error

ReleaseLock is not supported for database storage.

func (*DatabaseStorage) SaveExecution

func (s *DatabaseStorage) SaveExecution(ctx context.Context, execInterface interface{}) error

SaveExecution saves an execution to the database.

func (*DatabaseStorage) SaveJob

func (s *DatabaseStorage) SaveJob(ctx context.Context, jobInterface interface{}) error

SaveJob saves a job to the database.

func (*DatabaseStorage) UpdateJob

func (s *DatabaseStorage) UpdateJob(ctx context.Context, id string, updateInterface interface{}) error

UpdateJob updates a job in the database.

type MemoryStorage

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

MemoryStorage implements Storage using in-memory maps. This implementation is suitable for development and testing but does not persist data.

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

NewMemoryStorage creates a new in-memory storage.

func (*MemoryStorage) AcquireLock

func (s *MemoryStorage) AcquireLock(ctx context.Context, jobID string, ttl time.Duration) (bool, error)

AcquireLock attempts to acquire a distributed lock. For memory storage, this is a simple mutex-based implementation.

func (*MemoryStorage) Connect

func (s *MemoryStorage) Connect(ctx context.Context) error

Connect initializes the storage (no-op for memory).

func (*MemoryStorage) DeleteExecution

func (s *MemoryStorage) DeleteExecution(ctx context.Context, id string) error

DeleteExecution removes an execution.

func (*MemoryStorage) DeleteExecutionsBefore

func (s *MemoryStorage) DeleteExecutionsBefore(ctx context.Context, before time.Time) (int64, error)

DeleteExecutionsBefore removes executions older than the given time.

func (*MemoryStorage) DeleteExecutionsByJob

func (s *MemoryStorage) DeleteExecutionsByJob(ctx context.Context, jobID string) (int64, error)

DeleteExecutionsByJob removes all executions for a job.

func (*MemoryStorage) DeleteJob

func (s *MemoryStorage) DeleteJob(ctx context.Context, id string) error

DeleteJob removes a job.

func (*MemoryStorage) Disconnect

func (s *MemoryStorage) Disconnect(ctx context.Context) error

Disconnect closes the storage (no-op for memory).

func (*MemoryStorage) GetExecution

func (s *MemoryStorage) GetExecution(ctx context.Context, id string) (interface{}, error)

GetExecution retrieves an execution by ID.

func (*MemoryStorage) GetExecutionCount

func (s *MemoryStorage) GetExecutionCount(ctx context.Context, filterInterface interface{}) (int64, error)

GetExecutionCount returns the number of executions matching the filter.

func (*MemoryStorage) GetJob

func (s *MemoryStorage) GetJob(ctx context.Context, id string) (interface{}, error)

GetJob retrieves a job by ID.

func (*MemoryStorage) GetJobStats

func (s *MemoryStorage) GetJobStats(ctx context.Context, jobID string) (interface{}, error)

GetJobStats calculates statistics for a job.

func (*MemoryStorage) ListExecutions

func (s *MemoryStorage) ListExecutions(ctx context.Context, filterInterface interface{}) ([]interface{}, error)

ListExecutions retrieves executions matching the filter.

func (*MemoryStorage) ListJobs

func (s *MemoryStorage) ListJobs(ctx context.Context) ([]interface{}, error)

ListJobs retrieves all jobs.

func (*MemoryStorage) Ping

func (s *MemoryStorage) Ping(ctx context.Context) error

Ping checks if the storage is available.

func (*MemoryStorage) RefreshLock

func (s *MemoryStorage) RefreshLock(ctx context.Context, jobID string, ttl time.Duration) error

RefreshLock extends the TTL of an existing lock.

func (*MemoryStorage) ReleaseLock

func (s *MemoryStorage) ReleaseLock(ctx context.Context, jobID string) error

ReleaseLock releases a distributed lock.

func (*MemoryStorage) SaveExecution

func (s *MemoryStorage) SaveExecution(ctx context.Context, execInterface interface{}) error

SaveExecution saves a job execution.

func (*MemoryStorage) SaveJob

func (s *MemoryStorage) SaveJob(ctx context.Context, jobInterface interface{}) error

SaveJob saves or updates a job.

func (*MemoryStorage) UpdateJob

func (s *MemoryStorage) UpdateJob(ctx context.Context, id string, updateInterface interface{}) error

UpdateJob updates a job with the given changes.

type RedisStorage

type RedisStorage struct {
}

RedisStorage implements Storage using Redis. This is a placeholder implementation that needs to be completed.

func NewRedisStorage

func NewRedisStorage() *RedisStorage

NewRedisStorage creates a new Redis storage. TODO: Implement full Redis storage with connection pool and distributed locks.

func (*RedisStorage) AcquireLock

func (s *RedisStorage) AcquireLock(ctx context.Context, jobID string, ttl time.Duration) (bool, error)

AcquireLock acquires a distributed lock using Redis.

func (*RedisStorage) Connect

func (s *RedisStorage) Connect(ctx context.Context) error

Connect initializes the Redis connection.

func (*RedisStorage) DeleteExecution

func (s *RedisStorage) DeleteExecution(ctx context.Context, id string) error

DeleteExecution removes an execution from Redis.

func (*RedisStorage) DeleteExecutionsBefore

func (s *RedisStorage) DeleteExecutionsBefore(ctx context.Context, before time.Time) (int64, error)

DeleteExecutionsBefore removes old executions from Redis.

func (*RedisStorage) DeleteExecutionsByJob

func (s *RedisStorage) DeleteExecutionsByJob(ctx context.Context, jobID string) (int64, error)

DeleteExecutionsByJob removes executions for a job from Redis.

func (*RedisStorage) DeleteJob

func (s *RedisStorage) DeleteJob(ctx context.Context, id string) error

DeleteJob removes a job from Redis.

func (*RedisStorage) Disconnect

func (s *RedisStorage) Disconnect(ctx context.Context) error

Disconnect closes the Redis connection.

func (*RedisStorage) GetExecution

func (s *RedisStorage) GetExecution(ctx context.Context, id string) (interface{}, error)

GetExecution retrieves an execution from Redis.

func (*RedisStorage) GetExecutionCount

func (s *RedisStorage) GetExecutionCount(ctx context.Context, filterInterface interface{}) (int64, error)

GetExecutionCount counts executions in Redis.

func (*RedisStorage) GetJob

func (s *RedisStorage) GetJob(ctx context.Context, id string) (interface{}, error)

GetJob retrieves a job from Redis.

func (*RedisStorage) GetJobStats

func (s *RedisStorage) GetJobStats(ctx context.Context, jobID string) (interface{}, error)

GetJobStats calculates job statistics from Redis.

func (*RedisStorage) ListExecutions

func (s *RedisStorage) ListExecutions(ctx context.Context, filterInterface interface{}) ([]interface{}, error)

ListExecutions retrieves executions from Redis.

func (*RedisStorage) ListJobs

func (s *RedisStorage) ListJobs(ctx context.Context) ([]interface{}, error)

ListJobs retrieves all jobs from Redis.

func (*RedisStorage) Ping

func (s *RedisStorage) Ping(ctx context.Context) error

Ping checks Redis connectivity.

func (*RedisStorage) RefreshLock

func (s *RedisStorage) RefreshLock(ctx context.Context, jobID string, ttl time.Duration) error

RefreshLock extends the TTL of a lock.

func (*RedisStorage) ReleaseLock

func (s *RedisStorage) ReleaseLock(ctx context.Context, jobID string) error

ReleaseLock releases a distributed lock.

func (*RedisStorage) SaveExecution

func (s *RedisStorage) SaveExecution(ctx context.Context, execInterface interface{}) error

SaveExecution saves an execution to Redis.

func (*RedisStorage) SaveJob

func (s *RedisStorage) SaveJob(ctx context.Context, jobInterface interface{}) error

SaveJob saves a job to Redis.

func (*RedisStorage) UpdateJob

func (s *RedisStorage) UpdateJob(ctx context.Context, id string, updateInterface interface{}) error

UpdateJob updates a job in Redis.

Jump to

Keyboard shortcuts

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