rsources

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package rsources is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var StatusNotFoundError = errors.New("Status not found")

Functions

This section is empty.

Types

type DestinationStatus

type DestinationStatus struct {
	ID        string `json:"id"`
	Completed bool   `json:"completed"`
	Stats     Stats  `json:"stats"`
}

type FailedRecords

type FailedRecords struct{}

type JobFilter

type JobFilter struct {
	TaskRunID []string
	SourceID  []string
}

type JobService

type JobService interface {
	StatsIncrementer

	// Delete deletes all relevant information for a given jobRunId
	Delete(ctx context.Context, jobRunId string) error

	// GetStatus gets the current status of a job
	GetStatus(ctx context.Context, jobRunId string, filter JobFilter) (JobStatus, error)

	// TODO: future extension
	AddFailedRecords(ctx context.Context, tx *sql.Tx, jobRunId string, key JobTargetKey, records []json.RawMessage) error

	// TODO: future extension
	GetFailedRecords(ctx context.Context, tx *sql.Tx, jobRunId string, filter JobFilter) (FailedRecords, error)

	// CleanupLoop starts the cleanup loop in the background which will stop upon context termination or in case of an error
	CleanupLoop(ctx context.Context) error
}

JobService manages information about jobs created by rudder-sources

func NewJobService

func NewJobService(config JobServiceConfig) (JobService, error)

func NewNoOpService

func NewNoOpService() JobService

type JobServiceConfig added in v0.1.11

type JobServiceConfig struct {
	LocalHostname          string
	LocalConn              string
	MaxPoolSize            int
	SharedConn             string
	SubscriptionTargetConn string
}

type JobStatus

type JobStatus struct {
	ID          string       `json:"id"`
	TasksStatus []TaskStatus `json:"tasks"`
}

type JobTargetKey

type JobTargetKey struct {
	TaskRunID     string `json:"source_task_run_id"`
	SourceID      string `json:"source_id"`
	DestinationID string `json:"destination_id"`
}

type MockJobService

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

MockJobService is a mock of JobService interface.

func NewMockJobService

func NewMockJobService(ctrl *gomock.Controller) *MockJobService

NewMockJobService creates a new mock instance.

func (*MockJobService) AddFailedRecords

func (m *MockJobService) AddFailedRecords(ctx context.Context, tx *sql.Tx, jobRunId string, key JobTargetKey, records []json.RawMessage) error

AddFailedRecords mocks base method.

func (*MockJobService) CleanupLoop

func (m *MockJobService) CleanupLoop(ctx context.Context) error

CleanupLoop mocks base method.

func (*MockJobService) Delete

func (m *MockJobService) Delete(ctx context.Context, jobRunId string) error

Delete mocks base method.

func (*MockJobService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJobService) GetFailedRecords

func (m *MockJobService) GetFailedRecords(ctx context.Context, tx *sql.Tx, jobRunId string, filter JobFilter) (FailedRecords, error)

GetFailedRecords mocks base method.

func (*MockJobService) GetStatus

func (m *MockJobService) GetStatus(ctx context.Context, jobRunId string, filter JobFilter) (JobStatus, error)

GetStatus mocks base method.

func (*MockJobService) IncrementStats

func (m *MockJobService) IncrementStats(ctx context.Context, tx *sql.Tx, jobRunId string, key JobTargetKey, stats Stats) error

IncrementStats mocks base method.

type MockJobServiceMockRecorder

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

MockJobServiceMockRecorder is the mock recorder for MockJobService.

func (*MockJobServiceMockRecorder) AddFailedRecords

func (mr *MockJobServiceMockRecorder) AddFailedRecords(ctx, tx, jobRunId, key, records interface{}) *gomock.Call

AddFailedRecords indicates an expected call of AddFailedRecords.

func (*MockJobServiceMockRecorder) CleanupLoop

func (mr *MockJobServiceMockRecorder) CleanupLoop(ctx interface{}) *gomock.Call

