memory

package
v1.51.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: GPL-3.0 Imports: 4 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() *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