Documentation
¶
Index ¶
- Constants
- func DestroyStore() error
- func EnvironmentBucket() string
- func MigrateProcessBuckets(dbPath string) error
- func Path() string
- type BackgroundRun
- type BackgroundRunStatus
- type BoltDataStore
- func (s *BoltDataStore) Close() error
- func (s *BoltDataStore) CreateProcessBucket(id string) error
- func (s *BoltDataStore) DeleteBackgroundRun(id string) error
- func (s *BoltDataStore) DeleteCacheEntry(key string) error
- func (s *BoltDataStore) DeleteExecutionHistory(ref string) error
- func (s *BoltDataStore) DeleteProcessBucket(id string) error
- func (s *BoltDataStore) DeleteProcessVar(bucketID, key string) error
- func (s *BoltDataStore) GetAllProcessVars(bucketID string) (map[string]string, error)
- func (s *BoltDataStore) GetBackgroundRun(id string) (BackgroundRun, error)
- func (s *BoltDataStore) GetCacheEntry(key string) ([]byte, error)
- func (s *BoltDataStore) GetExecutionHistory(ref string, limit int) ([]ExecutionRecord, error)
- func (s *BoltDataStore) GetProcessVar(bucketID, key string) (string, error)
- func (s *BoltDataStore) GetProcessVarKeys(bucketID string) ([]string, error)
- func (s *BoltDataStore) ListBackgroundRuns() ([]BackgroundRun, error)
- func (s *BoltDataStore) ListExecutionRefs() ([]string, error)
- func (s *BoltDataStore) RecordExecution(record ExecutionRecord) error
- func (s *BoltDataStore) SaveBackgroundRun(run BackgroundRun) error
- func (s *BoltDataStore) SetCacheEntry(key string, value []byte) error
- func (s *BoltDataStore) SetProcessVar(bucketID, key, value string) error
- type DataStore
- type ExecutionRecord
Constants ¶
const ( // BucketEnv is the environment variable used to identify the current process bucket. BucketEnv = "FLOW_PROCESS_BUCKET" // RootBucket is the name of the global (root) process bucket. RootBucket = "root" )
Variables ¶
This section is empty.
Functions ¶
func DestroyStore ¶
func DestroyStore() error
DestroyStore removes the store database file entirely.
func EnvironmentBucket ¶
func EnvironmentBucket() string
EnvironmentBucket returns the process bucket ID for the current execution scope, determined by the FLOW_PROCESS_BUCKET environment variable. Falls back to RootBucket.
func MigrateProcessBuckets ¶
MigrateProcessBuckets moves any legacy top-level exec-ref buckets (created before the "process" parent bucket was introduced) into the nested structure under the "process" bucket. This is safe to call multiple times; already-migrated buckets are skipped.
Types ¶
type BackgroundRun ¶
type BackgroundRun struct {
ID string `json:"id"`
PID int `json:"pid"`
Ref string `json:"ref"`
StartedAt time.Time `json:"startedAt"`
Status BackgroundRunStatus `json:"status"`
LogArchiveID string `json:"logArchiveId,omitempty"`
Error string `json:"error,omitempty"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
}
BackgroundRun holds metadata about a detached background execution.
type BackgroundRunStatus ¶
type BackgroundRunStatus string
BackgroundRunStatus represents the state of a background run.
const ( BackgroundRunning BackgroundRunStatus = "running" BackgroundCompleted BackgroundRunStatus = "completed" BackgroundFailed BackgroundRunStatus = "failed" )
type BoltDataStore ¶
type BoltDataStore struct {
// contains filtered or unexported fields
}
BoltDataStore opens and closes the BBolt database for each operation, so the exclusive file lock is held only for the duration of a single transaction. This allows multiple flow processes to share the same store file safely.
func (*BoltDataStore) Close ¶
func (s *BoltDataStore) Close() error
Close is a no-op for the per-operation store — each operation opens and closes the DB itself.
func (*BoltDataStore) CreateProcessBucket ¶
func (s *BoltDataStore) CreateProcessBucket(id string) error
func (*BoltDataStore) DeleteBackgroundRun ¶
func (s *BoltDataStore) DeleteBackgroundRun(id string) error
func (*BoltDataStore) DeleteCacheEntry ¶
func (s *BoltDataStore) DeleteCacheEntry(key string) error
func (*BoltDataStore) DeleteExecutionHistory ¶
func (s *BoltDataStore) DeleteExecutionHistory(ref string) error
func (*BoltDataStore) DeleteProcessBucket ¶
func (s *BoltDataStore) DeleteProcessBucket(id string) error
func (*BoltDataStore) DeleteProcessVar ¶
func (s *BoltDataStore) DeleteProcessVar(bucketID, key string) error
func (*BoltDataStore) GetAllProcessVars ¶
func (s *BoltDataStore) GetAllProcessVars(bucketID string) (map[string]string, error)
GetAllProcessVars returns all key-value pairs from bucketID merged with RootBucket (bucketID wins on conflict).
func (*BoltDataStore) GetBackgroundRun ¶
func (s *BoltDataStore) GetBackgroundRun(id string) (BackgroundRun, error)
func (*BoltDataStore) GetCacheEntry ¶
func (s *BoltDataStore) GetCacheEntry(key string) ([]byte, error)
func (*BoltDataStore) GetExecutionHistory ¶
func (s *BoltDataStore) GetExecutionHistory(ref string, limit int) ([]ExecutionRecord, error)
func (*BoltDataStore) GetProcessVar ¶
func (s *BoltDataStore) GetProcessVar(bucketID, key string) (string, error)
GetProcessVar retrieves the value for key in bucketID, falling back to RootBucket if not found.
func (*BoltDataStore) GetProcessVarKeys ¶
func (s *BoltDataStore) GetProcessVarKeys(bucketID string) ([]string, error)
GetProcessVarKeys returns all keys from bucketID merged with RootBucket.
func (*BoltDataStore) ListBackgroundRuns ¶
func (s *BoltDataStore) ListBackgroundRuns() ([]BackgroundRun, error)
func (*BoltDataStore) ListExecutionRefs ¶
func (s *BoltDataStore) ListExecutionRefs() ([]string, error)
func (*BoltDataStore) RecordExecution ¶
func (s *BoltDataStore) RecordExecution(record ExecutionRecord) error
func (*BoltDataStore) SaveBackgroundRun ¶
func (s *BoltDataStore) SaveBackgroundRun(run BackgroundRun) error
func (*BoltDataStore) SetCacheEntry ¶
func (s *BoltDataStore) SetCacheEntry(key string, value []byte) error
func (*BoltDataStore) SetProcessVar ¶
func (s *BoltDataStore) SetProcessVar(bucketID, key, value string) error
type DataStore ¶
type DataStore interface {
SetCacheEntry(key string, value []byte) error
GetCacheEntry(key string) ([]byte, error)
DeleteCacheEntry(key string) error
RecordExecution(record ExecutionRecord) error
GetExecutionHistory(ref string, limit int) ([]ExecutionRecord, error)
ListExecutionRefs() ([]string, error)
DeleteExecutionHistory(ref string) error
// Background run management (detached process tracking).
SaveBackgroundRun(run BackgroundRun) error
GetBackgroundRun(id string) (BackgroundRun, error)
ListBackgroundRuns() ([]BackgroundRun, error)
DeleteBackgroundRun(id string) error
// Process env var management (per-execution scoped key-value storage).
// bucketID identifies the execution scope; use EnvironmentBucket() to get the current scope.
CreateProcessBucket(id string) error
DeleteProcessBucket(id string) error
SetProcessVar(bucketID, key, value string) error
GetProcessVar(bucketID, key string) (string, error)
GetAllProcessVars(bucketID string) (map[string]string, error)
GetProcessVarKeys(bucketID string) ([]string, error)
DeleteProcessVar(bucketID, key string) error
Close() error
}
DataStore manages structured internal state (cache, execution history, and process env vars). It is intentionally in pkg/ so external consumers (e.g. pro wrapper) can import it.
func NewDataStore ¶
NewDataStore creates a DataStore backed by the BBolt file at dbPath. If dbPath is empty, the default path is used. The database file is opened and closed per operation; no persistent lock is held.
type ExecutionRecord ¶
type ExecutionRecord struct {
Ref string `json:"ref"`
StartedAt time.Time `json:"startedAt"`
Duration time.Duration `json:"duration"`
ExitCode int `json:"exitCode"`
Error string `json:"error,omitempty"`
// LogArchiveID links this record to a tuikit log archive entry for cross-referencing.
LogArchiveID string `json:"logArchiveId,omitempty"`
}
ExecutionRecord holds metadata about a single executable run.