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.
Click to show internal directories.
Click to hide internal directories.