db

package
v0.0.0-...-07ee8ad Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

type Lock struct {
	*models.Resource
	TtlInSeconds  int64
	ModifiedIndex int64
	ModifiedId    string
}

type LockDB

type LockDB interface {
	Lock(ctx context.Context, logger lager.Logger, resource *models.Resource, ttl int64) (*Lock, error)
	Release(ctx context.Context, logger lager.Logger, resource *models.Resource) error
	Fetch(ctx context.Context, logger lager.Logger, key string) (*Lock, error)
	FetchAndRelease(ctx context.Context, logger lager.Logger, lock *Lock) (bool, error)
	FetchAll(ctx context.Context, logger lager.Logger, lockType string) ([]*Lock, error)
	Count(ctx context.Context, logger lager.Logger, lockType string) (int, error)
}

type SQLDB

type SQLDB struct {
	helpers.QueryableDB
	// contains filtered or unexported fields
}

func NewSQLDB

func NewSQLDB(
	db helpers.QueryableDB,
	flavor string,
	guidProvider guidprovider.GUIDProvider,
) *SQLDB

func (*SQLDB) Count

func (db *SQLDB) Count(ctx context.Context, logger lager.Logger, lockType string) (int, error)

func (*SQLDB) CreateLockTable

func (db *SQLDB) CreateLockTable(ctx context.Context, logger lager.Logger) error

func (*SQLDB) Fetch

func (db *SQLDB) Fetch(ctx context.Context, logger lager.Logger, key string) (*Lock, error)

func (*SQLDB) FetchAll

func (db *SQLDB) FetchAll(ctx context.Context, logger lager.Logger, lockType string) ([]*Lock, error)

func (*SQLDB) FetchAndRelease

func (db *SQLDB) FetchAndRelease(ctx context.Context, logger lager.Logger, lock *Lock) (bool, error)

func (*SQLDB) Lock

func (db *SQLDB) Lock(ctx context.Context, logger lager.Logger, resource *models.Resource, ttl int64) (*Lock, error)

func (*SQLDB) Release

func (db *SQLDB) Release(ctx context.Context, logger lager.Logger, resource *models.Resource) error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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