db

package
v0.0.0-...-cce48a0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("object not found")

Functions

This section is empty.

Types

type ContractConfigCollection

type ContractConfigCollection interface {
	SetContractConfig(
		ctx context.Context,
		config *model.JobContractConfig,
	) error

	GetContractConfig(
		ctx context.Context,
	) (*model.JobContractConfig, error)
}

type DBService

type DBService interface {
	JobCollection

	DBName() string
	Client() *mongo.Client
	Connection() dbconn.Conn
	String() string
	Close()
}

func NewDBService

func NewDBService(
	conn dbconn.Conn,
) (DBService, error)

type ExternalGorm

type ExternalGorm interface {
	CreateJob(ctx context.Context, job *model.Job) error
	LoadJobs(ctx context.Context) ([]*model.Job, error)
	DeleteJob(ctx context.Context, jobID string) error

	Client() *gorm.DB
	Connection() (*sql.DB, error)
	String() string
}

func NewExternalPostgres

func NewExternalPostgres(u *url.URL) (ExternalGorm, error)

type JobCollection

type JobCollection interface {
	UpsertJob(
		ctx context.Context,
		spec *model.Job,
	) error

	DeleteJob(
		ctx context.Context,
		jobID model.ID,
	) error

	ListJobs(
		ctx context.Context,
		cursor *model.Cursor,
	) ([]*model.Job, error)
}

type JobDBService

func NewJobDBService

func NewJobDBService(
	conn dbconn.Conn,
	jobID string,
) (JobDBService, error)

type PeerAnnouncementCollection

type PeerAnnouncementCollection interface {
	UpsertAnnouncement(
		ctx context.Context,
		ann *model.JobPeerAnnouncement,
	) error

	ListAnnouncements(
		ctx context.Context,
		peerIDs []string,
		cursor *model.Cursor,
	) ([]*model.JobPeerAnnouncement, error)
}

type PendingTransmissionCollection

type PendingTransmissionCollection interface {
	InsertPendingTranmission(
		ctx context.Context,
		pendingTx *model.JobPendingTransmission,
	) error

	ListPendingTransmissions(
		ctx context.Context,
		configDigest model.ID,
		cursor *model.Cursor,
	) ([]*model.JobPendingTransmission, error)

	DeletePendingTransmission(
		ctx context.Context,
		reportTimestamp model.ReportTimestamp,
	) error

	DeletePendingTransmissionsOlderThan(
		ctx context.Context,
		timestamp time.Time,
	) error
}

type PersistentStateCollection

type PersistentStateCollection interface {
	SetPersistentState(
		ctx context.Context,
		state *model.JobPersistentState,
	) error

	GetPersistentState(
		ctx context.Context,
		configDigest model.ID,
	) (*model.JobPersistentState, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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