-
Notifications
You must be signed in to change notification settings - Fork 219
/
events.go
103 lines (91 loc) · 3.07 KB
/
events.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
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package sim
// An Event represents an atomic step of a execution.
type Event interface {
isEvent()
}
// EventOpStart represents the start of an op.
type EventOpStart struct {
TraceID int // trace id
SpanID int // span id
Name string // op name
Args []string // op arguments
}
// EventOpFinish represents the finish of an op.
type EventOpFinish struct {
TraceID int // trace id
SpanID int // span id
Error string // returned error message
}
// EventCall represents a component method call.
type EventCall struct {
TraceID int // trace id
SpanID int // span id
Caller string // calling component (or "op")
Replica int // calling component replica (or op number)
Component string // component being called
Method string // method being called
Args []string // method arguments
}
// EventDeliverCall represents a component method call being delivered.
type EventDeliverCall struct {
TraceID int // trace id
SpanID int // span id
Component string // component being called
Replica int // component replica being called
}
// EventReturn represents a component method call returning.
type EventReturn struct {
TraceID int // trace id
SpanID int // span id
Component string // component returning
Replica int // component replica returning
Returns []string // return values
}
// EventDeliverReturn represents the delivery of a method return.
type EventDeliverReturn struct {
TraceID int // trace id
SpanID int // span id
}
// EventDeliverError represents the injection of an error.
type EventDeliverError struct {
TraceID int // trace id
SpanID int // span id
}
// EventPanic represents a panic.
type EventPanic struct {
TraceID int // trace id
SpanID int // span id
Panicker string // panicking component (or "op")
Replica int // panicking component replica (or op number)
Error string // panic error
Stack string // stack trace
}
func (EventOpStart) isEvent() {}
func (EventOpFinish) isEvent() {}
func (EventCall) isEvent() {}
func (EventDeliverCall) isEvent() {}
func (EventReturn) isEvent() {}
func (EventDeliverReturn) isEvent() {}
func (EventDeliverError) isEvent() {}
func (EventPanic) isEvent() {}
var _ Event = EventOpStart{}
var _ Event = EventOpFinish{}
var _ Event = EventCall{}
var _ Event = EventDeliverCall{}
var _ Event = EventReturn{}
var _ Event = EventDeliverReturn{}
var _ Event = EventDeliverError{}
var _ Event = EventPanic{}