Environments for functions. For now this is just the image URL for the
function run container. In the future, Environments will also have
build container image URLs, and perhaps parameters to those
containers.
Create/read/update/delete/list. Versioning will be added later. For
now, only the latest update is stored.
This implemenents create/read/update/delete/list for http triggers.
This isn't quite the final implementation: you can't look up old
versions by UUID since it only stores the latest update. I'll get to
that later.
FunctionStore uses fileStore for function code and resourceStore for
the Function's metadata. Environment- and HTTPTrigger- Store are just
thin wrappers on resourceStore.
There is probably a better way to organize this code, maybe with
reflection.
- A generic Resource interface, which is serializable and has
a key() method to get an identifying key.
- A resourceStore, which has create, read, update, delete and list.
This wraps etcd key operations and serialization/deserialization in
a convenient service. Serialization is provided to the
resourceStore as a 'serialization' interface. This can be JSON or
anything else.
- The resourceStore also has file operations -- this has read, write
and delete operations. The general idea is to store metadata in
etcd and data on the fileStore (which could also be an object store,
we don't really use any file-specific properties). Files are also
versioned -- each writeFile writes to a new UUID and that UUID is
stored in an etcd in-order list. readFile can retrieve an arbitrary
version by UUID, or just get the latest contents.
This is currently:
1. A list of http triggers
2. A method to generate a mux router from that list
This will be in the future:
1. A way to keep the set of triggers up to date, by watching the controller API
2. A way to update the router when the trigger set changes
The function handler will be the handler for each http trigger. It
will look up the function service map to find a service for the
function (and call the pool manager to create a new service if one
doesn't already exist, though this isn't implemented yet). It'll then
proxy the request to the service.
Concurrency-safe mapping from a function's (name, uid) identifier to a
URL. This will be used to look up the service URL associated with a
given function.
Mutable mux test occasionally panics because the server is shut down
before the client goroutine. Fix this by shutting down the client
goroutines before shutting down the server.
We want to be able to update routes without restarting the http
server. mutableRouter is a very thin wrapper around
github.com/gorilla/mux that enables safely switching to a new mux
router without pausing requests.
First cut of a function run container for NodeJS. So far, just the
simplest stuff: loads a user function and routes requests to it. The
user function is assumed to be in a file at a provided location. The
fission runtime is expected to place the file there securely (exactly
how we'll do that is TBD).
Doesn't handle path template params, query strings, etc. Will also
need to be extended later with some sort of hook for graceful
shutdown.