CleanupLoop indicates an expected call of CleanupLoop.

func (*MockJobServiceMockRecorder) Delete

func (mr *MockJobServiceMockRecorder) Delete(ctx, jobRunId interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockJobServiceMockRecorder) GetFailedRecords

func (mr *MockJobServiceMockRecorder) GetFailedRecords(ctx, tx, jobRunId, filter interface{}) *gomock.Call

GetFailedRecords indicates an expected call of GetFailedRecords.

func (*MockJobServiceMockRecorder) GetStatus

func (mr *MockJobServiceMockRecorder) GetStatus(ctx, jobRunId, filter interface{}) *gomock.Call

GetStatus indicates an expected call of GetStatus.

func (*MockJobServiceMockRecorder) IncrementStats

func (mr *MockJobServiceMockRecorder) IncrementStats(ctx, tx, jobRunId, key, stats interface{}) *gomock.Call

IncrementStats indicates an expected call of IncrementStats.

type MockStatsIncrementer

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

MockStatsIncrementer is a mock of StatsIncrementer interface.

func NewMockStatsIncrementer

func NewMockStatsIncrementer(ctrl *gomock.Controller) *MockStatsIncrementer

NewMockStatsIncrementer creates a new mock instance.

func (*MockStatsIncrementer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStatsIncrementer) IncrementStats

func (m *MockStatsIncrementer) IncrementStats(ctx context.Context, tx *sql.Tx, jobRunId string, key JobTargetKey, stats Stats) error

IncrementStats mocks base method.

type MockStatsIncrementerMockRecorder

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

MockStatsIncrementerMockRecorder is the mock recorder for MockStatsIncrementer.

func (*MockStatsIncrementerMockRecorder) IncrementStats

func (mr *MockStatsIncrementerMockRecorder) IncrementStats(ctx, tx, jobRunId, key, stats interface{}) *gomock.Call

IncrementStats indicates an expected call of IncrementStats.

type SourceStatus

type SourceStatus struct {
	ID                 string              `json:"id"`
	Completed          bool                `json:"completed"`
	Stats              Stats               `json:"stats"`
	DestinationsStatus []DestinationStatus `json:"destinations"`
}

type Stats

type Stats struct {
	In     uint `json:"in"`
	Out    uint `json:"out"`
	Failed uint `json:"failed"`
}

type StatsCollector

type StatsCollector interface {

	// JobsStored captures incoming job statistics
	JobsStored(jobs []*jobsdb.JobT)

	// JobsStoredWithErrors captures incoming job statistics
	JobsStoredWithErrors(jobs []*jobsdb.JobT, failedJobs map[uuid.UUID]string)

	// BeginProcessing prepares the necessary indices in order to
	// be ready for capturing JobStatus statistics
	BeginProcessing(jobs []*jobsdb.JobT)

	// JobStatusesUpdated captures outgoing job statistics.
	// A call to BeginProcessing must preceed a call to this method,
	// so that all necessary indices can been created, since a JobStatus
	// doesn't carry all necessary job metadata such as jobRunId, taskRunId, etc.
	JobStatusesUpdated(jobStatuses []*jobsdb.JobStatusT)

	// Publish publishes statistics
	Publish(ctx context.Context, tx *sql.Tx) error
}

StatsCollector collects and publishes stats as jobs are being created, processed and their statuses are being updated.

func NewStatsCollector

func NewStatsCollector(incrementer StatsIncrementer) StatsCollector

NewStatsCollector creates a new stats collector

type StatsIncrementer

type StatsIncrementer interface {
	// IncrementStats increments the existing statistic counters
	// for a specific job measurement.
	IncrementStats(ctx context.Context, tx *sql.Tx, jobRunId string, key JobTargetKey, stats Stats) error
}

StatsIncrementer increments stats

type TaskStatus

type TaskStatus struct {
	ID            string         `json:"id"`
	SourcesStatus []SourceStatus `json:"sources"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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