pgnotifier

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WaitingState   = "waiting"
	ExecutingState = "executing"
	SucceededState = "succeeded"
	FailedState    = "failed"
	AbortedState   = "aborted"
)
View Source
const (
	AsyncJobType  = "async_job"
	UploadJobType = "upload"
)
View Source
const MaxTrackAsyncBatchRetries = 5

Variables

This section is empty.

Functions

func CheckForPGNotifierEnvVars added in v0.1.10

func CheckForPGNotifierEnvVars() bool

CheckForPGNotifierEnvVars Checks if all the required Env Variables for PG Notifier are present

func GetCurrentSQLTimestamp

func GetCurrentSQLTimestamp() string

GetCurrentSQLTimestamp to get sql complaint current datetime string

func GetPGNotifierConnectionString added in v0.1.10

func GetPGNotifierConnectionString() string

GetPGNotifierConnectionString Returns PG Notifier DB Connection Configuration

func Init added in v0.1.10

func Init()

Types

type Claim added in v1.7.0

type Claim struct {
	ID        int64
	BatchID   string
	Status    string
	Workspace string
	Payload   json.RawMessage
	Attempt   int
	JobType   string
}

type ClaimResponse added in v1.7.0

type ClaimResponse struct {
	Payload json.RawMessage
	Err     error
}

type JobPayload added in v0.1.10

type JobPayload json.RawMessage

type JobsResponse added in v1.2.0

type JobsResponse struct {
	Status    string
	Output    json.RawMessage
	Error     string
	JobType   string
	JobRunID  string
	TaskRunID string
}

type MessagePayload added in v1.2.0

type MessagePayload struct {
	Jobs    []JobPayload
	JobType string
}

type PGNotifier added in v1.7.0

type PGNotifier struct {
	URI string
	// contains filtered or unexported fields
}

func New

func New(workspaceIdentifier, fallbackConnectionInfo string) (notifier PGNotifier, err error)

New Given default connection info return pg notifier object from it

func (PGNotifier) ClearJobs added in v1.7.0

func (notifier PGNotifier) ClearJobs(ctx context.Context) (err error)

func (PGNotifier) GetDBHandle added in v1.7.0

func (notifier PGNotifier) GetDBHandle() *sql.DB

func (*PGNotifier) Publish added in v1.7.0

func (notifier *PGNotifier) Publish(payload MessagePayload, schema *whUtils.Schema, priority int) (ch chan []Response, err error)

func (*PGNotifier) RunMaintenanceWorker added in v1.7.0

func (notifier *PGNotifier) RunMaintenanceWorker(ctx context.Context) error

RunMaintenanceWorker (blocking - to be called from go routine) re-triggers zombie jobs which were left behind by dead workers in executing state

func (*PGNotifier) Subscribe added in v1.7.0

func (notifier *PGNotifier) Subscribe(ctx context.Context, workerId string, jobsBufferSize int) chan Claim

func (*PGNotifier) UpdateClaimedEvent added in v1.7.0

func (notifier *PGNotifier) UpdateClaimedEvent(claim *Claim, response *ClaimResponse)

type Response added in v1.7.0

type Response struct {
	JobID   int64
	Status  string
	Output  json.RawMessage
	Error   string
	JobType string
}

Jump to

Keyboard shortcuts

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