mock

package
v0.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// workflow
	CreateWorkflowFunc               func(ctx context.Context, wf db.Workflow, data string, id uuid.UUID) error
	GetWorkflowFunc                  func(ctx context.Context, id string) (db.Workflow, error)
	GetfromWfDataTableFunc           func(ctx context.Context, req *pb.GetWorkflowDataRequest) ([]byte, error)
	InsertIntoWfDataTableFunc        func(ctx context.Context, req *pb.UpdateWorkflowDataRequest) error
	GetWorkflowMetadataFunc          func(ctx context.Context, req *pb.GetWorkflowDataRequest) ([]byte, error)
	GetWorkflowDataVersionFunc       func(ctx context.Context, workflowID string) (int32, error)
	GetWorkflowsForWorkerFunc        func(ctx context.Context, id string) ([]string, error)
	GetWorkflowContextsFunc          func(ctx context.Context, wfID string) (*pb.WorkflowContext, error)
	GetWorkflowActionsFunc           func(ctx context.Context, wfID string) (*pb.WorkflowActionList, error)
	UpdateWorkflowStateFunc          func(ctx context.Context, wfContext *pb.WorkflowContext) error
	InsertIntoWorkflowEventTableFunc func(ctx context.Context, wfEvent *pb.WorkflowActionStatus, time time.Time) error
	// template
	TemplateDB      map[string]interface{}
	GetTemplateFunc func(ctx context.Context, fields map[string]string, deleted bool) (*tb.WorkflowTemplate, error)
}

DB is the mocked implementation of Database interface.

func (*DB) ClearTemplateDB added in v0.2.0

func (d *DB) ClearTemplateDB()

ClearTemplateDB clear all the templates.

func (*DB) CreateTemplate

func (d *DB) CreateTemplate(_ context.Context, name string, data string, id uuid.UUID) error

CreateTemplate creates a new workflow template.

func (DB) CreateWorkflow

func (d DB) CreateWorkflow(ctx context.Context, wf db.Workflow, data string, id uuid.UUID) error

CreateWorkflow creates a new workflow.

func (DB) DeleteFromDB

func (d DB) DeleteFromDB(_ context.Context, _ string) error

DeleteFromDB : delete data from hardware table.

func (DB) DeleteTemplate

func (d DB) DeleteTemplate(_ context.Context, name string) error

DeleteTemplate deletes a workflow template.

func (DB) DeleteWorkflow

func (d DB) DeleteWorkflow(_ context.Context, _ string, _ int32) error

DeleteWorkflow deletes a workflow.

func (DB) GetAll

func (d DB) GetAll(_ func([]byte) error) error

GetAll : get data for all machine.

func (DB) GetByID

func (d DB) GetByID(_ context.Context, _ string) (string, error)

GetByID : get data by machine id.

func (DB) GetByIP

func (d DB) GetByIP(_ context.Context, _ string) (string, error)

GetByIP : get data by machine ip.

func (DB) GetByMAC

func (d DB) GetByMAC(_ context.Context, _ string) (string, error)

GetByMAC : get data by machine mac.

func (DB) GetTemplate

func (d DB) GetTemplate(ctx context.Context, fields map[string]string, deleted bool) (*tb.WorkflowTemplate, error)

GetTemplate returns a workflow template.

func (DB) GetWorkflow

func (d DB) GetWorkflow(ctx context.Context, id string) (db.Workflow, error)

GetWorkflow returns a workflow.

func (DB) GetWorkflowActions

func (d DB) GetWorkflowActions(ctx context.Context, wfID string) (*pb.WorkflowActionList, error)

GetWorkflowActions : gives you the action list of workflow.

func (DB) GetWorkflowContexts

func (d DB) GetWorkflowContexts(ctx context.Context, wfID string) (*pb.WorkflowContext, error)

GetWorkflowContexts : gives you the current workflow context.

func (DB) GetWorkflowDataVersion

func (d DB) GetWorkflowDataVersion(ctx context.Context, workflowID string) (int32, error)

GetWorkflowDataVersion returns the latest version of data for a workflow.

func (DB) GetWorkflowMetadata

func (d DB) GetWorkflowMetadata(ctx context.Context, req *pb.GetWorkflowDataRequest) ([]byte, error)

GetWorkflowMetadata returns metadata wrt to the ephemeral data of a workflow.

func (DB) GetWorkflowsForWorker

func (d DB) GetWorkflowsForWorker(ctx context.Context, id string) ([]string, error)

GetWorkflowsForWorker : returns the list of workflows for a particular worker.

func (DB) GetfromWfDataTable

func (d DB) GetfromWfDataTable(ctx context.Context, req *pb.GetWorkflowDataRequest) ([]byte, error)

GetfromWfDataTable : Give you the ephemeral data from workflow_data table.

func (DB) InsertIntoDB

func (d DB) InsertIntoDB(_ context.Context, _ string) error

InsertIntoDB : insert data into hardware table.

func (DB) InsertIntoWfDataTable

func (d DB) InsertIntoWfDataTable(ctx context.Context, req *pb.UpdateWorkflowDataRequest) error

InsertIntoWfDataTable : Insert ephemeral data in workflow_data table.

func (DB) InsertIntoWorkflowEventTable

func (d DB) InsertIntoWorkflowEventTable(ctx context.Context, wfEvent *pb.WorkflowActionStatus, t time.Time) error

InsertIntoWorkflowEventTable : insert workflow event table.

func (DB) ListTemplates

func (d DB) ListTemplates(_ string, _ func(id, n string, in, del *timestamp.Timestamp) error) error

ListTemplates returns all saved templates.

func (DB) ListWorkflows

func (d DB) ListWorkflows(_ func(wf db.Workflow) error) error

ListWorkflows returns all workflows.

func (DB) ShowWorkflowEvents

func (d DB) ShowWorkflowEvents(_ string, _ func(wfs *pb.WorkflowActionStatus) error) error

ShowWorkflowEvents returns all workflows.

func (DB) UpdateTemplate

func (d DB) UpdateTemplate(_ context.Context, _ string, _ string, _ uuid.UUID) error

UpdateTemplate update a given template.

func (DB) UpdateWorkflow

func (d DB) UpdateWorkflow(_ context.Context, _ db.Workflow, _ int32) error

UpdateWorkflow updates a given workflow.

func (DB) UpdateWorkflowState

func (d DB) UpdateWorkflowState(ctx context.Context, wfContext *pb.WorkflowContext) error

UpdateWorkflowState : update the current workflow state.

type Template added in v0.2.0

type Template struct {
	ID      uuid.UUID
	Data    string
	Deleted bool
}

Jump to

Keyboard shortcuts

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