Skip to content
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

Combine States and Objects #203

Closed
Jey-Cee opened this issue May 27, 2018 · 7 comments
Closed

Combine States and Objects #203

Jey-Cee opened this issue May 27, 2018 · 7 comments

Comments

@Jey-Cee
Copy link

Jey-Cee commented May 27, 2018

As in this thread written, States can not exists without an related Object. So it is uneccessary to handle them sepperate when deleting Object or State.

ToDo:

  • Remove delState from adapter.js
  • delObject/delForeignObject has to delete states too
GermanBluefox added a commit that referenced this issue Jun 5, 2018
(bluefox) Update acme to V2 (#199)
(bluefox) Implement adapter.terminate('Because I need it') (#197)
(bluefox) Improve deleteDevice (#186)
@Jey-Cee
Copy link
Author

Jey-Cee commented Jun 13, 2018

delState -> OK
delObject/delForeignObject -> OK

While testing this i found out that setState create's no Object related to the state.

@GermanBluefox
Copy link
Contributor

GermanBluefox commented Jun 13, 2018 via email

@GermanBluefox
Copy link
Contributor

Done?

@Jey-Cee
Copy link
Author

Jey-Cee commented Jun 26, 2018

Yes

@Jey-Cee Jey-Cee closed this as completed Jun 26, 2018
GermanBluefox added a commit that referenced this issue Sep 13, 2018
### Breaking changes:
* (bluefox) Breaking changes: "][*,;'"`<>?" are no more allowed in IDs

### Feature changes:
* (bluefox) the user by changing of states and objects is logged
* (bluefox) install specific version of missing adapter
* (bluefox) add disk info
* (bluefox) add memAvailable state
* (bluefox) add noChmod experimental settings
* (bluefox) stop instances only if they belongs to current host
* (bluefox) delete adapter only on current host and leave it on others
* (bluefox) Combine States and Objects (#203)
* (bluefox) Implement adapter.terminate('Because I need it') (#197)
* (alcalzone) add restart, disable, updateConfig methods to Adapter class
* (bluefox) add reinstall.js
* (bluefox) add "iob" as shortcut
* (bluefox) add getInterfaces to sendToHost
* (bluefox) implement backup of data folders via dataFolder flag
* (alcalzone) Add a wrapper method to safely expose ES6 classes to legacy code
* (bluefox) add information if instance is alive in "list instances"
* (stabilostick) added 'pidusage' for information about cpu and new states per adapter instance
* (bluefox) support of new mime types: pdf, doc, xls, ppt
* (bluefox) implement flag common.eraseOnUpload
* (bluefox) set quality codes on connection lost and adapter disconnect
* (alcalzone) Give adapters a chance to handle their own uncaught errors
* (alcalzone) Add call stack information to hard to trace error logs
* (bluefox) add pattern2RegEx to tools

### Fixes and Optimizations:
* (apollon77) the node10 testing was added
* (bluefox) the read file function was protected
* (bluefox) possible access rights problem was closed
* (bluefox) refactoring of memory calculations
* (bluefox) set default values of states by creation of new instances
* (alcalzone) Fix "install npm" messages, upgrade node typings to v6
* (bluefox) check if mem file could be read
* (buzzy1337) fix calculation of kilobyte to megabyte and fix reading /proc/meminfo
* (bluefox) Fix: Access to log files through admin does not work
* (bluefox) fix redis disconnect
* (bluefox) Update acme to V2 (#199)
* (bluefox) Improve deleteDevice (#186)
* (bluefox) fix cookie expiration
* (alcalzone) several async and testing fixes
* (bluefox) timeout for npm check added
* (bluefox) fix "object chmod 777 777 javascript.0.*" command
* (bluefox) do not send ready second time on reconnect db
* (Apollon77, Bluefox) prevent defaultObj to be overwritten with normal common details
* (bluefox) fix error if ID is empty
* (bluefox) check id by setObject
* (apollon77) Add amazon-dash to list of adapter to be installed with unsafe-perm
* (bluefox) leave backitup enabled after restore
@AlCalzone
Copy link
Collaborator

I just found out this causes the issue I describe here #268 . The reason for that is that I use delState because it used to delete the state without deleting the corresponding object.

The OP describes that States can not exists without an related Object. However this change is not entirely in line with this description. I think it is fair that deleting an object deletes the corresponding state. But deleting the state should not delete the object IMO.

Is it really necessary to delete the object when deleting the state? Or can we have the separation like this:

  • delState => only deletes state (since objects can exist without states)
  • delObject => deletes the object and the state

@Apollon77
Copy link
Collaborator

After thinking I would see it like @AlCalzone ... delState should only clear the value (as it did before). I also see this as a needed functionality e.g. when restructuring states in an adapter and adding a new substructure under the nbame of a former state ... sometime you want to remove the value from such a new channel object or so ...

@Apollon77
Copy link
Collaborator

Also the method name contains the scope:

  • setObject creates a new object with no or default value as state
  • delObject removes both object and state
  • setState only set state and returns error when object do not exist
  • delState removes the state vlalue and returns error when object do not exist

(same for the Foreign methods)

I think this way it is understandable

foxriver76 referenced this issue in foxriver76/ioBroker.js-controller May 4, 2021
Problem with node-version check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants