memory

package
v1.41.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service is an in-memory implementation of the oplock.Service. It is only safe for single instance / in-process use.

func New

func New(logger *zap.Logger, driver storagesql.Driver, builder sq.StatementBuilderType) *Service

New constructs and configures a new service instance.

func (*Service) TryAcquire

func (s *Service) TryAcquire(ctx context.Context, operation oplock.Operation, duration time.Duration) (acquired bool, entry oplock.LockEntry, err error)

TryAcquire will attempt to obtain a lock for the supplied operation name for the specified duration. If it succeeds then the returned boolean (acquired) will be true, else false. The lock entry associated with the last successful acquisition is also returned. Given the lock was acquired successfully this will be the entry just created.

Jump to

Keyboard shortcuts

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