eventsourcing

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandHandler_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "eventsourcing.CommandHandler",
	HandlerType: (*CommandHandlerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Execute",
			Handler:    _CommandHandler_Execute_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/eventsourcing/commandhandler_service.proto",
}

CommandHandler_ServiceDesc is the grpc.ServiceDesc for CommandHandler service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var EventStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "eventsourcing.EventStore",
	HandlerType: (*EventStoreServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Store",
			Handler:       _EventStore_Store_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "Retrieve",
			Handler:       _EventStore_Retrieve_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "RetrieveOr",
			Handler:       _EventStore_RetrieveOr_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "api/eventsourcing/eventstore_service.proto",
}

EventStore_ServiceDesc is the grpc.ServiceDesc for EventStore service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_api_eventsourcing_commandhandler_service_proto protoreflect.FileDescriptor
View Source
var File_api_eventsourcing_eventstore_service_proto protoreflect.FileDescriptor
View Source
var File_api_eventsourcing_messages_proto protoreflect.FileDescriptor

Functions

func RegisterCommandHandlerServer

func RegisterCommandHandlerServer(s grpc.ServiceRegistrar, srv CommandHandlerServer)

func RegisterEventStoreServer

func RegisterEventStoreServer(s grpc.ServiceRegistrar, srv EventStoreServer)

Types

type CommandHandlerClient

type CommandHandlerClient interface {
	// Execute executes a command.
	Execute(ctx context.Context, in *commands.Command, opts ...grpc.CallOption) (*CommandReply, error)
}

CommandHandlerClient is the client API for CommandHandler service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type CommandHandlerServer

type CommandHandlerServer interface {
	// Execute executes a command.
	Execute(context.Context, *commands.Command) (*CommandReply, error)
	// contains filtered or unexported methods
}

CommandHandlerServer is the server API for CommandHandler service. All implementations must embed UnimplementedCommandHandlerServer for forward compatibility

type CommandReply

type CommandReply struct {

	// UUID of the referenced aggregate. If this was a "Create*" command, the ID
	// provied with the command is ignored. A valid ID is generated by the command
	// handler and returned in the CommandReply.
	AggregateId string `protobuf:"bytes,1,opt,name=aggregate_id,json=aggregateId,proto3" json:"aggregate_id,omitempty"` // required
	// Version of the aggregate after command being executed.
	Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

func (*CommandReply) Descriptor deprecated

func (*CommandReply) Descriptor() ([]byte, []int)

Deprecated: Use CommandReply.ProtoReflect.Descriptor instead.

func (*CommandReply) GetAggregateId

func (x *CommandReply) GetAggregateId() string

func (*CommandReply) GetVersion

func (x *CommandReply) GetVersion() uint64

func (*CommandReply) ProtoMessage

func (*CommandReply) ProtoMessage()

func (*CommandReply) ProtoReflect

func (x *CommandReply) ProtoReflect() protoreflect.Message

func (*CommandReply) Reset

func (x *CommandReply) Reset()

func (*CommandReply) String

func (x *CommandReply) String() string

func (*CommandReply) Validate added in v0.3.0

func (m *CommandReply) Validate() error

Validate checks the field values on CommandReply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*CommandReply) ValidateAll added in v0.3.0

func (m *CommandReply) ValidateAll() error

ValidateAll checks the field values on CommandReply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CommandReplyMultiError, or nil if none found.

type CommandReplyMultiError added in v0.3.0

type CommandReplyMultiError []error

CommandReplyMultiError is an error wrapping multiple validation errors returned by CommandReply.ValidateAll() if the designated constraints aren't met.

func (CommandReplyMultiError) AllErrors added in v0.3.0

func (m CommandReplyMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CommandReplyMultiError) Error added in v0.3.0

