Documentation
¶
Index ¶
- Constants
- func CreateTemplateSafe(template TemplateItem) error
- func CreateWorkflowSafe(id string, workflow Workflow) error
- func DeleteTemplateSafe(slug string) error
- func DeleteValue(key string) error
- func DeleteWorkflowSafe(id string) error
- func GetValue(key string, value interface{}) error
- func InitDB(appName string) (*badger.DB, error)
- func ListValues(prefix string) ([]string, error)
- func SetValue(key string, value interface{}) error
- type Atom
- type BadgerLogger
- type Config
- type DBService
- func (s *DBService) AutoCloseDB(inactivityPeriod time.Duration)
- func (s *DBService) CloseDB()
- func (s *DBService) ReadOperation(operation func(*Store) error) error
- func (s *DBService) ReadOperationWithContext(ctx context.Context, operation func(*Store) error) error
- func (s *DBService) ReadOperationWithRetry(operation func(*Store) error, maxRetries int) error
- func (s *DBService) WithTimeout(duration time.Duration) *DBService
- func (s *DBService) WriteOperation(operation func(*Store) error) error
- type Store
- type TemplateItem
- type TemplateStoreManager
- func (ts *TemplateStoreManager) CreateTemplate(template TemplateItem) error
- func (ts *TemplateStoreManager) DeleteTemplate(slug string) error
- func (ts *TemplateStoreManager) ExportTemplate(slug string) (string, error)
- func (ts *TemplateStoreManager) GetTemplate(slug string) (*TemplateItem, error)
- func (ts *TemplateStoreManager) ImportTemplate(jsonData string) error
- func (ts *TemplateStoreManager) ListTemplates() ([]TemplateItem, error)
- func (ts *TemplateStoreManager) SearchTemplates(query string) ([]TemplateItem, error)
- func (ts *TemplateStoreManager) UpdateTemplate(template TemplateItem) error
- type Workflow
- type WorkflowStore
- func (ws *WorkflowStore) AddStep(id string, step Atom) error
- func (ws *WorkflowStore) CreateWorkflow(id string, workflow Workflow) error
- func (ws *WorkflowStore) DeleteWorkflow(id string) error
- func (ws *WorkflowStore) ExportWorkflow(id string) (string, error)
- func (ws *WorkflowStore) GetWorkflow(id string) (*Workflow, error)
- func (ws *WorkflowStore) ImportWorkflow(id string, jsonData string) error
- func (ws *WorkflowStore) ListWorkflows() ([]Workflow, error)
- func (ws *WorkflowStore) RemoveStep(id string, index int) error
- func (ws *WorkflowStore) SearchWorkflows(query string) ([]Workflow, error)
- func (ws *WorkflowStore) UpdateConfig(id string, configMap map[string]interface{}) error
- func (ws *WorkflowStore) UpdateWorkflow(id string, workflow Workflow) error
Constants ¶
const TemplatePrefix = "mg_templates:"
const WorkflowPrefix = "mg_workflows:"
Variables ¶
This section is empty.
Functions ¶
func CreateTemplateSafe ¶
func CreateTemplateSafe(template TemplateItem) error
CreateTemplateSafe creates a template safely through the DB service
func CreateWorkflowSafe ¶
CreateWorkflowSafe creates a workflow safely through the DB service
func DeleteTemplateSafe ¶
DeleteTemplateSafe deletes a template safely through the DB service
func DeleteValue ¶
DeleteValue is a convenience function for deleting a value using the global DB service
func DeleteWorkflowSafe ¶
DeleteWorkflowSafe deletes a workflow safely through the DB service
func ListValues ¶
ListValues is a convenience function for listing values using the global DB service
Types ¶
type BadgerLogger ¶
BadgerLogger implements badger.Logger interface
func (*BadgerLogger) Debugf ¶
func (l *BadgerLogger) Debugf(f string, v ...interface{})
func (*BadgerLogger) Errorf ¶
func (l *BadgerLogger) Errorf(f string, v ...interface{})
func (*BadgerLogger) Infof ¶
func (l *BadgerLogger) Infof(f string, v ...interface{})
func (*BadgerLogger) Warningf ¶
func (l *BadgerLogger) Warningf(f string, v ...interface{})
type DBService ¶
type DBService struct {
// contains filtered or unexported fields
}
DBService manages database access with proper locking
func GetDBService ¶
func GetDBService() *DBService
GetDBService returns the singleton instance of DBService
func (*DBService) AutoCloseDB ¶
AutoCloseDB sets up automatic DB closing after a period of inactivity
func (*DBService) CloseDB ¶
func (s *DBService) CloseDB()
CloseDB explicitly closes the database - call this when the app is shutting down
func (*DBService) ReadOperation ¶
ReadOperation performs a read operation with timeout
func (*DBService) ReadOperationWithContext ¶
func (s *DBService) ReadOperationWithContext(ctx context.Context, operation func(*Store) error) error
ReadOperationWithContext performs a read operation with context and timeout
func (*DBService) ReadOperationWithRetry ¶
ReadOperationWithRetry performs a read operation with retries
func (*DBService) WithTimeout ¶
WithTimeout sets custom timeout for DB operations
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents a BadgerDB key-value store
type TemplateItem ¶
func GetTemplateSafe ¶
func GetTemplateSafe(slug string) (*TemplateItem, error)
GetTemplateSafe retrieves a template safely through the DB service
func ListTemplatesSafe ¶
func ListTemplatesSafe() ([]TemplateItem, error)
ListTemplatesSafe lists templates safely through the DB service
type TemplateStoreManager ¶
type TemplateStoreManager struct {
// contains filtered or unexported fields
}
func NewTemplateStoreManager ¶
func NewTemplateStoreManager(store *Store) *TemplateStoreManager
func (*TemplateStoreManager) CreateTemplate ¶
func (ts *TemplateStoreManager) CreateTemplate(template TemplateItem) error
func (*TemplateStoreManager) DeleteTemplate ¶
func (ts *TemplateStoreManager) DeleteTemplate(slug string) error
func (*TemplateStoreManager) ExportTemplate ¶
func (ts *TemplateStoreManager) ExportTemplate(slug string) (string, error)
func (*TemplateStoreManager) GetTemplate ¶
func (ts *TemplateStoreManager) GetTemplate(slug string) (*TemplateItem, error)
func (*TemplateStoreManager) ImportTemplate ¶
func (ts *TemplateStoreManager) ImportTemplate(jsonData string) error
func (*TemplateStoreManager) ListTemplates ¶
func (ts *TemplateStoreManager) ListTemplates() ([]TemplateItem, error)
func (*TemplateStoreManager) SearchTemplates ¶
func (ts *TemplateStoreManager) SearchTemplates(query string) ([]TemplateItem, error)
func (*TemplateStoreManager) UpdateTemplate ¶
func (ts *TemplateStoreManager) UpdateTemplate(template TemplateItem) error
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
Name string `json:"name"`
PreChecks []Atom `json:"pre_checks"`
Steps []Atom `json:"steps"`
Description *string `json:"description"`
Actions map[string]Atom `json:"actions"`
Config Config `json:"config"`
UsesSudo bool `json:"uses_sudo"`
}
func GetWorkflowSafe ¶
GetWorkflowSafe retrieves a workflow safely through the DB service
func ListWorkflowsSafe ¶
ListWorkflowsSafe lists workflows safely through the DB service
type WorkflowStore ¶
type WorkflowStore struct {
// contains filtered or unexported fields
}
func NewWorkflowStore ¶
func NewWorkflowStore(store *Store) *WorkflowStore
func (*WorkflowStore) CreateWorkflow ¶
func (ws *WorkflowStore) CreateWorkflow(id string, workflow Workflow) error
func (*WorkflowStore) DeleteWorkflow ¶
func (ws *WorkflowStore) DeleteWorkflow(id string) error
func (*WorkflowStore) ExportWorkflow ¶
func (ws *WorkflowStore) ExportWorkflow(id string) (string, error)
func (*WorkflowStore) GetWorkflow ¶
func (ws *WorkflowStore) GetWorkflow(id string) (*Workflow, error)
func (*WorkflowStore) ImportWorkflow ¶
func (ws *WorkflowStore) ImportWorkflow(id string, jsonData string) error
func (*WorkflowStore) ListWorkflows ¶
func (ws *WorkflowStore) ListWorkflows() ([]Workflow, error)
func (*WorkflowStore) RemoveStep ¶
func (ws *WorkflowStore) RemoveStep(id string, index int) error
func (*WorkflowStore) SearchWorkflows ¶
func (ws *WorkflowStore) SearchWorkflows(query string) ([]Workflow, error)
func (*WorkflowStore) UpdateConfig ¶
func (ws *WorkflowStore) UpdateConfig(id string, configMap map[string]interface{}) error
func (*WorkflowStore) UpdateWorkflow ¶
func (ws *WorkflowStore) UpdateWorkflow(id string, workflow Workflow) error