Commit Graph
10 Commits
Author SHA1 Message Date
yang qfandSoam Vasani a6869ab746 Fix function delete with uid (#142)
If no uid is provided, all versions of function files and function metadata will be deleted.  If a uid is provided, only that specific version is deleted, and the "latest" version of the function moves back to the previous one.

Fixes #152
2017-03-12 13:04:56 -07:00
Toby CrawleyandSoam Vasani ab6e2e8021 Improve command-line client error output (#122)
Motivation: The output when an error occurs shows an integer error code,
which isn't very helpful. And in the case of an error when creating a
resource, you also get a redundant log message from the controller
client.

Modifications:
* the controller client no longer logs errors
* the generated String() allows for the enum name to be displayed in the
  error output
* each errorCode enum member has a hand-generated description
* the format of the error message from the CLI client was modified to
  display the error description with the error message

Related to #112
2017-02-16 13:58:59 -08:00
Toby CrawleyandSoam Vasani 430639a1cf Report KeyNotFound from etcd as a 404 (#121)
This allows for proper classification of the error on the client side.
2017-02-13 13:16:12 -08:00
Toby CrawleyandSoam Vasani c8b5bb2972 Better convey duplicate name errors to client (#116)
Motivation: Creating duplicate resources currently results in a 500
error being displayed by the client, with no information about the true
nature of the failure.

Modifications:
* ResourceStore now converts any errors from the etcd client into
  fission errors, capturing the reason for the error in the case of a
  duplicate key (as ErrorNameExists)
* ErrorNameExists errors are signaled to the client with a
  409 (Conflict) HTTP status
* MakeErrorFromHTTP() now reads the body of the error response to
  retrieve the actual error message instead of using the HTTP status
  message
* the controller client now uses MakeErrorFromHTTP() to centralize
  status code -> error code mapping
* tests for all of the resources now check that duplicate resources are
  reported properly

Result: The client can now provide more context when a duplicate name is
given

related to #112
2017-02-13 08:58:52 -08:00
Soam Vasani 49acdc49eb Fix resource store errors on empty db 2016-11-02 00:23:06 -07:00
Soam Vasani a93c17548c Add exports that make controller usable 2016-10-29 20:38:50 -07:00
Soam Vasani f7757bdcc1 Add HTTP trigger API and client
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.
2016-09-21 15:56:29 -07:00
Soam Vasani fee2fb1d70 Helper func to connect to etcd 2016-09-20 21:58:53 -07:00
Soam Vasani a0cfadbd73 Fix deleteFile (missing deletes for etcd metadata)
Also move resource and serializer interfaces to types.go
2016-09-20 00:25:50 -07:00
Soam Vasani 94899a88a7 Some sort of generic etcd-backed store
- 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.
2016-09-10 01:01:27 -07:00