func (m CommandReplyMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type CommandReplyValidationError added in v0.3.0

type CommandReplyValidationError struct {
	// contains filtered or unexported fields
}

CommandReplyValidationError is the validation error returned by CommandReply.Validate if the designated constraints aren't met.

func (CommandReplyValidationError) Cause added in v0.3.0

Cause function returns cause value.

func (CommandReplyValidationError) Error added in v0.3.0

Error satisfies the builtin error interface

func (CommandReplyValidationError) ErrorName added in v0.3.0

func (e CommandReplyValidationError) ErrorName() string

ErrorName returns error name.

func (CommandReplyValidationError) Field added in v0.3.0

Field function returns field value.

func (CommandReplyValidationError) Key added in v0.3.0

Key function returns key value.

func (CommandReplyValidationError) Reason added in v0.3.0

Reason function returns reason value.

type Event

type Event struct {

	// Type of the event
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// Timestamp of when the event was created
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// ID of the aggregate that the event should be applied to (UUID 128-bit
	// number)
	AggregateId string `protobuf:"bytes,3,opt,name=aggregate_id,json=aggregateId,proto3" json:"aggregate_id,omitempty"`
	// Type of the aggregate that the event can be applied to
	AggregateType string `protobuf:"bytes,4,opt,name=aggregate_type,json=aggregateType,proto3" json:"aggregate_type,omitempty"`
	// Strict monotone counter, per aggregate/aggregate_id relation
	AggregateVersion *wrapperspb.UInt64Value `protobuf:"bytes,5,opt,name=aggregate_version,json=aggregateVersion,proto3" json:"aggregate_version,omitempty"`
	// Event type specific event data
	Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	// Event meta data
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

Event describes anything that has happened in the system. An event type name should be in past tense and contain the intent (TenantUpdated). The event should contain all the data needed when applying/handling it. The combination of aggregate_type, aggregate_id and version is unique.

func (*Event) Descriptor deprecated

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetAggregateId

func (x *Event) GetAggregateId() string

func (*Event) GetAggregateType

func (x *Event) GetAggregateType() string

func (*Event) GetAggregateVersion

func (x *Event) GetAggregateVersion() *wrapperspb.UInt64Value

func (*Event) GetData

func (x *Event) GetData() []byte

func (*Event) GetMetadata

func (x *Event) GetMetadata() map[string]string

func (*Event) GetTimestamp

func (x *Event) GetTimestamp() *timestamppb.Timestamp

func (*Event) GetType

func (x *Event) GetType() string

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

func (*Event) Validate added in v0.3.0

func (m *Event) Validate() error

Validate checks the field values on Event with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Event) ValidateAll added in v0.3.0

func (m *Event) ValidateAll() error

ValidateAll checks the field values on Event with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventMultiError, or nil if none found.

type EventFilter

type EventFilter struct {

	// Filter events by aggregate_id
	AggregateId *wrapperspb.StringValue `protobuf:"bytes,1,opt,name=aggregate_id,json=aggregateId,proto3" json:"aggregate_id,omitempty"`
	// Filter events for a specific aggregate type
	AggregateType *wrapperspb.StringValue `protobuf:"bytes,2,opt,name=aggregate_type,json=aggregateType,proto3" json:"aggregate_type,omitempty"`
	// Filter events with a version >= min_version
	MinVersion *wrapperspb.UInt64Value `protobuf:"bytes,3,opt,name=min_version,json=minVersion,proto3" json:"min_version,omitempty"`
	// Filter events with a version <= max_version
	MaxVersion *wrapperspb.UInt64Value `protobuf:"bytes,4,opt,name=max_version,json=maxVersion,proto3" json:"max_version,omitempty"`
	// Filter events with a timestamp >= min_timestamp
	MinTimestamp *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=min_timestamp,json=minTimestamp,proto3" json:"min_timestamp,omitempty"`
	// Filter events with a timestamp <= max_timestamp
	MaxTimestamp *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=max_timestamp,json=maxTimestamp,proto3" json:"max_timestamp,omitempty"`
	// contains filtered or unexported fields
}

Request to get Events from to the store

func (*EventFilter) Descriptor deprecated

func (*EventFilter) Descriptor() ([]byte, []int)

Deprecated: Use EventFilter.ProtoReflect.Descriptor instead.

func (*EventFilter) GetAggregateId

func (x *EventFilter) GetAggregateId() *wrapperspb.StringValue

func (*EventFilter) GetAggregateType

func (x *EventFilter) GetAggregateType() *wrapperspb.StringValue

func (*EventFilter) GetMaxTimestamp

func (x *EventFilter) GetMaxTimestamp() *timestamppb.Timestamp

func (*EventFilter) GetMaxVersion

func (x *EventFilter) GetMaxVersion() *wrapperspb.UInt64Value

func (*EventFilter) GetMinTimestamp

func (x *EventFilter) GetMinTimestamp() *timestamppb.Timestamp

func (*EventFilter) GetMinVersion

func (x *EventFilter) GetMinVersion() *wrapperspb.UInt64Value

func (*EventFilter) ProtoMessage

func (*EventFilter) ProtoMessage()

func (*EventFilter) ProtoReflect

func (x *EventFilter) ProtoReflect() protoreflect.Message

func (*EventFilter) Reset

func (x *EventFilter) Reset()

func (*EventFilter) String

func (x *EventFilter) String() string

func (*EventFilter) Validate added in v0.3.0

func (m *EventFilter) Validate() error

Validate checks the field values on EventFilter with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*EventFilter) ValidateAll added in v0.3.0

