Documentation
¶
Index ¶
- type Backend
- func (b *Backend) AbortTransfer(ctx context.Context, req shiftlock.AbortRequest) (*shiftlock.ClaimRecord, error)
- func (b *Backend) AcquireClaim(ctx context.Context, req shiftlock.AcquireRequest) (*shiftlock.ClaimRecord, error)
- func (b *Backend) Capabilities() shiftlock.Capabilities
- func (b *Backend) Close() error
- func (b *Backend) CommitTransfer(ctx context.Context, req shiftlock.CommitRequest) (*shiftlock.ClaimRecord, error)
- func (b *Backend) CrashOnCommit(v bool)
- func (b *Backend) FailNext(err error)
- func (b *Backend) FailPrepareAt(n int)
- func (b *Backend) ForceExpire(claimName string)
- func (b *Backend) ForceSetToken(claimName string, tok shiftlock.FencingToken)
- func (b *Backend) GetClaim(ctx context.Context, claimName string) (*shiftlock.ClaimRecord, error)
- func (b *Backend) GetGeneration(ctx context.Context, generationID string) (*shiftlock.Generation, error)
- func (b *Backend) PrepareTransfer(ctx context.Context, req shiftlock.TransferRequest) (*shiftlock.ClaimRecord, error)
- func (b *Backend) RegisterGeneration(ctx context.Context, gen shiftlock.Generation) error
- func (b *Backend) ReleaseClaim(ctx context.Context, req shiftlock.ReleaseRequest) error
- func (b *Backend) RenewClaim(ctx context.Context, req shiftlock.RenewRequest) (*shiftlock.ClaimRecord, error)
- func (b *Backend) SetDelay(d time.Duration)
- func (b *Backend) SetPartition(on bool)
- func (b *Backend) Snapshot() map[string]shiftlock.ClaimRecord
- func (b *Backend) UpdateGeneration(ctx context.Context, gen shiftlock.Generation) error
- func (b *Backend) WatchClaim(ctx context.Context, claimName string) (<-chan shiftlock.ClaimEvent, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is an in-memory ownership store for tests and single-process use.
func (*Backend) AbortTransfer ¶
func (b *Backend) AbortTransfer(ctx context.Context, req shiftlock.AbortRequest) (*shiftlock.ClaimRecord, error)
func (*Backend) AcquireClaim ¶
func (b *Backend) AcquireClaim(ctx context.Context, req shiftlock.AcquireRequest) (*shiftlock.ClaimRecord, error)
func (*Backend) Capabilities ¶
func (b *Backend) Capabilities() shiftlock.Capabilities
Capabilities implements shiftlock.Capabler.
func (*Backend) CommitTransfer ¶
func (b *Backend) CommitTransfer(ctx context.Context, req shiftlock.CommitRequest) (*shiftlock.ClaimRecord, error)
func (*Backend) CrashOnCommit ¶
CrashOnCommit simulates a crash after prepare but before durable commit visibility.
func (*Backend) FailPrepareAt ¶
FailPrepareAt fails the n-th PrepareTransfer call (1-based) with ErrBackend. Useful for multi-claim partial Transfer tests. Pass 0 to disable.
func (*Backend) ForceExpire ¶
ForceExpire expires a claim immediately (test helper).
func (*Backend) ForceSetToken ¶
func (b *Backend) ForceSetToken(claimName string, tok shiftlock.FencingToken)
ForceSetToken sets the claim token for overflow tests (creates unowned claim).
func (*Backend) GetGeneration ¶
func (*Backend) PrepareTransfer ¶
func (b *Backend) PrepareTransfer(ctx context.Context, req shiftlock.TransferRequest) (*shiftlock.ClaimRecord, error)
func (*Backend) RegisterGeneration ¶
func (*Backend) ReleaseClaim ¶
func (*Backend) RenewClaim ¶
func (b *Backend) RenewClaim(ctx context.Context, req shiftlock.RenewRequest) (*shiftlock.ClaimRecord, error)
func (*Backend) SetPartition ¶
SetPartition toggles partition mode (mutations fail).
func (*Backend) Snapshot ¶
func (b *Backend) Snapshot() map[string]shiftlock.ClaimRecord
Snapshot returns a copy of all claims (test helper).
func (*Backend) UpdateGeneration ¶
func (*Backend) WatchClaim ¶
Click to show internal directories.
Click to hide internal directories.