mock

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 9 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(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) (string, string, string, 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(ctx 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(ctx context.Context, id string) error

DeleteFromDB : delete data from hardware table

func (DB) DeleteTemplate

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

DeleteTemplate deletes a workflow template

func (DB) DeleteWorkflow

func (d DB) DeleteWorkflow(ctx context.Context, id string, state int32) error

DeleteWorkflow deletes a workflow

func (DB) Events added in v0.3.0

func (d DB) Events(req *events.WatchRequest, fn func(n informers.Notification) error) error

Events fetches events for a given time frame, and sends them to over the stream

func (DB) GetAll

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

GetAll : get data for all machine

func (DB) GetByID

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

GetByID : get data by machine id

func (DB) GetByIP

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

GetByIP : get data by machine ip

func (DB) GetByMAC

func (d DB) GetByMAC(ctx context.Context, mac 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) (string, string, string, 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(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(ctx context.Context, data 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, time time.Time) error

InsertIntoWorkflowEventTable : insert workflow event table

func (DB) ListTemplates

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

ListTemplates returns all saved templates

func (DB) ListWorkflows

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

ListWorkflows returns all workflows

func (DB) ShowWorkflowEvents

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

ShowWorkflowEvents returns all workflows

func (DB) UpdateTemplate

func (d DB) UpdateTemplate(ctx context.Context, name string, data string, id uuid.UUID) error

UpdateTemplate update a given template

func (DB) UpdateWorkflow

func (d DB) UpdateWorkflow(ctx context.Context, wf db.Workflow, state 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