Documentation ¶
Index ¶
Constants ¶
const DatabaseError int16 = 2
DatabaseError is when some operation related to Database, such as insert or find, goes wrong and the task cannot proceed.
const InternalError int16 = 1
InternalError represents an error when something goes wrong, and its our fault.
const UserError int16 = 3
UserError occurs when there's an error because of user's action. An example would be providing invalid input.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { // Action for which the command is being produced. Action string `json:"action,omitempty"` // CorrelationID can be used to track Command's source or reason why it as generated. CorrelationID uuuid.UUID `json:"correlationID,omitempty"` // Data required for invoking the command. Data []byte `json:"data,omitempty"` // ResponseTopic is the Messaging-Topic on which the // response from processing the command should be sent. ResponseTopic string `json:"responseTopic,omitempty"` // Source is the name of the service which created the command. Source string `json:"source,omitempty"` // SourceTopic is the Messaging-Topic on which the Command was produced. SourceTopic string `json:"sourceTopic,omitempty"` // Timestamp is the time in Unix-milliseconds when this Command was generated. Timestamp int64 `json:"timestamp,omitempty"` // TTLSec is the Time-To-Live in seconds. // The Command should not be processed if current-time exceeds Timestamp+TTLSec. TTLSec int32 `json:"ttlSec,omitempty"` // UUID is the unique-identifier for Command. UUID uuuid.UUID `json:"uuid,omitempty"` }
Command can be used to invoke a procedure in another service.
type Document ¶
type Document struct { // CorrelationID can be used to track Document's source or reason why it as generated. CorrelationID uuuid.UUID `json:"correlationID,omitempty"` // Data contained by Document. Data []byte `json:"data,omitempty"` // 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"` // Source is the name of the service which created the command. Source string `json:"source,omitempty"` // Topic on which the document should be produced. Topic string `json:"topic,omitempty"` // UUID is the V4-UUID Document-Identifier. UUID uuuid.UUID `json:"uuid,omitempty"` }
Document can be used to transfer data between services.
type Event ¶
type Event struct { // Action that was performed by the Event. Action string `cql:"action,omitempty" json:"action,omitempty"` // AggregateID for Aggregate associated with the Event. AggregateID int8 `cql:"aggregate_id,omitempty" json:"aggregateID,omitempty"` // CorrelationID can be used to track Event's source or reason why it as generated. CorrelationID uuuid.UUID `cql:"correlation_id,omitempty" json:"correlationID,omitempty"` // 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"` // Source is the name of service responsible for generating Event. Source string `cql:"source,omitempty" json:"source,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 for events as processed for aggregate-projection. // This is incremented by the aggregate itself each time it updates its state. 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 change in system, such as insertion of some 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 ¶
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"` // Topic on which Events are to be received. Topic string `json:"topic,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 { // Action describes "what was happening" when this entry was created. Action string `json:"action,omitempty"` // 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. // The actual error should be part of description. ErrorCode int `json:"errorCode,omitempty"` // Level is the severity-level, that is, info, warning, or error. Level string `json:"level,omitempty"` // ServiceName is the service associated with the log. ServiceName string `json:"serviceName,omitempty"` }
LogEntry describes "what's currently happening" for logging purposes.