Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrCheckpointNotFound = errors.New("checkpoint not found")
ErrCheckpointNotFound marks a missing checkpoint.
Functions ¶
Types ¶
type Checkpoint ¶
type Checkpoint struct {
ClientID string
ContentType string
Value json.RawMessage
UpdatedAt time.Time
}
Checkpoint is a stored processor checkpoint.
type CheckpointClient ¶
type CheckpointClient interface {
Get(ctx context.Context, clientID string) (Checkpoint, error)
Put(ctx context.Context, clientID, contentType string, value json.RawMessage) (Checkpoint, error)
}
CheckpointClient persists one processor checkpoint.
type Config ¶
type Config struct {
ClientID string
Kinds []string
EntryChannels []string
EntryContentTypes []string
EntryRoles []string
Scope string
AfterCursor string
Justification string
CheckpointInterval time.Duration
ReconnectMin time.Duration
ReconnectMax time.Duration
}
Config controls the shared checkpointed stream loop.
type EventClient ¶
type EventClient interface {
Subscribe(ctx context.Context, req SubscribeRequest) (EventStream, error)
}
EventClient subscribes to Memory Service events.
type EventEnvelope ¶
type EventEnvelope struct {
Event string
Kind string
Data json.RawMessage
Cursor string
Time time.Time
}
EventEnvelope is the normalized event shape consumed by processors.
type EventProcessor ¶
type EventProcessor interface {
ContentType() string
Load(state json.RawMessage) error
Handle(ctx context.Context, event EventEnvelope) error
Snapshot() (json.RawMessage, error)
Flush(ctx context.Context) error
}
EventProcessor handles events and exposes a small durable checkpoint payload.
type EventStream ¶
type EventStream interface {
Recv() (EventEnvelope, error)
}
EventStream opens a durable event stream.
type GRPCCheckpointClient ¶
type GRPCCheckpointClient struct {
Client pb.AdminCheckpointServiceClient
Auth GRPCAuth
}
GRPCCheckpointClient adapts AdminCheckpointService to CheckpointClient.
func (GRPCCheckpointClient) Get ¶
func (c GRPCCheckpointClient) Get(ctx context.Context, clientID string) (Checkpoint, error)
Get loads a checkpoint.
func (GRPCCheckpointClient) Put ¶
func (c GRPCCheckpointClient) Put(ctx context.Context, clientID, contentType string, value json.RawMessage) (Checkpoint, error)
Put stores a checkpoint.
type GRPCEventClient ¶
type GRPCEventClient struct {
Client pb.EventStreamServiceClient
Auth GRPCAuth
}
GRPCEventClient adapts EventStreamService to EventClient.
func (GRPCEventClient) Subscribe ¶
func (c GRPCEventClient) Subscribe(ctx context.Context, req SubscribeRequest) (EventStream, error)
Subscribe opens a gRPC event stream.
type Runtime ¶
type Runtime struct {
Events EventClient
Checkpoints CheckpointClient
Processor EventProcessor
Config Config
// contains filtered or unexported fields
}
Runtime runs an EventProcessor against a checkpointed event stream.