-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
112 lines (98 loc) · 2.73 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package eventuate
import (
"reflect"
"github.com/gmallard/stompngo"
"github.com/eventuate-clients/eventuate-client-golang/future"
)
type Crud interface {
Find(
aggregateType string,
entityId Int128,
findOptions *AggregateCrudFindOptions) (*LoadedEvents, error)
Save(
aggregateType string,
events []EventTypeAndData,
saveOptions *AggregateCrudSaveOptions) (*EntityIdVersionAndEventIds, error)
Update(
entityIdAndType EntityIdAndType,
entityVersion Int128,
events []EventTypeAndData,
updateOptions *AggregateCrudUpdateOptions) (*EntityIdVersionAndEventIds, error)
}
type Repository interface {
Save(cmd Command) (*EntityMetadata, error)
Update(entityId Int128, cmd Command) (*EntityMetadata, error)
Find(entityId Int128) (*EntityMetadata, error)
}
type Dispatcher interface {
Dispatch(interface{}, *EventMetadata) future.Settler
}
type Subscriber interface {
Subscribe(
subscriberId string,
aggregatesAndEvents map[string][]string,
subscriberOptions *SubscriberOptions,
handler *EventResultHandler) (*Subscription, error)
SubscribeAndDispatch(
subscriberId string,
eventHandlers *EventResultHandlerMap,
subscriberOptions *SubscriberOptions,
useSwimlane bool) (*DispatchingSubscription, error)
}
type SubscriberDispatcher interface {
Subscribe(
subscriberId string,
eventHandlers *EventResultHandlerMap,
subscriberOptions *SubscriberOptions,
useSwimlane bool) (*DispatchingSubscription, error)
}
type AggregateStore interface {
Save(
class reflect.Type,
events []interface{},
saveOptions *interface{}) (*EntityIdAndVersion, error)
Find(
class reflect.Type,
entityId string,
findOptions *interface{}) (*EntityWithMetadata, error)
Update(
class reflect.Type,
entityIdAndVersion EntityIdAndType,
events []interface{},
updateOptions *interface{}) (*EntityIdAndVersion, error)
Subscribe(
subscriberId string,
aggregatesAndEvents map[string]interface{},
subscriberOptions interface{},
dispatch func() interface{})
MaybeSnapshot(
aggregate *Aggregate,
snapshotVersion *Int128,
oldEvents []EventWithMetadata,
newEvents []interface{})
FromSnapshot(
class reflect.Type,
snapshot Snapshot) *Aggregate
}
type Acker interface {
Ack(stompngo.Headers) error
}
type TypeHintMapper interface {
//MakeCopy() TypeHintMapper
HasEventType(name string) bool
GetEventType(name string) reflect.Type
GetTypeByKeyName(name string) (bool, reflect.Type)
GetTypeByTypeName(typeName string) (bool, string)
}
type Unsubscriber interface {
Unsubscribe() error
}
type TypeHintRegisterer interface {
RegisterEventType(name string, typeInstance interface{}) error
}
type CommandProcessor interface {
ProcessCommand(command Command) []Event
}
type EventApplier interface {
ApplyEvent(evt Event) EventApplier
}