Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { // AggregateID is the ID of aggregate the document is for. AggregateID int8 `json:"aggregateID,omitempty"` // EventAction is the action for which the command is being produced. EventAction string `json:"eventAction,omitempty"` // ServiceAction is the service-action for which the command is being produced. ServiceAction string `json:"serviceAction,omitempty"` // Data is the data required for invoking the command. Data []byte `json:"data,omitempty"` }
Command can be used to invoke a procedure in another service.
type Document ¶
type Document struct { // AggregateID is the ID of aggregate the document is for. AggregateID int8 `json:"aggregateID,omitempty"` // EventAction is the action corresponding to which the document was produced. EventAction string `json:"eventAction,omitempty"` // ServiceAction is the service-specific Action for the event. // For example, "insert" is EventAction, but "insertUser" is ServiceAction, // informing service that a user was inserted. ServiceAction string `json:"serviceAction,omitempty"` // CorrelationID can be used to "link" documents, such as if two documents // are somehow related (for example, when implementing batching). // Including CorrelationID will result in inclusion of this ID in any // responses generated as per result of event's processing. CorrelationID uuuid.UUID `json:"correlationID,omitempty"` // Error is the error occurred while processing the Input. // Convert errors to strings, this is just an indication that // something went wrong, so we can signal/display-error to end- // user. Blank Error-string means everything was fine. Error string `json:"error,omitempty"` // ErrorCode can be used to identify type of error. ErrorCode int16 `json:"errorCode,omitempty"` // Input is the data that was being processed. // Use this to provide context of whatever data was attempted to be processed. Input []byte `json:"input,omitempty"` // Result is the result after an input was processed. // This is some data returned by processing (such as database results) etc. Result []byte `json:"result,omitempty"` // Topic is the topic on which Kafka producer should produce this message. // This field will not be included as part of the document, and is only // for referencing purposes for producer. Topic string `json:"topic,omitempty"` // UUID is the V4-UUID Document-Identifier. // This can be same as service-query UUID, and can be used for identification puposes. UUID uuuid.UUID `json:"uuid,omitempty"` }
Document can be used to transfer data between services.
type Event ¶
type Event struct { // AggregateID is the ID of aggregate responsible for consuming event. AggregateID int8 `cql:"aggregate_id,omitempty" json:"aggregateID,omitempty"` // EventAction is the core-action being performed by event. // For example, "insert" is EventAction, but "insertUser" is ServiceAction, // informing service that a user was inserted. EventAction string `cql:"event_action,omitempty" json:"eventAction,omitempty"` // ServiceAction is the service-specific Action for the event. // For example, "insert" is EventAction, but "insertUser" is ServiceAction, // informing service that a user was inserted. ServiceAction string `cql:"service_action,omitempty" json:"serviceAction,omitempty"` // CorrelationID can be used to "link" events, such as if an event was result of another event. // The related events should have cmmon CorrelationIDs, but unique UUIDs. // Including CorrelationID will result in inclusion of this ID in any // responses generated as per result of event's processing. CorrelationID uuuid.UUID `cql:"correlation_id,omitempty" json:"correlationID,omitempty"` // Data is the data contained by event. Data []byte `cql:"data,omitempty" json:"data,omitempty"` // NanoTime is the time in nanoseconds since Unix-epoch to when the event was generated. NanoTime int64 `cql:"nano_time,omitempty" json:"nanoTime,omitempty"` // UserUUID is the V4-UUID of the user who generated the event. UserUUID uuuid.UUID `cql:"user_uuid,omitempty" json:"userUUID,omitempty"` // UUID is the V4-UUID unique-indentifier for event. UUID uuuid.UUID `cql:"uuid,omitempty" json:"uuid,omitempty"` // Version is the version for events as processed for aggregate-projection. // This is incremented by the aggregate itself each time it updates its // projection. Version int64 `cql:"version,omitempty" json:"version,omitempty"` // Year bucket is the year in which the event was generated. // This is used as the partitioning key. YearBucket int16 `cql:"year_bucket,omitempty" json:"yearBucket,omitempty"` }
Event refers to any interaction with the system, such as inserting or retrieving any data.
type EventMeta ¶
type EventMeta struct { // AggregateID corresponds to AggregateID in // event-store and ID in aggregate-projection. AggregateID int8 `cql:"aggregate_id,omitempty" json:"aggregateID,omitempty"` // AggregateVersion tracks the version to be used // by new events for that aggregate. AggregateVersion int64 `cql:"aggregate_version,omitempty" json:"aggregateVersion,omitempty"` // PartitionKey is the partitioning key for events_meta table. PartitionKey int8 `cql:"partition_key,omitempty" json:"partitionKey,omitempty"` }
EventMeta contains the information about hydrating Aggregate-Projections. The AggregateVersion tracks the version to be used by new events for that aggregate. This difference between the aggregate-projection version and AggregateVersion gives us the versions of the events yet to be applied to the aggregate projection.
type EventStoreQuery ¶ added in v1.2.1
type EventStoreQuery struct { // AggregateID is the id for aggregate whose events are to be fetched AggregateID int8 `json:"aggregateID,omitempty"` // AggregateVersion is the highest version of events that have been // already fetched by the aggregate. The event-store will be queried // for events greater than this version. AggregateVersion int64 `json:"aggregateVersion,omitempty"` // CorrelationID can be used to "identify" responses, such as checking // if the response is for some particular request. // Including CorrelationID will result in inclusion of this ID in any // responses generated as per result of event's processing. CorrelationID uuuid.UUID `json:"correlationID,omitempty"` // EventAction is the core-action being performed by event. // For example, "insert" is EventAction, but "insertUser" is ServiceAction, // informing service that a user was inserted. EventAction string `json:"eventAction,omitempty"` // ServiceAction is the service-specific Action for the event. // For example, "insert" is EventAction, but "insertUser" is ServiceAction, // informing service that a user was inserted. ServiceAction string `json:"serviceAction,omitempty"` // YearBucket is the partition-key for Event-Table. YearBucket int16 `json:"yearBucket,omitempty"` // UUID is the V4-UUID Query-Identifier. // This can be used to "identify" responses. UUID uuuid.UUID `json:"uuid,omitempty"` }
EventStoreQuery can be used to fetch later events than the specified version.
type LogEntry ¶
type LogEntry struct { // Description of what happened, can also be an error description. Description string `json:"description,omitempty"` // ErrorCode is just to inform the kind or classification of error. ErrorCode int `json:"errorCode,omitempty"` // Level is the severity-level, that is, info, warning, or error. Level string `json:"level,omitempty"` // EventAction is the action being performed by event corresponding to this log. EventAction string `json:"eventAction,omitempty"` // EventAction is the service-level action being performed by event // corresponding to this log. ServiceAction string `json:"serviceAction,omitempty"` // ServiceName is the service associated with the log. ServiceName string `json:"serviceName,omitempty"` }
LogEntry describes the "currently-happening" event. Use this to show if everything is going as intended, or reasons for why not.