shared

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateShardState

func UpdateShardState(
	nodeID string,
	shardIndex int,
	jobState *model.JobState,
	update model.JobShardState,
) error

Types

type GenericSQLDatastore

type GenericSQLDatastore struct {
	// contains filtered or unexported fields
}

func NewGenericSQLDatastore

func NewGenericSQLDatastore(
	db *sql.DB,
	name string,
	connectionString string,
) (*GenericSQLDatastore, error)

func (*GenericSQLDatastore) AddEvent

func (d *GenericSQLDatastore) AddEvent(ctx context.Context, jobID string, ev model.JobEvent) error

func (*GenericSQLDatastore) AddJob

func (d *GenericSQLDatastore) AddJob(ctx context.Context, j *model.Job) error

func (*GenericSQLDatastore) AddLocalEvent

func (d *GenericSQLDatastore) AddLocalEvent(ctx context.Context, jobID string, ev model.JobLocalEvent) error

func (*GenericSQLDatastore) GetDB

func (d *GenericSQLDatastore) GetDB() *sql.DB

func (*GenericSQLDatastore) GetJob

func (d *GenericSQLDatastore) GetJob(ctx context.Context, id string) (*model.Job, error)

func (*GenericSQLDatastore) GetJobEvents

func (d *GenericSQLDatastore) GetJobEvents(ctx context.Context, id string) ([]model.JobEvent, error)

func (*GenericSQLDatastore) GetJobLocalEvents

func (d *GenericSQLDatastore) GetJobLocalEvents(ctx context.Context, id string) ([]model.JobLocalEvent, error)

func (*GenericSQLDatastore) GetJobState

func (d *GenericSQLDatastore) GetJobState(ctx context.Context, jobID string) (model.JobState, error)

func (*GenericSQLDatastore) GetJobs

func (d *GenericSQLDatastore) GetJobs(ctx context.Context, query localdb.JobQuery) ([]*model.Job, error)

func (*GenericSQLDatastore) GetJobsCount

func (d *GenericSQLDatastore) GetJobsCount(ctx context.Context, query localdb.JobQuery) (int, error)

func (*GenericSQLDatastore) GetMigrations

func (d *GenericSQLDatastore) GetMigrations() (*migrate.Migrate, error)

func (*GenericSQLDatastore) HasLocalEvent

func (d *GenericSQLDatastore) HasLocalEvent(ctx context.Context, jobID string, eventFilter localdb.LocalEventFilter) (bool, error)

func (*GenericSQLDatastore) MigrateDown

func (d *GenericSQLDatastore) MigrateDown() error

func (*GenericSQLDatastore) MigrateUp

func (d *GenericSQLDatastore) MigrateUp() error

func (*GenericSQLDatastore) UpdateJobDeal

func (d *GenericSQLDatastore) UpdateJobDeal(ctx context.Context, jobID string, deal model.Deal) error

func (*GenericSQLDatastore) UpdateShardState

func (d *GenericSQLDatastore) UpdateShardState(
	ctx context.Context,
	jobID, nodeID string,
	shardIndex int,
	update model.JobShardState,
) error

type GenericSQLSuite

type GenericSQLSuite struct {
	suite.Suite
	SetupHandler    func() *GenericSQLDatastore
	TeardownHandler func()
	// contains filtered or unexported fields
}

func (*GenericSQLSuite) SetupTest

func (suite *GenericSQLSuite) SetupTest()

func (*GenericSQLSuite) TearDownSuite

func (suite *GenericSQLSuite) TearDownSuite()

func (*GenericSQLSuite) TestAddingTwoJobs

func (suite *GenericSQLSuite) TestAddingTwoJobs()

func (*GenericSQLSuite) TestGetJobs

func (suite *GenericSQLSuite) TestGetJobs()

func (*GenericSQLSuite) TestJobEvents

func (suite *GenericSQLSuite) TestJobEvents()

func (*GenericSQLSuite) TestJobState

func (suite *GenericSQLSuite) TestJobState()

func (*GenericSQLSuite) TestRoundtripJob

func (suite *GenericSQLSuite) TestRoundtripJob()

func (*GenericSQLSuite) TestSQLiteMigrations

func (suite *GenericSQLSuite) TestSQLiteMigrations()

func (*GenericSQLSuite) TestUpdateDeal

func (suite *GenericSQLSuite) TestUpdateDeal()

type SQLClient

type SQLClient interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
}

SQLClient is so we can pass *sql.DB and *sql.Tx to the same functions

Jump to

Keyboard shortcuts

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