mongo

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 13 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 NewMongoStore added in v1.3.0

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

NewMongoStore creates a new Mongo object encapsulating a connection to the mongo server/cluster with the given configuration, and a health client to check the health of the mongo server/cluster

func (*Mongo) AcquireImageLock added in v0.8.0

func (m *Mongo) AcquireImageLock(ctx context.Context, imageID string) (lockID string, err error)

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) Close

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

Close closes the mongo session and returns any error

func (*Mongo) GetImage added in v0.3.0

func (m *Mongo) GetImage(ctx context.Context, id string) (*models.Image, error)

GetImage retrieves an image document by its ID

func (*Mongo) GetImages added in v0.3.0

func (m *Mongo) GetImages(ctx context.Context, collectionID string) ([]models.Image, error)

GetImages retrieves all images documents corresponding to the provided collectionID

func (*Mongo) UnlockImage added in v0.8.0

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

UnlockImage releases an exclusive mongoDB lock for the provided lockId (if it exists)

func (*Mongo) UpdateImage added in v0.3.0

func (m *Mongo) UpdateImage(ctx context.Context, id string, image *models.Image) (bool, error)

UpdateImage updates an existing image document

func (*Mongo) UpsertImage added in v0.3.0

func (m *Mongo) UpsertImage(ctx context.Context, id string, image *models.Image) (err error)

UpsertImage adds or overides an existing image document

Jump to

Keyboard shortcuts

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