-
Notifications
You must be signed in to change notification settings - Fork 69
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
feature: 'meta' deltas #454
Conversation
Just to get some context; I think you are proposing that meta be sent by the server to subscribers over websockets? If so I assume that this would be sent upon initial subscription and then subsequently only if there are any changes to meta data? Also you propose a new type of delta just for meta data, but should it be completely separate or an optional part of the existing delta format? I agree that it would be very good to be able to see changes to meta data (warning zones, gauge scale, etc.) immediately pushed out to display devices and would make server/sensor set up significantly more transparent for users. |
Yes. These would get pushed out to clients when the connection is established. This a new type of delta. Note that it is |
What's wrong with sending a {
"context": "vessels.urn:mrn:signalk:uuid:c0d79334-4e25-4245-8892-54e8ccc8021d",
"updates": [
{
"values": [
{
"path": "navigation.speedThroughWater.meta",
"value": { /* meta object */ }
},
{ /* additional meta values for other paths */ }
]
}
]
} |
Then for existing apps/code, you would get Which is not what the spec says. |
I was afraid that might be the case. Which I think means that we cannot update most values under sources or sails via delta at the moment because they don’t place all their values under |
The other case is for properties like a vessels
|
@bkp7 @timmathews @rob42 There are two issues at hand here, let's keep this discussion on the original PR (meta deltas) and move the problem with @sbender9 I (personally) see no issues with adding this to the delta spec; the updates array could contain both values and metas, or either one of them. There are some things to do, however, before we can merge anything. Also, I'm interested in hearing @tkurki's opinion on this matter (meta deltas), as he is the author of the original delta spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still work to be done:
- Update the delta specification (https://github.com/SignalK/specification/blob/master/schemas/delta.json)
- Add documentation
- Fix travis build error
- Implement support for this in a branch of node reference server
I would start with support for this in the reference server, not the specification. Haven't really thought this through yet. |
I think this is really good functionality to implement, but I agree with @tkurki in that I it needs more thought, and as part of that we need to check any proposal will work at each type of data point in the schema. It's not as simple as value/values, meta and properties such as name, etc. as we currently have some in the specification that are 'different', probably by mistake though.... I'm not sure we should separate at this point. In essence we have time series data (which we expect to change during a voyage), currently dealt with in Deltas. Then there is the data which is fixed in nature and is updated as part of maintenance events (change of name, change of meta details, etc). Separating out the meta from other fixed type data at this point may ultimately just add unnecessary complexity. |
Reference implementation: SignalK/signalk-server#481 |
Shoot. My push with the latest code failed today. Will get the latest code there tomorrow... |
OK, that's fixed. node server implementation looks good now. |
Thanks @sbender9. I updated my review comment |
@fabdrol I updated the schema and added tests |
@sbender9, I've not done a full review, but the changes seem to have altered the behaviour of the api. For example the output from the test 'AIS delta produces valid Signal K' used to include a meta section in the full signalk but it doesn't do that now. Is that deliberate? Is there any reason the meta within the delta shouldn't reference the meta in definitions? "value": {
"$ref": "./definitions.json#/definitions/meta"
} What's the rationale behind making meta and values mutually exclusive, and what is the use case for source alongside meta? The documentation doesn't cover this. Finally, before this gets merged can we consider the interaction with the API separation #435 please. Assuming #435 gets merged I think it may be better to do that first and apply the changes to the API embedded in this PR to the API project. I'm happy to implement the above changes into the new API once #435 is sorted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comma needed at the end of line 90, also what is the use case for leaving additionalProperties set to true?
@sbender values and meta are mutually exclusive by virtue of the {
"context": "bar",
"updates": [
{
"source": {
"label": "schema"
},
"timestamp": "2013-10-08T15:47:28.263Z",
"meta": [
{
"path": "a.b.c",
"value": {
"units": "m"
}
}
],
"values": [
{
"path": "a.b.c",
"value": 1234
}
]
}
]
} I'd suggest adding this as an extra test. Fixing the schema should just be a case of changing "oneOf": [
{
"required": ["values"],
"properties": {"$source":{}, "source": {}, "timestamp": {}, "values": {}},
"additionalProperties": false
},
{
"required": ["meta"],
"properties": {"$source":{}, "source": {}, "timestamp": {}, "meta": {}},
"additionalProperties": false
},
{
"required": ["values", "meta"],
"properties": {"$source":{}, "source": {}, "timestamp": {}, "values": {}, "meta": {}},
"additionalProperties": false
}
], |
@sbender9 really sorry, I must have had some files in an altered state when I was running it. Have looked at it again and it's fine, please accept my apologies. |
Ready now as far as I'm concerned |
I don't understand why this test is failing. Any ideas? |
gitbook-docs/data_model.md
Outdated
@@ -263,6 +263,32 @@ the value should be merged to the full model mounted where the delta‘s context | |||
] | |||
} | |||
``` | |||
## Delta Format For Metadata | |||
|
|||
Metadata can also be specified via a delta. The delta is very similiar to the `values` deltas above, but instead of having `values` key, it will have a `meta` key. Note that a client could multiple meta deltas for any given path from different sources, so the client merge the meta information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check grammar. Also clarify that the full meta must be provided in the meta delta (ie. the same as values where the full value must be supplied).
What does merge metas refer to? There should be one reliable source of meta at the Master Main.
Also we need an explanation - probably in subscription_protocol.md as to when these meta-deltas are required to be sent by the server and the relationship to different subscription policies. I'm assuming that meta-delta will only be sent on an 'instant' basis to existing subscriptions even if they are not 'instant'??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see PR #491 for suggested changes
schemas/delta.json
Outdated
}, | ||
"value": { | ||
"$ref": "./definitions.json#/definitions/meta", | ||
"additionalProperties": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a need for additionalProperties here. If so an explanation is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see PR #492 removing additionalProperties: true
@sbender, I haven't time until mid next week, but if you don't get a chance to look at the review points in the meantime, I will create a PR with suggestions then. |
@sbender, having looked at this in more detail I don't think the meta is in the right place. If you look at the test with both values and meta it is confusing as neither the source(or $source) or timestamp would apply to the meta. Therefore, I think the meta should be up a level next to updates. Thoughts? |
I think |
@sbender, yes it could come from a sensor/slave server but so could items such as vessel name. We define: 'master is the canonical source for identity and configuration information for the entire vessel'. Meta is configuration information and the idea of having different versions of meta data could lead to unfortunate results. For example if you had 2 coolant temperature sensors, one set up with alarms, etc. and the other providing just a value, if the first sensor fails and you start to use the second, the user would not expect to lose the alarm functionality. In other words the meta should be the same irrespective of the source of the value. Perhaps we should make it clear that meta is configuration information and it is up to the master to manage that when it comes from different sources. |
I still think this is a good idea, but there’s a lot comments here and it’s hard parse where to go from here. As far as I can tell, the only remaining issue is how to handle meta coming from multiple sources for the same path. I think we can leave that up to the client to handle since source is included. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go:
- merged the PRs from bkp7 that updated the samples in the doc
- rebased on master and removed addMetas/addMeta from fullsignalk, as they are already there
@sbender9 if you want to have a last look please do so and feel free to merge. I'll continue updating the docs publishing toolchain in #630 to get this published.
There is currently no way to send
meta
data via deltas. This PR adds a new type of delta just for meta data.The deltas would look like this:
TODO