mongosp

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLockRecord

func ToLockRecord(in LockRecordDB) models.LockRecord

Types

type LockRecordDB

type LockRecordDB struct {
	LockName    string                 `bson:"jobname"`
	Version     string                 `bson:"version"`
	DurationSec int                    `bson:"durationsec"`
	State       models.LockRecordState `bson:"state"`
	Dt          time.Time              `bson:"dt"`
}

func FromLockRecord

func FromLockRecord(in models.LockRecord) LockRecordDB

type StorageProvider

type StorageProvider struct {
	// contains filtered or unexported fields
}

func NewStorageProvider

func NewStorageProvider(
	ctx context.Context,
	db *mongo.Database,
	collectionName string,
) (*StorageProvider, error)

func (*StorageProvider) CreateLockRecord

func (sp *StorageProvider) CreateLockRecord(
	ctx context.Context,
	lr models.LockRecord,
) (err error)

func (*StorageProvider) GetLockRecord

func (sp *StorageProvider) GetLockRecord(
	ctx context.Context,
	lockName string,
) (lr models.LockRecord, err error)

func (*StorageProvider) UpdateLockRecord

func (sp *StorageProvider) UpdateLockRecord(
	ctx context.Context,
	lockName string,
	version string,
	patch models.LockRecordPatch,
) (err error)

Jump to

Keyboard shortcuts

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