actorlock

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package actorlock serializes lifecycle RPCs per actor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelableMutex

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

CancelableMutex supports context cancellation while waiting for a lock.

func NewCancelableMutex

func NewCancelableMutex() *CancelableMutex

NewCancelableMutex returns an unlocked CancelableMutex.

func (*CancelableMutex) Lock

func (m *CancelableMutex) Lock()

Lock acquires the mutex, blocking until it is free.

func (*CancelableMutex) LockContext

func (m *CancelableMutex) LockContext(ctx context.Context) bool

LockContext returns false on cancellation without acquiring the mutex.

func (*CancelableMutex) Unlock

func (m *CancelableMutex) Unlock()

Unlock releases the mutex.

type InFlight

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

InFlight tracks lifecycle RPCs by actor for shutdown cancellation and draining.

func NewInFlight

func NewInFlight() *InFlight

NewInFlight returns an empty set.

func (*InFlight) Add

func (f *InFlight) Add(actorUID, name string, cancel context.CancelFunc) func()

Add records an RPC for actorUID and returns the function that clears it. cancel is nil for an RPC that must finish, such as a checkpoint saving state.

func (*InFlight) CancelStartups

func (f *InFlight) CancelStartups() []string

CancelStartups cancels startup RPCs and returns their actor UIDs.

func (*InFlight) Names

func (f *InFlight) Names() map[string]string

Names returns the RPC name for each active actor.

func (*InFlight) WaitIdle

func (f *InFlight) WaitIdle(ctx context.Context) bool

WaitIdle waits for all RPCs to finish, returning false on cancellation.

type Locks

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

Locks serializes lifecycle RPCs per actor. A zero value is ready to use.

func New

func New() *Locks

New returns an empty set of per-actor locks.

func (*Locks) Busy

func (l *Locks) Busy(actorUID string) bool

Busy reports whether a lifecycle RPC holds or is waiting for the named actor's lock. It never blocks, so a reader that must not take the lock can still tell whether the actor is mid-operation. The answer may be stale by the time it returns: use it for advisory checks, not to decide lifecycle actions.

func (*Locks) Lock

func (l *Locks) Lock(ctx context.Context, actorUID string) bool

Lock returns false on cancellation without acquiring the actor's lock.

func (*Locks) Unlock

func (l *Locks) Unlock(actorUID string)

Unlock releases the named actor's lock.

Jump to

Keyboard shortcuts

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