func (m *EventFilter) ValidateAll() error

ValidateAll checks the field values on EventFilter with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventFilterMultiError, or nil if none found.

type EventFilterMultiError added in v0.3.0

type EventFilterMultiError []error

EventFilterMultiError is an error wrapping multiple validation errors returned by EventFilter.ValidateAll() if the designated constraints aren't met.

func (EventFilterMultiError) AllErrors added in v0.3.0

func (m EventFilterMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventFilterMultiError) Error added in v0.3.0

func (m EventFilterMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventFilterValidationError added in v0.3.0

type EventFilterValidationError struct {
	// contains filtered or unexported fields
}

EventFilterValidationError is the validation error returned by EventFilter.Validate if the designated constraints aren't met.

func (EventFilterValidationError) Cause added in v0.3.0

Cause function returns cause value.

func (EventFilterValidationError) Error added in v0.3.0

Error satisfies the builtin error interface

func (EventFilterValidationError) ErrorName added in v0.3.0

func (e EventFilterValidationError) ErrorName() string

ErrorName returns error name.

func (EventFilterValidationError) Field added in v0.3.0

Field function returns field value.

func (EventFilterValidationError) Key added in v0.3.0

Key function returns key value.

func (EventFilterValidationError) Reason added in v0.3.0

Reason function returns reason value.

type EventFilters added in v0.3.6

type EventFilters struct {
	Filters []*EventFilter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"`
	// contains filtered or unexported fields
}

Request to get Events from to the store by using multiple filters

func (*EventFilters) Descriptor deprecated added in v0.3.6

func (*EventFilters) Descriptor() ([]byte, []int)

Deprecated: Use EventFilters.ProtoReflect.Descriptor instead.

func (*EventFilters) GetFilters added in v0.3.6

func (x *EventFilters) GetFilters() []*EventFilter

func (*EventFilters) ProtoMessage added in v0.3.6

func (*EventFilters) ProtoMessage()

func (*EventFilters) ProtoReflect added in v0.3.6

func (x *EventFilters) ProtoReflect() protoreflect.Message

func (*EventFilters) Reset added in v0.3.6

func (x *EventFilters) Reset()

func (*EventFilters) String added in v0.3.6

func (x *EventFilters) String() string

func (*EventFilters) Validate added in v0.3.6

func (m *EventFilters) Validate() error

Validate checks the field values on EventFilters with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*EventFilters) ValidateAll added in v0.3.6

func (m *EventFilters) ValidateAll() error

ValidateAll checks the field values on EventFilters with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventFiltersMultiError, or nil if none found.

type EventFiltersMultiError added in v0.3.6

type EventFiltersMultiError []error

EventFiltersMultiError is an error wrapping multiple validation errors returned by EventFilters.ValidateAll() if the designated constraints aren't met.

func (EventFiltersMultiError) AllErrors added in v0.3.6

func (m EventFiltersMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventFiltersMultiError) Error added in v0.3.6

