Documentation
¶
Index ¶
Constants ¶
View Source
const ( //MaxPayloadSize is hard coded max size of each event can carray MaxPayloadSize = 6 << 20 // 6 MB // MaxTimeout is max execution time enfoced by runtime MaxTimeout = 4 * time.Hour // DefaultJobTimeout is hard coded max timeout for a task, same as AWS DefaultJobTimeout = 9 * time.Minute )
Variables ¶
View Source
var ( // PingMsg bytes of ping action message PingMsg = []byte("{\"a\":\"_ping\"}\r\n") // TokenCRLF is token of \r\n TokenCRLF = []byte{'\r', '\n'} )
Functions ¶
func GetErrActionBytes ¶
GetErrActionBytes create action bytes of a error
func MustFromObject ¶
func MustFromObject(obj interface{}) json.RawMessage
MustFromObject creates new from a object
Types ¶
type Action ¶
type Action struct {
Type MessageType `json:"a"`
Payload json.RawMessage `json:"p,omitempty"`
}
Action is basic unit between loader and a func {"a":"req","p":"hello world"}\r\n
type ErrorMessage ¶
type ErrorMessage struct {
Message string `json:"errorMessage"`
Type string `json:"errorType,omitempty"`
StackTrace []interface{} `json:"stackTrace,omitempty"`
Fatal bool `json:"fatal"`
}
ErrorMessage wraps error information during a invocation
func GetErrorMessage ¶
func GetErrorMessage(err error) *ErrorMessage
GetErrorMessage creates ErrorMessage from given golang error
type InvokeRequest ¶
type InvokeRequest struct {
Args json.RawMessage `json:"args"`
RequestID string `json:"rid,omitempty"`
TraceID string `json:"tid,omitempty"`
Deadline time.Time `json:"deadline,omitempty"`
User string `json:"user,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
}
InvokeRequest wraps data pass to function invocation
type InvokeResponse ¶
type InvokeResponse struct {
Payload json.RawMessage `json:"payload,omitempty"`
Error *ErrorMessage `json:"error,omitempty"`
// Content type of payload
ContentType string `json:"ContentType,omitempty"`
}
InvokeResponse is the message returns from a function
type MessageType ¶
type MessageType string
MessageType alias type for event's type
const ( // The payload is a request object Request MessageType = "req" // The payload is a response object Response MessageType = "rsp" // The payload is a emitted message Emit MessageType = "emit" // The payload is a logging line Log MessageType = "log" // Indicates the communication end with a error Error MessageType = "err" // Ping action Ping MessageType = "_ping" )
Predefined actions
Click to show internal directories.
Click to hide internal directories.