Documentation
¶
Index ¶
- type Mongo
- func (m *Mongo) AcquireImageLock(ctx context.Context, imageID string) (lockID string, err error)
- func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (m *Mongo) Close(ctx context.Context) error
- func (m *Mongo) GetImage(ctx context.Context, id string) (*models.Image, error)
- func (m *Mongo) GetImages(ctx context.Context, collectionID string) ([]models.Image, error)
- func (m *Mongo) Init(ctx context.Context, shouldEnableReadConcern, shouldEnableWriteConcern bool) (err error)
- func (m *Mongo) UnlockImage(ctx context.Context, lockID string)
- func (m *Mongo) UpdateImage(ctx context.Context, id string, image *models.Image) (bool, error)
- func (m *Mongo) UpsertImage(ctx context.Context, id string, image *models.Image) (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
Connection *dpMongoDriver.MongoConnection
URI string
Username string
Password string
IsSSL bool
// contains filtered or unexported fields
}
Mongo represents a simplistic MongoDB configuration, with session, health and lock clients
func (*Mongo) AcquireImageLock ¶ added in v0.8.0
AcquireImageLock tries to lock the provided imageID. If the image is already locked, this function will block until it's released, at which point we acquire the lock and return.
func (*Mongo) Checker ¶
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) GetImages ¶ added in v0.3.0
GetImages retrieves all images documents corresponding to the provided collectionID
func (*Mongo) Init ¶
func (m *Mongo) Init(ctx context.Context, shouldEnableReadConcern, shouldEnableWriteConcern bool) (err error)
Init creates a new mongodb.MongoConnection with a strong consistency and a write mode of "majority".
func (*Mongo) UnlockImage ¶ added in v0.8.0
UnlockImage releases an exclusive mongoDB lock for the provided lockId (if it exists)
func (*Mongo) UpdateImage ¶ added in v0.3.0
UpdateImage updates an existing image document