IPFS中的分布式哈希表(DHT)

英文部分摘自官方文档,中文部分是基于理解上的翻译

Distributed hash tables (DHTs)

To find which peers are hosting the content you’re after (discovery), IPFS uses a distributed hash table, or DHT. A hash table is a database of keys to values. A distributed hash table is one where the table is split across all the peers in a distributed network. To find content, you ask these peers.

要找到哪个节点持有你想要的内容(这个过程叫做discovery),IPFS使用分布式哈希表(DHT)。哈希表是一个存储键值的数据库。分布式哈希表就是将表分割后分给分布式网络中的所有对等节点。要找到内容,你可以问这些对等节点。

Once you know where your content is (or more precisely, which peers are storing each of the blocks that make up the content you’re after), you use the DHT again to find the current location of those peers (routing). So, in order to get to content, you use libp2p to query the DHT twice.

一旦你知道了你的内容在哪里(或者更准确地说,哪些节点正在存储你想要的每个数据块),你就可以再次使用DHT来查找这些节点的当前位置(这个过程叫做routing)。因此,为了获得内容,要使用libp2p查询DHT两次。

Distributed Hash Tables (DHTs) are distributed key-value stores where keys are cryptographic hashes.
DHTs are, by definition, distributed. Each “peer” (or “node”) is responsible for a subset of the DHT.
When a peer receives a request, it either answers it, or the request is passed to another peer until a peer that can answer it is found.

分布式散列表(DHTs)是分布式键值对存储,其中的键是加密哈希值。
根据定义,DHT是分布式的。每个节点负责DHT的一个子集。
当一个节点接收到请求时,它要么应答请求,要么将请求传递给另一个节点,直到找到可以应答请求的节点为止。

Depending on the implementation, a request not answered by the first node contacted can be:

  • forwarded from peer to peer, with the last peer contacting the requesting peer

  • forwarded from peer to peer, with the answer forwarded following the same path

  • answered with the contact information of a node that has better chances to be able to answer. IPFS uses this strategy.

根据协议的实现,如果一个请求没有被第一个连接的节点应答的话,就会:

  • 从一个节点转发到另一个节点,直到最后一个节点与请求节点连接
  • 从一个节点转发到另一个节点,应答按照相同路径转发
  • 将能够更好地应答这个请求的其他节点作为应答。IPFS使用这种策略。

DHTs’ decentralization provides advantages compared to a traditional key-value store, including:

  • scalability, since a request for a hash of length n takes at most log2(n) steps to resolve.

  • fault tolerancevia redun

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值