惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Threat Research - Cisco Blogs
V2EX - 技术
V2EX - 技术
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Recorded Future
Recorded Future
S
Schneier on Security
I
InfoQ
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The GitHub Blog
The GitHub Blog
S
Security @ Cisco Blogs
O
OpenAI News
W
WeLiveSecurity
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
人人都是产品经理
人人都是产品经理
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
The Hacker News
The Hacker News
Google Online Security Blog
Google Online Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
NISL@THU
NISL@THU
T
Tailwind CSS Blog
V
Visual Studio Blog
PCI Perspectives
PCI Perspectives
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
D
DataBreaches.Net
B
Blog RSS Feed
N
News and Events Feed by Topic
N
News and Events Feed by Topic
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
腾讯CDC
Latest news
Latest news
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
V
V2EX
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Register - Security
The Register - Security
Help Net Security
Help Net Security

博客园 - 乔闻

关于NVIDIA-geforce 1650和tesla-P4系列显卡,共用一个驱动的办法。其他型号一样。 记一次安装nvidia-container-runtme后,作为containerd默认的runtime,k8s节点挂掉的问题。 Docker Swarm Keepalived Operator:高可用集群虚拟 IP 管理方案 scheduler报错: Failed to watch *v1beta1.PodDisruptionBudget: failed to list *v1beta1.PodDisruptionBudget, no kind "KubeSchedulerConfiguration" is registered for version "componentconfig/v1alpha1" 介绍一个prometheus监控数据生成工具 ubuntu18.04安装时ACPI error 无法进入系统的问题 Supervisor-类unix系统下的进程控制工具 windows10 自带的OpenSSH Client(Beta) windows10 易升 下载失败 解决方法 Visual Studio for Mac 安装时无法连接到网络等问题 用VsCode编辑TypeScript OWIN是什么? Dapper 实例字段与静态字段区别 ref - 按引用传递参数 TweenMax 前台脚本库 如何使用CSS Sprites技术进行图片合并 QQ群开放接口 使用 Hexo 生成一套静态博客网页
EOS:dfuse stream 保证不会错过一个心跳
乔闻 · 2019-06-06 · via 博客园 - 乔闻

强大的 dfuse history API 给我们带来了高效的链数据获取途径,让我们的 dapp 在用户体验上了一个台阶。

官方示例

不会错过一个心跳

代码分析

函数

pendingActions 待处理的action。
ensureStream 返回steam实例。
commit 处理pendingActions中的action,并告诉dfuse server 当前处理的blockid,下次dfuse server推送的action就是基于你告诉dfuseserver的lastCommittedBlockNum,其中steam.mark()就是告诉dfuseserver的lastCommittedBlockNum的函数。

步骤

1.创建一个dfuse client
2.将Engine类托管dfuse client
3.调用streamActionTraces,接收ActionTraces流,于此同时接管dfuse的listening、action_trace、progress事件
4.当触发action_trace事件当时候,会调用commit方法(不会错过心跳在该方法里实现,请看函数里commit的解释),然后循环处理pendingActions中等待的action。等处理完之后,向pendingActions数组传入当前接收action,进入排队

总结

如果这个服务想要从头同步的话,我的理解应该是在listening事件的时候就告诉dfuseserver 当前同步的blockId,这样就会从你想要开始的地方推送数据流。

如果这个服务想要从头同步的话,streamActionTraces 里有个stream option 里有个start block,这样就会从你想要开始的地方推送数据流。

刚接触dfuse,如果有不对的地方请指出,谢谢。

相关资料

不会错过一个心跳
如何保证dfuse流持续连接
其他
Javascript例子
Javascript例子_live
Go例子
node.js例子
GraphQL API react demo
GraphQL API react live
查询语言规范
github
graphql编辑器和api文档浏览器_live