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

推荐订阅源

P
Privacy International News Feed
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
云风的 BLOG
云风的 BLOG
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Announcements
Recent Announcements
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LangChain Blog
The GitHub Blog
The GitHub Blog
aimingoo的专栏
aimingoo的专栏
Scott Helme
Scott Helme
腾讯CDC
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
Cloudbric
Cloudbric
K
Kaspersky official blog
B
Blog RSS Feed
博客园_首页
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
Vercel News
Vercel News
The Last Watchdog
The Last Watchdog
S
Schneier on Security
T
Tor Project blog
雷峰网
雷峰网
博客园 - 司徒正美
H
Hacker News: Front Page
I
Intezer
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Help Net Security
Help Net Security
WordPress大学
WordPress大学
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
V
Vulnerabilities – Threatpost
Forbes - Security
Forbes - Security
Google DeepMind News
Google DeepMind News
T
Threatpost

博客园 - 乔闻

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