Versions in this module Expand all Collapse all v5 v5.0.1 Jul 28, 2026 Changes in this version + const DefaultResident + const OpInsert + const OpMove + const OpRemove + const OpUpdate + var ErrDomainPanic = errors.New("projection: the domain handler panicked") + var ErrRejected = errors.New("projection: the domain rejected the command") + var ErrWorkerDied = errors.New("projection: the domain worker terminated") + func DomainPanic(parseMessage string) error + func EncodeReply(parseReply ReplyEnvelope) ([]byte, error) + func EncodeRequest(parseRequestID uint64, parseCommand string, parsePayload []byte) ([]byte, error) + func Optimistic[R any](parseCtx context.Context, parseApply func(), parseRollback func(), ...) (R, error) + func Rejection(parseMessage string) error + func WorkerDeath(parseMessage string) error + type Bootstrap struct + Complete bool + Keys []Key + Payloads [][]byte + func BuildBootstrap[T any](parseKeys []Key, parseRows []T, parseEncode func(T) ([]byte, error), ...) (Bootstrap, error) + func (parseBootstrap Bootstrap) Len() int + func (parseBootstrap Bootstrap) Validate() error + type Codec interface + Decode func(parseData []byte, parseTarget any) error + Encode func(parseValue any) ([]byte, error) + type Command struct + func Define[A any, R any](parseName string) Command[A, R] + func (parseCommand Command[A, R]) Invoke(parseCtx context.Context, parseClient CommandClient, parseCodec Codec, ...) (R, error) + func (parseCommand Command[A, R]) Name() string + type CommandClient interface + Send func(parseCtx context.Context, parseName string, parseRequest []byte) ([]byte, error) + type CommandError struct + Attempts int + Command string + Err error + Kind FailureKind + func (parseErr *CommandError) Error() string + func (parseErr *CommandError) Unwrap() error + type Declared interface + Name func() string + type Decoder func(parsePayload []byte) (T, error) + type Entry struct + Key Key + Value T + type FailureKind uint8 + const FailureCancelled + const FailureRejected + const FailureTimedOut + const FailureTransport + const FailureWorkerDied + func Classify(parseErr error) FailureKind + func (parseKind FailureKind) MayHaveApplied() bool + func (parseKind FailureKind) Retryable() bool + func (parseKind FailureKind) String() string + type Key = delta.Key + type Op = delta.Op + type OpKind = delta.OpKind + type Options struct + Resident int + type Policy struct + Backoff time.Duration + MaxAttempts int + RetryMayHaveApplied bool + Sleep func(parseCtx context.Context, parseDuration time.Duration) error + Timeout time.Duration + type Poster interface + Post func(parseRequestID uint64, parseName string, parseRequest []byte) error + type Projection struct + func New[T any](parseDecode Decoder[T], parseOptions Options) (*Projection[T], error) + func (parseProjection *Projection[T]) Apply(parseOps []Op) error + func (parseProjection *Projection[T]) Complete() bool + func (parseProjection *Projection[T]) DroppedByResidency() int + func (parseProjection *Projection[T]) Filter(parsePredicate func(T) bool) []Entry[T] + func (parseProjection *Projection[T]) Get(parseKey Key) (T, bool) + func (parseProjection *Projection[T]) Hydrate(parseBootstrap Bootstrap) error + func (parseProjection *Projection[T]) Len() int + func (parseProjection *Projection[T]) MarkReady(parseComplete bool) + func (parseProjection *Projection[T]) Ready() bool + func (parseProjection *Projection[T]) Reset() + func (parseProjection *Projection[T]) Rows() []Entry[T] + func (parseProjection *Projection[T]) Window(parseOffset int, parseCount int) []Entry[T] + type Registry struct + func NewRegistry(parseNames []string) *Registry + func (parseRegistry *Registry) Verify(parseCommands ...Declared) error + type ReplyEnvelope struct + Kind ReplyKind + Message string + Payload []byte + RequestID uint64 + type ReplyKind string + const ReplyOK + const ReplyPanic + const ReplyRejected + type RequestEnvelope struct + Command string + Payload []byte + RequestID uint64 + func DecodeRequest(parseBytes []byte) (RequestEnvelope, error) + type Resilient struct + func NewResilient(parseInner CommandClient, parsePolicy Policy) (*Resilient, error) + func (parseResilient *Resilient) Send(parseCtx context.Context, parseName string, parseRequest []byte) ([]byte, error) + type WorkerClient struct + func NewWorkerClient(parsePoster Poster) (*WorkerClient, error) + func (parseClient *WorkerClient) Deliver(parseRequestID uint64, parsePayload []byte, parseWorkerErr error) bool + func (parseClient *WorkerClient) DeliverEncodedReply(parseBytes []byte) (bool, error) + func (parseClient *WorkerClient) DeliverPanic(parseRequestID uint64, parseMessage string) bool + func (parseClient *WorkerClient) DeliverRejection(parseRequestID uint64, parseMessage string) bool + func (parseClient *WorkerClient) InFlight() int + func (parseClient *WorkerClient) Send(parseCtx context.Context, parseName string, parseRequest []byte) ([]byte, error) + func (parseClient *WorkerClient) WorkerDied(parseReason string) int + func (parseClient *WorkerClient) WorkerRestarted()