Documentation
¶
Overview ¶
Package pulse contains the in-memory coordination primitives for Corvint Pulse.
Index ¶
- Variables
- type Actor
- func (a *Actor) Acquire(ctx context.Context) (Lease, error)
- func (a *Actor) Invalidate(ctx context.Context, expectedGeneration uint64) (Update, error)
- func (a *Actor) Resolve(ctx context.Context, token Token) (Lease, error)
- func (a *Actor) Shutdown(ctx context.Context) (Update, error)
- func (a *Actor) Status(ctx context.Context) (Status, error)
- type ActorError
- type CaptureError
- type CaptureFunc
- type Config
- type Lease
- type Manifest
- type ObservationWindow
- type SnapshotState
- type Status
- type Token
- type Update
- type WorkspaceState
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidConfig = errors.New("pulse: invalid actor configuration") ErrStopped = errors.New("pulse: actor stopped") ErrInvalidated = errors.New("pulse: capture invalidated") ErrGenerationConflict = errors.New("pulse: workspace generation conflict") ErrGenerationExhausted = errors.New("pulse: workspace generation exhausted") ErrSequenceExhausted = errors.New("pulse: server sequence exhausted") ErrIdentityExhausted = errors.New("pulse: internal snapshot identity exhausted") ErrCaptureFailed = errors.New("pulse: capture failed") ErrInvalidManifest = errors.New("pulse: invalid capture manifest") ErrSnapshotTooLarge = errors.New("pulse: snapshot exceeds retention bound") ErrForeignToken = errors.New("pulse: lease token belongs to another actor session") ErrLeaseExpired = errors.New("pulse: snapshot lease expired") )
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
Actor serializes all workspace state through one private event loop.
func NewActor ¶
NewActor starts one memory-only workspace actor. SessionID is injected so tests and callers can bind events deterministically; tokens are additionally bound to the concrete actor instance.
func (*Actor) Acquire ¶
Acquire starts or joins the active capture for the current generation. A capture committed before admission is historical and never satisfies it.
func (*Actor) Invalidate ¶
Invalidate advances the workspace generation iff expectedGeneration is current. The accepted command is the cut after which the older capture can no longer publish.
func (*Actor) Resolve ¶
Resolve returns a retained validated-at snapshot. It does not assert that the snapshot is current relative to the workspace.
type ActorError ¶
ActorError binds an actor-produced failure to the generation and unique server sequence at which it was committed.
func (*ActorError) Error ¶
func (e *ActorError) Error() string
func (*ActorError) Unwrap ¶
func (e *ActorError) Unwrap() error
type CaptureError ¶
CaptureError preserves both the stable failure class and the injected cause.
func (*CaptureError) Error ¶
func (e *CaptureError) Error() string
func (*CaptureError) Unwrap ¶
func (e *CaptureError) Unwrap() []error
type CaptureFunc ¶
CaptureFunc obtains a manifest for exactly the supplied workspace generation. It must stop promptly when ctx is cancelled.
type Config ¶
type Config struct {
SessionID string
Capture CaptureFunc
MaxRetainedSnapshots int
MaxRetainedBytes uint64
}
Config defines one memory-only actor instance.
type Lease ¶
type Lease struct {
Token Token
Manifest Manifest
SnapshotState SnapshotState
WorkspaceGeneration uint64
ServerSequence uint64
}
Lease is proof that Manifest was validated at WorkspaceGeneration. It makes no assertion that the generation is still current when the caller reads it.
type Manifest ¶
type Manifest struct {
WSI string
Digest string
ObservationWindow ObservationWindow
ObservationModel string
RetainedBytes uint64
}
Manifest is an immutable-by-construction capture result: all fields are value types. RetainedBytes accounts for immutable data retained behind its digest.
type ObservationWindow ¶
ObservationWindow identifies the ordered observations which bounded a capture under its declared observer model.
type SnapshotState ¶
type SnapshotState uint8
SnapshotState deliberately has no CURRENT or STALE value. A lease proves only that its immutable manifest was validated at its workspace generation.
const SnapshotValidatedAt SnapshotState = 1
func (SnapshotState) String ¶
func (s SnapshotState) String() string
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token is an opaque, actor-instance-bound snapshot lease token.
type Update ¶
type Update struct {
State WorkspaceState
WorkspaceGeneration uint64
ServerSequence uint64
}
Update reports a serialized state transition.
type WorkspaceState ¶
type WorkspaceState uint8
WorkspaceState is the actor's serialized workspace lifecycle state.
const ( StateEmpty WorkspaceState = iota StateCapturing StateCaptured StateInvalidated StateUnknown StateStopping )
func (WorkspaceState) String ¶
func (s WorkspaceState) String() string