cassandra

package
v0.0.0-...-519dc3d Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxJobStepLogRecord    = 20
	InsertJobQueryTemplate = `INSERT INTO job_info (` +
		`service, task, domain, job_date, job_id, user_id, engine, spec, started_time, finished_time, state, steps, detail, version) ` +
		`VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS USING TTL ?`
	InsertJobStepLogQueryTemplate = `INSERT INTO log_info (` +
		`service, task, domain, job_id, step_id, log_time, data) ` +
		`VALUES(?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS USING TTL ?`

	DeleteJobStepLogQueryTemplate = `DELETE FROM log_info ` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_id = ? ` +
		`and step_id = ?`

	DeleteJobLogQueryTemplate = `DELETE FROM log_info ` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_id = ? `

	DeleteJobQueryTemplate = `DELETE FROM job_info ` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_date = ? ` +
		`and job_id = ?`

	UpdateJobQueryTemplate = `UPDATE job_info ` +
		`SET started_time = ?, ` +
		`finished_time = ?, ` +
		`state = ?, ` +
		`steps = ?, ` +
		`detail = ?, ` +
		`version = ?` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_date = ? ` +
		`and job_id = ?` +
		`IF version = ?`
	GetJobQueryTemplate = `SELECT service, task, domain, job_id, user_id, engine, spec, started_time, finished_time, state, steps, detail, version ` +
		`FROM job_info ` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_date = ? ` +
		`and job_id IN ? `

	GetJobLogQueryTemplate = `SELECT log_time, data ` +
		`FROM log_info ` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_id = ? ` +
		`and step_id = ?` +
		`and log_time > ?` +
		`LIMIT ?`

	GetJobLastLogQueryTemplate = `SELECT data ` +
		`FROM log_info ` +
		`WHERE service = ? ` +
		`and task = ? ` +
		`and domain = ? ` +
		`and job_id = ? ` +
		`and step_id = ?` +
		`ORDER BY log_time DESC LIMIT 1`
)
View Source
const (
	PluginName = "cassandra"
)

Variables

This section is empty.

Functions

func NewJobStore

func NewJobStore(config appconfig.PersistentStore, logger *zap.Logger) (common.JobStore, error)

Types

type Batch

type Batch interface {
	Query(string, ...interface{})
	WithContext(context.Context) Batch
	WithTimestamp(int64) Batch
}

type Iter

type Iter interface {
	Scan(...interface{}) bool
	MapScan(map[string]interface{}) bool
	PageState() []byte
	Close() error
}

Iter is the interface for executing and iterating over all resulting rows.

type Query

type Query interface {
	Exec() error
	Scan(...interface{}) error
	ScanCAS(...interface{}) (bool, error)
	MapScan(map[string]interface{}) error
	MapScanCAS(map[string]interface{}) (bool, error)
	Iter() Iter
	PageSize(int) Query
	PageState([]byte) Query
	WithContext(context.Context) Query
	WithTimestamp(int64) Query
	Bind(...interface{}) Query
}

type Session

type Session struct {
	atomic.Value
	// contains filtered or unexported fields
}

func NewSession

func NewSession(config appconfig.PersistentStore, logger *zap.Logger) (*Session, error)

func (*Session) Close

func (s *Session) Close()

func (*Session) Query

func (s *Session) Query(
	stmt string,
	values ...interface{},
) Query

type Store

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

func (*Store) BatchGetJobs

func (s *Store) BatchGetJobs(ctx context.Context, jobID common.JobIdentity, IDs []string) ([]common.Job, error)

func (*Store) Close

func (s *Store) Close()

func (*Store) CreateJob

func (s *Store) CreateJob(ctx context.Context, job *common.Job, ttl int64) error

func (*Store) DeleteJob

func (s *Store) DeleteJob(ctx context.Context, jobID common.JobIdentity) error

func (*Store) DeleteJobLog

func (s *Store) DeleteJobLog(ctx context.Context, jobID common.JobIdentity) error

func (*Store) DeleteJobStepLog

func (s *Store) DeleteJobStepLog(ctx context.Context, log *common.JobStepLog) error

func (*Store) GetJob

func (s *Store) GetJob(ctx context.Context, jobID common.JobIdentity) (common.Job, error)

func (*Store) GetJobStepLogs

func (s *Store) GetJobStepLogs(ctx context.Context, jobID common.JobIdentity, stepID string, startTime string, maxRecord int) (*common.JobLogPart, error)

func (*Store) GetName

func (s *Store) GetName() string

func (*Store) GetReloadDirs

func (s *Store) GetReloadDirs() []string

func (*Store) Initialize

func (s *Store) Initialize() error

func (*Store) InsertJobStepLog

func (s *Store) InsertJobStepLog(ctx context.Context, log *common.JobStepLog, ttl int64) error

func (*Store) JobStepLogFinished

func (s *Store) JobStepLogFinished(ctx context.Context, jobID common.JobIdentity, stepID string) bool

func (*Store) Reload

func (s *Store) Reload()

func (*Store) UpdateJobStatus

func (s *Store) UpdateJobStatus(ctx context.Context, job *common.Job, version int32) error

Jump to

Keyboard shortcuts

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