PubSub中的设备和设备记忆之间的差异是什么?
如Pub-Sub的TOIT标准库文档中所写(请参阅 https://libs.toit。 io/pubsub/Library-Summary )有两个设备主题。其中之一是设备:*
,另一个设备模式:*。
我找不到任何解释会有什么区别...有什么想法?
谢谢!
as written in the toit standard library documentation for pub-sub (see https://libs.toit.io/pubsub/library-summary) there are two device topics. One of them is device:*
and the other one device-memory:*
.
I couldn't find any explanation what the difference would be... Any idea?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设备内存版本不会将对象存储在Flash中。因此,它更有效,但是如果设备在订阅有机会阅读数据之前关闭设备,则可能会丢失数据。
例如:
如果您安装这些程序,并重置设备,则应在日志中查看以下输出:
如果您在看到“运行”之后重置设备,但是在接收器有机会实际获取该设备之前数据,然后发布的消息将丢失。
但是,如果将主题切换到
设备:test
(在所有文件中),则将消息写入flash,重置设备不会丢失任何数据。The device-memory version doesn't store the object in flash. As such it is more efficient, but it may lose data if the device is powered down before subscriptions have a chance to read the data.
For example:
If you install these programs, and reset the device you should see the following output in your logs:
Now, if you reset the device just after you see the "running", but before the receiver has a chance to actually get the data, then the published message will be lost.
However, if you switch the topic to
device:test
(in all files), then the message is written to flash, and resetting the device won't lose any data.