Documentation ¶
Index ¶
- type Mongo
- func (m *Mongo) AcquireInstanceLock(ctx context.Context, jobID string) (lockID string, err error)
- func (m *Mongo) AddJob(job *models.Job) (*models.Job, error)
- func (m *Mongo) AddUploadedFile(id string, file *models.UploadedFile) error
- func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (m *Mongo) Close(ctx context.Context) error
- func (m *Mongo) GetJob(id string) (*models.Job, error)
- func (m *Mongo) GetJobs(ctx context.Context, filters []string, offset int, limit int) (*models.JobResults, error)
- func (m *Mongo) UnlockInstance(lockID string)
- func (m *Mongo) UpdateJob(id string, job *models.Job) (err error)
- func (m *Mongo) UpdateProcessedInstance(id string, procInstances []models.ProcessedInstances) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mongo ¶
type Mongo struct { Collection string Database string URI string Session *mgo.Session // contains filtered or unexported fields }
Mongo represents a simplistic MongoDB configuration
func NewDatastore ¶
NewDatastore creates a new mgo.Session with a strong consistency and a write mode of "majority"
func (*Mongo) AcquireInstanceLock ¶ added in v1.18.0
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) AddUploadedFile ¶
func (m *Mongo) AddUploadedFile(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) 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
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) UpdateProcessedInstance ¶ added in v1.18.0
func (m *Mongo) UpdateProcessedInstance(id string, procInstances []models.ProcessedInstances) (err error)
UpdateProcessedInstance overides the processed instances for an existing import job