Updated Design: Version Control (markdown)

Nick O'Leary 2016-07-13 14:27:23 +01:00
parent ec2de7b953
commit 2148ca9243
1 changed files with 37 additions and 1 deletions

@ -27,7 +27,6 @@ Use cases include:
Whilst clearly influenced by git as a likely common backend, the version control API needs to be careful to abstract the operations it provides sufficiently so that alternative VC systems can be used underneath it. It does not require the full breadth of capability that git provides (branching/merging etc).
The basic operations are:
- get a version - defaults to the most recent version, but a version id can also be specified
@ -36,3 +35,40 @@ The basic operations are:
The API should also allow a 'user' identified to passed to each of these calls.
The existing API has separate methods for saving flows and credentials. The new API must version them as a single entity, although underlying implementations may choose to store them separately.
---
### `Storage.init(runtime)`
- `runtime` : a RED runtime object
Passing in the runtime object allows the storage mechanism to access the `settings`, `log` components properly as well as `comms` if it needs to send notifications to the user.
### `Storage.getFlows([id])`
- `id` : _optional_ : identifies a specific version to return
Returns a promise that resolves to the combined flow/credential configuration
### `Storage.setFlows(flowConfig,[options])`
- `flowConfig` : the combined flow/credential configuration
- `options` : _optional_ : an options object that can contain the following properties:
- `user` : _optional_ : an identifier for the user setting the flows
- `description` : _optional_ : a short description to associate with the change
Returns a promise that resolves to the `id` of the version saved.
### `Storage.getFlowHistory()`
Returns a promise that resolves to an array of history entries. Each entry consists of:
- `id` : the version id
- `date` : the timestamp of the version (format tbd)
- `description` : the short description of the change (will have sensible default, or blank, if none specified)
- `user` : an identifier for the user who saved the version
---
The format of the combined flow/credential configuration is a vital detail that needs some more thinking.
The starting point will be the already documented [new flow format](https://github.com/node-red/node-red/wiki/Design%3A-Flow-file-format-v2). With an additional `credential` property at the top level that contains the node credentials.