sqlstore

package
v0.0.0-...-d4e4ec1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLite

type SQLite struct{ DB *sql.DB }

SQLite implements the Store interface using a SQLite database.

func OpenSQLite

func OpenSQLite(path string) (*SQLite, error)

OpenSQLite opens a connection to the SQLite database at the given path.

func (*SQLite) CompleteQueueTask

func (s *SQLite) CompleteQueueTask(queueID string) (string, error)

CompleteQueueTask marks a queue task as completed (or failed) Note: The actual result/error is stored in node_runs via a separate call, or we could add result columns here. For now, we assume the engine will handle the result, but typically the worker reports result here. To keep it simple, we'll just mark status here, and let the caller handle the data persistence elsewhere or add columns if needed. Wait, the design says Worker calls /queue/complete with result. So we need to return the TaskID so the API can update the flow.

func (*SQLite) CreateFlow

func (s *SQLite) CreateFlow(name string, description string) (string, error)

func (*SQLite) CreateFlowVersion

func (s *SQLite) CreateFlowVersion(flowID string, version int, definitionJSON string, status string) (string, error)

func (*SQLite) CreateNodeRun

func (s *SQLite) CreateNodeRun(nr map[string]interface{}) error

func (*SQLite) CreateTask

func (s *SQLite) CreateTask(flowVersionID string, paramsJSON string, requestID string, startNode string) (string, error)

func (*SQLite) EnqueueTask

func (s *SQLite) EnqueueTask(taskID, nodeKey, service, inputJSON string) (string, error)

EnqueueTask adds a new task to the queue

func (*SQLite) ExtendLease

func (s *SQLite) ExtendLease(id string, owner string, ttlSec int64) error

func (*SQLite) FailQueueTask

func (s *SQLite) FailQueueTask(queueID string) error

FailQueueTask marks a queue task as failed

func (*SQLite) GetFlowVersionByFlowIDAndVersion

func (s *SQLite) GetFlowVersionByFlowIDAndVersion(flowID string, version int) (store.FlowVersion, error)

func (*SQLite) GetFlowVersionByID

func (s *SQLite) GetFlowVersionByID(id string) (store.FlowVersion, error)

func (*SQLite) GetNodeRun

func (s *SQLite) GetNodeRun(id string) (store.NodeRun, error)

func (*SQLite) GetTask

func (s *SQLite) GetTask(id string) (store.Task, error)

func (*SQLite) HeartbeatWorker

func (s *SQLite) HeartbeatWorker(id string, url string, load int) error

func (*SQLite) Init

func (s *SQLite) Init() error

Init initializes the database schema.

func (*SQLite) LatestPublishedVersion

func (s *SQLite) LatestPublishedVersion(flowID string) (store.FlowVersion, error)

func (*SQLite) LeaseNextTask

func (s *SQLite) LeaseNextTask(owner string, ttlSec int64) (store.Task, error)

func (*SQLite) ListFlowVersions

func (s *SQLite) ListFlowVersions(flowID string) ([]store.FlowVersion, error)

func (*SQLite) ListFlows

func (s *SQLite) ListFlows(limit, offset int) ([]store.Flow, int64, error)

func (*SQLite) ListNodeRuns

func (s *SQLite) ListNodeRuns(taskID string) ([]store.NodeRun, error)

func (*SQLite) ListTasks

func (s *SQLite) ListTasks(status string, flowVersionID string, limit, offset int) ([]store.Task, int64, error)

func (*SQLite) ListWorkers

func (s *SQLite) ListWorkers(service string, ttl int64) ([]store.WorkerInfo, error)

func (*SQLite) PollQueue

func (s *SQLite) PollQueue(workerID string, services []string, timeoutSec int64) (store.QueueTask, error)

PollQueue attempts to claim a pending task for the given services

func (*SQLite) RefreshWorkersStatus

func (s *SQLite) RefreshWorkersStatus(ttl int64) error

func (*SQLite) RegisterWorker

func (s *SQLite) RegisterWorker(w store.WorkerInfo) error

RegisterWorker registers or updates a worker in the database.

func (*SQLite) SaveNodeRun

func (s *SQLite) SaveNodeRun(nr map[string]interface{}) error

func (*SQLite) UpdateNodeRun

func (s *SQLite) UpdateNodeRun(id string, updates map[string]interface{}) error

func (*SQLite) UpdateTaskProgress

func (s *SQLite) UpdateTaskProgress(id string, currentNode string, lastAction string, sharedJSON string, stepCount int) error

func (*SQLite) UpdateTaskProgressOwned

func (s *SQLite) UpdateTaskProgressOwned(id string, owner string, currentNode string, lastAction string, sharedJSON string, stepCount int) error

func (*SQLite) UpdateTaskStatus

func (s *SQLite) UpdateTaskStatus(id string, status string) error

func (*SQLite) UpdateTaskStatusOwned

func (s *SQLite) UpdateTaskStatusOwned(id string, owner string, status string) error

Jump to

Keyboard shortcuts

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