Documentation ¶
Index ¶
- Constants
- func Debug(withDebug bool)
- func Log(msg string)
- func RegisterAction(actionFunc interface{})
- func UseHTTPClient(client *http.Client)
- func WithFlow(fn fdk.Handler) fdk.Handler
- type ErrorResult
- type Flow
- type FlowFuture
- type HTTPRequest
- type HTTPResponse
- type InvokeStageRequest
- type InvokeStageResponse
Constants ¶
View Source
const ( // protocol headers. beware, since we're using go http.Header, casing is sensitive HeaderPrefix = "Fnproject-" FlowIDHeader = HeaderPrefix + "Flowid" StageIDHeader = HeaderPrefix + "Stageid" ContentTypeHeader = "Content-Type" JSONMediaHeader = "application/json" GobMediaHeader = "application/x-gob" OctetStreamMediaHeader = "application/octet-stream" MaxContinuationArgCount = 2 )
Variables ¶
This section is empty.
Functions ¶
func RegisterAction ¶
func RegisterAction(actionFunc interface{})
RegisterAction registers a go function so it can be used as an action in a flow stage
func UseHTTPClient ¶
UseHTTPClient allows the default http client to be overriden for calls to the flow service. This function must be called prior to flows.WithFlow to take effect (e.g. from an init method)
Types ¶
type ErrorResult ¶
type ErrorResult struct {
Error string `json:"error"`
}
errors cannot be encoded using gobs, so we just extract the message and encode with json
func (*ErrorResult) Err ¶
func (e *ErrorResult) Err() error
type Flow ¶
type Flow interface { InvokeFunction(functionID string, arg *HTTPRequest) FlowFuture Supply(action interface{}) FlowFuture Delay(duration time.Duration) FlowFuture CompletedValue(value interface{}) FlowFuture // value can be an error EmptyFuture() FlowFuture AllOf(futures ...FlowFuture) FlowFuture AnyOf(futures ...FlowFuture) FlowFuture }
func CurrentFlow ¶
func CurrentFlow() Flow
type FlowFuture ¶
type FlowFuture interface { Get() (chan interface{}, chan error) // Get result as the given type. E.g. for use with ThenCompose GetType(t reflect.Type) (chan interface{}, chan error) ThenApply(action interface{}) FlowFuture ThenCompose(action interface{}) FlowFuture ThenCombine(other FlowFuture, action interface{}) FlowFuture WhenComplete(action interface{}) FlowFuture ThenAccept(action interface{}) FlowFuture AcceptEither(other FlowFuture, action interface{}) FlowFuture ApplyToEither(other FlowFuture, action interface{}) FlowFuture ThenAcceptBoth(other FlowFuture, action interface{}) FlowFuture ThenRun(action interface{}) FlowFuture Handle(action interface{}) FlowFuture Exceptionally(action interface{}) FlowFuture ExceptionallyCompose(action interface{}) FlowFuture Complete(value interface{}) bool }
type InvokeStageRequest ¶
type InvokeStageRequest struct { FlowID string `json:"flow_id,omitempty"` StageID string `json:"stage_id,omitempty"` Closure *models.ModelBlobDatum `json:"closure,omitempty"` Args []*models.ModelCompletionResult `json:"args,omitempty"` }
models incoming request API (not auto-generated from swagger!)
type InvokeStageResponse ¶
type InvokeStageResponse struct {
Result *models.ModelCompletionResult `json:"result,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.