Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrentState ¶
type CurrentState struct {
// Status is the current request status obtained from the request log.
Status entity.RequestStatus
// LastError is the last error associated with the current status.
LastError string
// Metadata is the metadata associated with the current status.
Metadata map[string]string
}
CurrentState holds the current request status obtained from the request log. It is eventually consistent with the request status in the request store. It might take some time to converge, typically no more than a few seconds.
func GetCurrentStateFromRequestLog ¶
func GetCurrentStateFromRequestLog(ctx context.Context, store storage.RequestLogStore, requestID string) (CurrentState, error)
GetCurrentStateFromRequestLog returns the current reconciled state for a request by reading the request log. Returns ErrNotFound if the request ID has no records in the log database. The state is eventually consistent with the request status in the request store. It might take some time to converge, typically no more than a few seconds.
type Materializer ¶
type Materializer struct {
// contains filtered or unexported fields
}
Materializer appends request logs and projects the winning public request state. It owns winner selection, optimistic concurrency, and public projection repair. Every store it touches is queue-scoped, so each call resolves the aggregate once from the queue carried on the log being persisted.
func NewMaterializer ¶
func NewMaterializer(stores gwstorage.Factory) *Materializer
NewMaterializer creates a request read-model materializer.
func (*Materializer) PersistLog ¶
func (m *Materializer) PersistLog(ctx context.Context, log entity.RequestLog) error
PersistLog appends one audit log and materializes its winning state. Projection errors are returned so queue deliveries are retried rather than silently dropping the side write. Because the append happens first, retrying after a projection failure may retain another copy of the event in History.