cortoproject / corto

A hierarchical object store for connecting realtime machine data with web applications, historians & more
https://www.corto.io
MIT License
87 stars 14 forks source link

Add 'update' and 'validate' lifecycle hooks to corto/lang/class #606

Closed SanderMertens closed 7 years ago

SanderMertens commented 7 years ago

Classes will have two new lifecycle hooks, 'validate' and 'update', in addition to the existing ones ('construct', 'destruct' and 'init'/'deinit' from corto/lang/type).

The validate hook will be called before an instance of the class is updated. The function will return an int16. If it returns a non-zero value, the update will be canceled (no observers will be notified) and the object will be invalidated (just like with construct).

The update hook will be called after observers have been notified of an update for the instance.