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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 乔闻

关于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