Programming model doc update
This commit is contained in:
@@ -1,21 +1,8 @@
|
|||||||
Programming Model
|
# Programming Model
|
||||||
=================
|
|
||||||
|
|
||||||
This document describes the programming model for fission functions.
|
This document describes the programming model for fission functions.
|
||||||
|
|
||||||
See TERMINOLOGY for definitions of terms, such as _function_,
|
## Time Limits
|
||||||
_instance_, and _trigger_.
|
|
||||||
|
|
||||||
|
|
||||||
Idempotency
|
|
||||||
===========
|
|
||||||
|
|
||||||
Fission assumes that functions are idempotent. Functions whose instances
|
|
||||||
die without a result are restarted, upto a certain restart limit.
|
|
||||||
|
|
||||||
|
|
||||||
Time Limits
|
|
||||||
===========
|
|
||||||
|
|
||||||
By default, there is no time limit on fission functions.
|
By default, there is no time limit on fission functions.
|
||||||
|
|
||||||
@@ -23,49 +10,15 @@ Idle running instances may be killed at any time (usually after the
|
|||||||
default idle timeout of 10 minutes, but this is configurable).
|
default idle timeout of 10 minutes, but this is configurable).
|
||||||
|
|
||||||
|
|
||||||
Mapping
|
## HTTP Triggers
|
||||||
=======
|
|
||||||
|
|
||||||
This section specifies the mapping between: (1) HTTP and other
|
Functions triggered over HTTP receive the HTTP request object in the
|
||||||
triggers, and (2) function parameters, return values, and exceptions.
|
context. The request's query string, POST body, etc. can be retrieved
|
||||||
|
from this object. The interface is language-specific: see [TODO] for
|
||||||
In other words, this section describes how a function should be called
|
documentation on the context object in each environment.
|
||||||
based on a given trigger, and how the functions behaviour affects the
|
|
||||||
result returned from the trigger.
|
|
||||||
|
|
||||||
The HTTP Trigger
|
|
||||||
----------------
|
|
||||||
|
|
||||||
NodeJS
|
|
||||||
------
|
|
||||||
|
|
||||||
NodeJS functions are called with a context object.
|
|
||||||
|
|
||||||
context.request contains the nodeJS Request object.
|
|
||||||
|
|
||||||
In addition,
|
|
||||||
|
|
||||||
context.queryString contains the parsed querystring
|
|
||||||
|
|
||||||
context.body contains the parsed body
|
|
||||||
|
|
||||||
context.status sets the HTTP response status code. If context.status
|
|
||||||
is an invalid HTTP status, then the HTTP status is set to 500.
|
|
||||||
|
|
||||||
Exceptions result in a HTTP 500 error.
|
|
||||||
|
|
||||||
|
|
||||||
|
## Kubernetes Watch Event Triggers
|
||||||
|
|
||||||
|
Kubernetes watches can be used to trigger functions. These functions
|
||||||
|
receive the Kubernetes watch.Event object in JSON-serialized form.
|
||||||
XXX Should we have a "context.done()"? What are the pros and cons?
|
|
||||||
|
|
||||||
XXX Who handles serialization and deserialization? Should we do json
|
|
||||||
automatically based on content-type and accept headers?
|
|
||||||
|
|
||||||
|
|
||||||
Python
|
|
||||||
------
|
|
||||||
|
|
||||||
Same as node, pretty much.
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user