func (m EventFiltersMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventFiltersValidationError added in v0.3.6

type EventFiltersValidationError struct {
	// contains filtered or unexported fields
}

EventFiltersValidationError is the validation error returned by EventFilters.Validate if the designated constraints aren't met.

func (EventFiltersValidationError) Cause added in v0.3.6

Cause function returns cause value.

func (EventFiltersValidationError) Error added in v0.3.6

Error satisfies the builtin error interface

func (EventFiltersValidationError) ErrorName added in v0.3.6

func (e EventFiltersValidationError) ErrorName() string

ErrorName returns error name.

func (EventFiltersValidationError) Field added in v0.3.6

Field function returns field value.

func (EventFiltersValidationError) Key added in v0.3.6

Key function returns key value.

func (EventFiltersValidationError) Reason added in v0.3.6

Reason function returns reason value.

type EventMultiError added in v0.3.0

type EventMultiError []error

EventMultiError is an error wrapping multiple validation errors returned by Event.ValidateAll() if the designated constraints aren't met.

func (EventMultiError) AllErrors added in v0.3.0

func (m EventMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventMultiError) Error added in v0.3.0

func (m EventMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventStoreClient

type EventStoreClient interface {
	// Store streams events to the store.
	Store(ctx context.Context, opts ...grpc.CallOption) (EventStore_StoreClient, error)
	// Retrieve returns a stream of Events.
	Retrieve(ctx context.Context, in *EventFilter, opts ...grpc.CallOption) (EventStore_RetrieveClient, error)
	// RetrieveOr returns a stream of Events by concatenating the filters with the logical or
	RetrieveOr(ctx context.Context, in *EventFilters, opts ...grpc.CallOption) (EventStore_RetrieveOrClient, error)
}

EventStoreClient is the client API for EventStore service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewEventStoreClient

func NewEventStoreClient(cc grpc.ClientConnInterface) EventStoreClient

type EventStoreServer

type EventStoreServer interface {
	// Store streams events to the store.
	Store(EventStore_StoreServer) error
	// Retrieve returns a stream of Events.
	Retrieve(*EventFilter, EventStore_RetrieveServer) error
	// RetrieveOr returns a stream of Events by concatenating the filters with the logical or
	RetrieveOr(*EventFilters, EventStore_RetrieveOrServer) error
	// contains filtered or unexported methods
}

EventStoreServer is the server API for EventStore service. All implementations must embed UnimplementedEventStoreServer for forward compatibility

type EventStore_RetrieveClient

type EventStore_RetrieveClient interface {
	Recv() (*Event, error)
	grpc.ClientStream
}

type EventStore_RetrieveOrClient added in v0.3.6

type EventStore_RetrieveOrClient interface {
	Recv() (*Event, error)
	grpc.ClientStream
}

type EventStore_RetrieveOrServer added in v0.3.6

type EventStore_RetrieveOrServer interface {
	Send(*Event) error
	grpc.ServerStream
}

type EventStore_RetrieveServer

type EventStore_RetrieveServer interface {
	Send(*Event) error
	grpc.ServerStream
}

type EventStore_StoreClient

type EventStore_StoreClient interface {
	Send(*Event) error
	CloseAndRecv() (*emptypb.Empty, error)
	grpc.ClientStream
}

type EventStore_StoreServer

type EventStore_StoreServer interface {
	SendAndClose(*emptypb.Empty) error
	Recv() (*Event, error)
	grpc.ServerStream
}

type EventValidationError added in v0.3.0

type EventValidationError struct {
	// contains filtered or unexported fields
}

EventValidationError is the validation error returned by Event.Validate if the designated constraints aren't met.

func (EventValidationError) Cause added in v0.3.0

func (e EventValidationError) Cause() error

Cause function returns cause value.

func (EventValidationError) Error added in v0.3.0

func (e EventValidationError) Error() string

Error satisfies the builtin error interface

func (EventValidationError) ErrorName added in v0.3.0

func (e EventValidationError) ErrorName() string

ErrorName returns error name.

func (EventValidationError) Field added in v0.3.0

func (e EventValidationError) Field() string

Field function returns field value.

func (EventValidationError) Key added in v0.3.0

func (e EventValidationError) Key() bool

Key function returns key value.

func (EventValidationError) Reason added in v0.3.0

func (e EventValidationError) Reason() string

Reason function returns reason value.

type UnimplementedCommandHandlerServer

type UnimplementedCommandHandlerServer struct {
}

UnimplementedCommandHandlerServer must be embedded to have forward compatible implementations.

func (UnimplementedCommandHandlerServer) Execute

type UnimplementedEventStoreServer

type UnimplementedEventStoreServer struct {
}

UnimplementedEventStoreServer must be embedded to have forward compatible implementations.

func (UnimplementedEventStoreServer) Retrieve

func (UnimplementedEventStoreServer) RetrieveOr added in v0.3.6

func (UnimplementedEventStoreServer) Store

type UnsafeCommandHandlerServer

type UnsafeCommandHandlerServer interface {
	// contains filtered or unexported methods
}

UnsafeCommandHandlerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CommandHandlerServer will result in compilation errors.

type UnsafeEventStoreServer

type UnsafeEventStoreServer interface {
	// contains filtered or unexported methods
}

UnsafeEventStoreServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EventStoreServer will result in compilation errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL