-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add site_defaults.json in site model directory, which can supply default values to all Metadata. #288
Add site_defaults.json in site model directory, which can supply default values to all Metadata. #288
Conversation
…evel can have default settings for the entire set.
site_defaults.json into device Metadata if the values are not present.
…o site_wide_defaults
site_defaults.json is loaded with the metadata schema.
the latter of which existed to post-process readMetadata() output in an earlier version.
produce default configs.
which was not discussed.
validator/src/main/java/com/google/daq/mqtt/registrar/Registrar.java
Outdated
Show resolved
Hide resolved
validator/src/main/java/com/google/daq/mqtt/registrar/Registrar.java
Outdated
Show resolved
Hide resolved
validator/src/main/java/com/google/daq/mqtt/registrar/LocalDevice.java
Outdated
Show resolved
Hide resolved
Lazier exception catching.
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.
Ok ptal. Note that calling it "site_metadata" also looks good in code w/r/t variable names.
@@ -180,19 +196,25 @@ | |||
private final ExceptionMap exceptionMap; | |||
private final String generation; | |||
private final List<DeviceCredential> deviceCredentials = new ArrayList<>(); | |||
private final TreeMap<String, Object> siteMetadata; |
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.
Seems like it would be cleaner overall to keep the class variable as Metadata (rather than TreeMap), and then convert to TreeMap only at the point of use?
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.
Then we convert it once per metadata loaded?
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.
True -- although I've never seen performance be an actual issue with any of this stuff :-). I also think it's only likely to be called relatively infrequently per device (once, maybe twice?) Your call, I'm good either way.
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.
Oh, "unapprove" -- was hoping to have the update for the udmi_site_model reference in the PR as well (for testing)...
…o site_wide_defaults
No description provided.