mongo

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	mongodriver.MongoDriverConfig
	// contains filtered or unexported fields
}

func NewDatastore

func NewDatastore(ctx context.Context, cfg config.MongoConfig) (m *Mongo, err error)

NewDatastore creates a new mongodb.MongoConnection with the given configuration

func (*Mongo) AcquireInstanceLock added in v1.18.0

func (m *Mongo) AcquireInstanceLock(ctx context.Context, jobID string) (lockID string, err error)

AcquireInstanceLock tries to lock the provided jobID. If the job is already locked, this function will block until it's released, at which point we acquire the lock and return. Note: the lock is currently only used to update processed_instances

func (*Mongo) AddJob

func (m *Mongo) AddJob(ctx context.Context, job *models.Job) (*models.Job, error)

AddJob adds an ImportJob document - the ID is assumed to be set

func (*Mongo) AddUploadedFile

func (m *Mongo) AddUploadedFile(ctx context.Context, id string, file *models.UploadedFile) error

AddUploadedFile adds an UploadedFile to an import job

func (*Mongo) Checker added in v1.9.0

func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker is called by the healthcheck library to check the health state of this mongoDB instance

func (*Mongo) Close

func (m *Mongo) Close(ctx context.Context) error

Close disconnects the mongo session

func (*Mongo) GetJob

func (m *Mongo) GetJob(ctx context.Context, id string) (*models.Job, error)

GetJob retrieves a single import job

func (*Mongo) GetJobs

func (m *Mongo) GetJobs(ctx context.Context, filters []string, offset int, limit int) (*models.JobResults, error)

GetJobs retrieves all import documents matching filters

func (*Mongo) UnlockInstance added in v1.18.0

func (m *Mongo) UnlockInstance(ctx context.Context, lockID string)

UnlockInstance releases an exclusive mongoDB lock for the provided lockId (if it exists) Note: the lock is currently only used to update processed_instances

func (*Mongo) UpdateJob

func (m *Mongo) UpdateJob(ctx context.Context, id string, job *models.Job) (err error)

UpdateJob adds or overides an existing import job

func (*Mongo) UpdateProcessedInstance added in v1.18.0

func (m *Mongo) UpdateProcessedInstance(ctx context.Context, id string, procInstances []models.ProcessedInstances) (err error)

UpdateProcessedInstance overides the processed instances for an existing import job

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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