-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storage Nodes API #5
Comments
The node MAY override the configurations values using the following values from the input message: msg.remotepath -> What should be the file name if msg.payload is available? |
@brettdaman : First of all, I recently was aware that it should be the opposite. To avoid confusion to developers, if a node parameter is set, it takes precedence over the input msg. If none is supplied, it is an error. I will change the spec to reflect this. To answer your questions: -> What should be the file name if msg.payload is available? remotepath (take first config, then input) is mandatory. So, if payload is available, the filename in server is remotepath -> If a localpath is available I use the local file name. Google does not have a problem with duplicate names. This allows some flexibility. I don't have nothing against it, while you clearly document it in the node description. -> msg.remotepath is configurable in my node but not by msg input (1 folder deep from root). it not trivial to upload a file to a specific folder in google drive. This requires mapping between names, parents and folder Ids. It's ok to have one folder deep from root. Just document it. It is a next steps item. remotepath only by parameter. It's ok. |
Since I cant do anything to the remote path other than the folder selection in config I will use remotefilename. It is required if the payload is available. I will document this. Any reason why the msg variables are not camel-cased? |
Maybe we have a misunderstanding. With You can also contact me by slackif you have more questions. |
I don't think we should be using
If we instead use the standard file node as base I think our output of what is uploaded to dropbox would look something like this.
I think this will reduce the need for functions to normalize the |
@craig-mulligan, Thanks for the suggestion. You are right. Please, proceed considering there is a input-file node. However, I don't fully understand. What parameters are in the configuration of the node? |
The configuration of the node should have whatever credentials you need, eg |
@craig-mulligan , So: config:
input:
To summarize:
Is it ok? |
@rosogon I think it should be:
This is how many of the official node-red nodes work see: https://github.com/node-red/node-red-web-nodes |
@craig-mulligan : Ok |
@craig-mulligan a filename and path or not the same. content = payload || localpath.fileRead || error |
As advanced in #5 (comment), to avoid confusions we must prioritize configuration parameters over msg parameters. So, for your owncloud node:
|
[revisions of this spec in https://gist.github.com/rosogon/fb4e6cddcec1b9063903c00d500f86cb]
AGILE will provide a feature to upload data to a storage service or to download sensor data from a storage service.
Storage services are Google Drive, Dropbox, Owncloud.
After a quick search, it looks like these services do not provide an append() operation (GDrive had it in a now discontinued version of the API). Simulating an append() implies downloading a file, appending and re-uploading. For this reason, uploading will always overwrite a file.
There are two use cases:
NODERed nodes
Existent nodes can be used. For these nodes, the ideal way to configure the credentials is to pass them in the incoming message. See below.
A non-existent node must comply with the following. The configuration values and input MUST be clearly documented in the node.
Configuration
These are the configuration values:
Input
The input message triggers the upload.
The IDMNode will inject the credentials in the message (
msg.credentials
field), so the IDMNode will be placed in series.The node MAY take into account the following values from the input message in case the configuration values are not provided:
To summarize:
Output
The node is a regular output node and MUST NOT provide input to other nodes. This way, it behaves as the stock File node.
Cloud Storage UI
Through the AGILE Storage UI, the user can select the data from the local storage (i.e. select the sensing device and the timeframe of stored data) and select one of the supported storage services. Authenticate through the service if needed and push the data through the click of a button.
Upon successful data transfer the user is informed and provided with additional information (like public URL, etc.) where applicable
Form parameters:
[from, to) defines the range of timestamps of sensor data to upload.
UI backend layer
The common UI backend layer receives the form parameters. In case of storing to cloud, it has to load the appropriate values from local storage (determined by (device, component, from, to) and send the array of RecordObject to the Data Layer.
Data layer
There will be a data layer for each service in order to provide a uniform interface to Cloud Storage UI.
Store
URL store(Object credentials, byte[] data, String path)
Store content in the service.
credentials
is a provider-dependent object to authenticate to the service (OAuth2 token, probably).path
is the path to a file in the provider (e.g. /agile/temperature). Existing files MUST be overwritten. Intermediate folders MUST be created if needed.Load
byte[] load(Object credentials, String filename):
Returns the content of a file in the storage service.
credentials
is a provider-dependent object to authenticate to the service.path
is the path to a file in the provider (e.g. /agile/temperature).Dataset
Sensor data is in RecordObject format.
Data will be stored in time series, i.e. in collections of data points, which are <timestamp,value> tuples.
The format of a remote file is the json serialization of the RecordObject array, i.e.,
The text was updated successfully, but these errors were encountered: