Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Db is the main databse connection Db *gorm.DB Dbx *sqlx.DB Conn database.Connection // DropAll signifies to drop all tables and recreate them DropAll = false )
View Source
var Store = cmap.New[*Execution]()
Functions ¶
func GetMachineID ¶ added in v1.2.15
func GetMachineID() string
func StoreSet ¶ added in v1.3.3
func StoreSet(t *sling.TaskExecution)
Store saves the task into the local sqlite
func ToConfigObject ¶
func ToConfigObject(t *sling.TaskExecution) (task *Task, replication *Replication)
Types ¶
type Execution ¶
type Execution struct { // ID auto-increments ID int64 `json:"id,omitempty" gorm:"primaryKey"` ExecID string `json:"exec_id,omitempty" gorm:"index"` // StreamID represents the stream inside the replication that is running. // Is an MD5 construct:`md5(Source, Target, Stream, Object)`. StreamID string `json:"stream_id,omitempty" sql:"not null" gorm:"index"` // ConfigMD5 points to config table. not null TaskMD5 string `json:"task_md5,omitempty" sql:"not null" gorm:"index"` ReplicationMD5 string `json:"replication_md5,omitempty" sql:"not null" gorm:"index"` Status sling.ExecStatus `json:"status,omitempty" gorm:"index"` Err *string `json:"error,omitempty"` StartTime *time.Time `json:"start_time,omitempty" gorm:"index"` EndTime *time.Time `json:"end_time,omitempty" gorm:"index"` Bytes uint64 `json:"bytes,omitempty"` ExitCode int `json:"exit_code,omitempty"` Output string `json:"output,omitempty" sql:"default ''"` Rows uint64 `json:"rows,omitempty"` Pid int `json:"pid,omitempty"` Version string `json:"version,omitempty"` // ProjectID represents the project or the repository. // If .git exists, grab first commit with `git rev-list --max-parents=0 HEAD`. // if not, use md5 of path of folder. Can be `null` if using task. ProjectID *string `json:"project_id,omitempty" gorm:"index"` // FilePath represents the path to a file. // We would need this to refer back to the same file, even if // the contents change. So this should just be the relative path // of the replication.yaml or task.yaml from the root of the project. // If Ad-hoc from CLI flags, let it be `null`. FilePath *string `json:"file_path,omitempty" gorm:"index"` // WorkPath is where the sling process ran from WorkPath *string `json:"work_path,omitempty"` CreatedDt time.Time `json:"created_dt,omitempty" gorm:"autoCreateTime"` UpdatedDt time.Time `json:"updated_dt,omitempty" gorm:"autoUpdateTime"` Task *Task `json:"task,omitempty" gorm:"-"` Replication *Replication `json:"replication,omitempty" gorm:"-"` TaskExec *sling.TaskExecution `json:"-" gorm:"-"` }
Execution is a task execute in the store. PK = exec_id + stream_id
func ToExecutionObject ¶
func ToExecutionObject(t *sling.TaskExecution) *Execution
Store saves the task into the local sqlite
type Replication ¶
type Replication struct { Name string `json:"name" gorm:"index"` ProjectID *string `json:"project_id,omitempty" gorm:"index"` // MD5 is MD5 of Config json string MD5 string `json:"md5" gorm:"primaryKey"` Type sling.JobType `json:"type" gorm:"index"` Config string `json:"config"` // Original config ID *string `json:"id" gorm:"index"` CreatedDt time.Time `json:"created_dt" gorm:"autoCreateTime"` UpdatedDt time.Time `json:"updated_dt" gorm:"autoUpdateTime"` }
func (*Replication) Scan ¶ added in v1.2.10
func (r *Replication) Scan(value interface{}) error
Scan scan value into Jsonb, implements sql.Scanner interface
type Task ¶
type Task struct { ProjectID *string `json:"project_id,omitempty" gorm:"index"` // MD5 is MD5 of Config json string MD5 string `json:"md5" gorm:"primaryKey"` Type sling.JobType `json:"type" gorm:"index"` Config sling.Config `json:"config"` CreatedDt time.Time `json:"created_dt" gorm:"autoCreateTime"` UpdatedDt time.Time `json:"updated_dt" gorm:"autoUpdateTime"` }
Click to show internal directories.
Click to hide internal directories.