-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathcontext.go
64 lines (47 loc) · 1.99 KB
/
context.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
package activity
import (
"context"
"github.com/project-flogo/core/data"
"github.com/project-flogo/core/data/metadata"
"github.com/project-flogo/core/support/log"
"github.com/project-flogo/core/support/trace"
)
// Context describes the execution context for an Activity.
// It provides access to attributes, task and Flow information.
type Context interface {
// ActivityHost gets the "host" under with the activity is executing
ActivityHost() Host
//Name the name of the activity that is currently executing
Name() string
// GetInput gets the value of the specified input attribute
GetInput(name string) interface{}
// SetOutput sets the value of the specified output attribute
SetOutput(name string, value interface{}) error
// GetInputObject gets all the activity input as the specified object.
GetInputObject(input data.StructValue) error
// SetOutputObject sets the activity output as the specified object.
SetOutputObject(output data.StructValue) error
// GetSharedTempData get shared temporary data for activity, lifespan
// of the data dependent on the activity host implementation
GetSharedTempData() map[string]interface{}
// Logger the logger for the activity
Logger() log.Logger
// GetTracingContext returns tracing context associated with the activity
GetTracingContext() trace.TracingContext
// GetCancelContext returns cancel context
GetCancelContext() context.Context
}
type Host interface {
// ID returns the ID of the Activity Host
ID() string
// Name the name of the Activity Host
Name() string
// IOMetadata get the input/output metadata of the activity host
IOMetadata() *metadata.IOMetadata
// Reply is used to reply to the activity Host with the results of the execution
Reply(replyData map[string]interface{}, err error)
// Return is used to indicate to the activity Host that it should complete and return the results of the execution
Return(returnData map[string]interface{}, err error)
// Scope returns the scope for the Host's data
Scope() data.Scope
}