locka99 / opcua

A client and server implementation of the OPC UA specification written in Rust
Mozilla Public License 2.0
480 stars 129 forks source link

asynchronous or blocking getters and setters #166

Open lovasoa opened 2 years ago

lovasoa commented 2 years ago

Hello,

I cannot find in the documentation whether value getters and setters are supposed to be non-blocking or not. Looking at the code, it looks like they are indeed supposed to be. And there seem to be no way to define an asynchronous variable getter or setter.

What is the recommended way to implement a getter or setter that needs to interact with the network or the filesystem ?

locka99 commented 2 years ago

At present they're synchronous only. You could poll the current value and have your own thread in the background which refreshes that value.

lovasoa commented 2 years ago

That would be very inefficient !

locka99 commented 2 years ago

Yes I agree. I think until async permeates through the api it would be the only way to do it.