「ピアツーピア層」の版間の差分

提供: tezos-wiki
移動先: 案内検索
(ページの作成:「.. _p2p: = The peer-to-peer layer = This document explains the inner workings of the peer-to-peer layer of the Tezos shell. This part is in charge of establishing and m...」)
 
 
1行目: 1行目:
.. _p2p:
+
..p2p:
  
= The peer-to-peer layer =
+
=ピアツーピア層=
  
This document explains the inner workings of the peer-to-peer layer of the Tezos shell. This part is in charge of establishing and maintaining network connections with other nodes (gossip).
+
このドキュメントでは、Tezosシェルのピアツーピア層の内部動作について説明します。この部分は、他のノード(ゴシップ)とのネットワーク接続の確立と維持を担当しています。
  
The P2P layer is instanciated by the node. It is parametrized by the type of messages that are exchanged over the network (to allow different P2P protocol versions/extensions), and the type of metadata associated to each peer. The latter is useful to compute a score for each peer that reflects the level of trust we have in it. Different policies can be used when communicating with peers with different score values.
+
P2P層はノードによってインスタンス化される。ネットワークを介して交換されるメッセージのタイプ(異なるP2Pプロトコルのバージョン/拡張を許可するため)、および各ピアに関連付けられたメタデータのタイプによってパラメータ化されます。後者は、私たちが持っている信頼のレベルを反映する各ピアのスコアを計算するのに便利です。異なるスコア値を持つピアと通信するときに、異なるポリシーを使用できます。
  
The P2P layer is comprised of a pool of connections, a set of operations on those connections, and a set of workers following the worker pattern pervasively used in the code base.
+
P2Pレイヤーは、接続のプール、それらの接続上の一連の操作、およびコードベースで広く使用されるワーカーパターンに従った一連のワーカーで構成されます。
  
The P2P layer is packaged in :package:<code>tezos-p2p</code>, which has documentation for all modules.
+
P2Pレイヤーは、パッケージ:<code> tezos-p2p </code>にパッケージ化されています。
  
== General operation ==
+
==一般的な操作==
  
I/O Scheduling <sub><sub><sub><sub><sub><sub>~</sub></sub></sub></sub></sub></sub>~
+
入出力スケジューリング<sub> <sub> <sub> <sub> <sub>?</sub> </sub> </sub> </sub> </sub>?
  
The P2P layer uses I/O scheduling in order to be able to control its bandwidth usage as well as implementing different policies (e.g. read/write quotas) to different peers. For now, each peer is granted a fair share of the global allocated bandwidth, but it is planned for the individual allocated bandwidth to each peer to be a function of the peer's score.
+
P2P層は、帯域幅の使用を制御するとともに、異なるピア(例えば、読み出し/書き込みクォータ)に異なるポリシーを実装するために、I / Oスケジューリングを使用する。今のところ、各ピアにはグローバルに割り当てられた帯域幅の公平な配分が与えられますが、各ピアへの個々の割り当て帯域幅がピアのスコアの関数になるように計画されています。
  
Encryption <sub><sub>~</sub>~</sub>~~
+
暗号化<sub> <sub>?</sub>?</sub> ~~
  
The connection between each peer is encrypted using <code>NaCl</code> authenticated-encryption <code>API &lt;http://nacl.cr.yp.to/box.html&gt;</code>__. This is done to provide an additional level of security and tamper-proof guarantees in the communication between peers.
+
各ピア間の接続は、<code> NaCl </code> authenticated-encryption <code> API <http://nacl.cr.yp.to/box.html&gt; </code> __を使用して暗号化されます。これは、ピア間の通信にセキュリティと改ざん防止の追加レベルを提供するために行われます。
  
Message queues <sub><sub><sub><sub><sub><sub>~</sub></sub></sub></sub></sub></sub>~
+
メッセージキュー<sub> <sub> <sub> <sub> <sub>?</sub> </sub> </sub> </sub> </sub>?
  
On top of basic I/O scheduling, two finite-size typed message queues are used to store incoming (resp. outgoing) messages for each peer. This further restricts the speed at which communication is possible with a peer; when a queue is full, it is not possible to read (resp. write) an additional message. The high-level <code>P2p_socket.connection &lt;../api/odoc/tezos-p2p/Tezos_p2p/P2p_socket/index.html#type-connection&gt;</code>__ type by the P2P layer is basically a UNIX socket upgraded with I/O scheduling, peer metadata, cryptographic keys and two messages queues operated by dedicated workers which operate on those queues.
+
基本I / Oスケジューリングに加えて、2つの有限サイズの型付きメッセージキューを使用して、各ピアの着信(発信)メッセージを格納します。これにより、ピアとの通信が可能になる速度がさらに制限されます。キューがいっぱいになると、追加のメッセージを読み取る(書き込む)ことはできません。 P2Pレイヤーによる高レベルの<code> P2p_socket.connection </..api / odoc / tezos-p2p / Tezos_p2p / P2p_socket / index.html#type-connection&gt; </code> __タイプは、 I / Oスケジューリング、ピアメタデータ、暗号鍵、およびこれらのキューで動作する専用のワーカーによって操作される2つのメッセージキューでアップグレードされます。
  
Pool of connections <sub><sub><sub>~</sub></sub><sub><sub><sub>~</sub></sub></sub>~</sub>
+
接続のプール<sub> <sub>?</sub>?</sub>?</sub>?</sub>
  
All the above modules are used in <code>P2p_pool &lt;../api/odoc/tezos-p2p/Tezos_p2p/P2p_pool/index.html&gt;</code>__, which constitutes the core of the P2P layer, together with the worker processes described below. It comprises various tables of connections as well as methods to query them, also connections are extended with another message queue where lower level messages (like responses to ping) are filtered out and only application-level messages are kept.
+
上記のモジュールはすべて、P2Pレイヤのコアを構成する<code> P2p_pool&lt; .. / api / odoc / tezos-p2p / Tezos_p2p / P2p_pool / index.html&gt; </code> __、以下に説明する作業者プロセス。これは、さまざまな接続テーブルとそれらを照会するメソッドで構成されます。また、接続は、pingへの応答などの低レベルのメッセージがフィルタされ、アプリケーションレベルのメッセージだけが保持される別のメッセージキューで拡張されます。
  
The main entry point of the P2P layer is in module <code>P2p &lt;../api/odoc/tezos-p2p/Tezos_p2p/P2p/index.html&gt;</code>__. See below for a description of workers acting onto the P2P layer.
+
P2Pレイヤのメインエントリポイントは、モジュール<code> P2p </api / odoc / tezos-p2p / Tezos_p2p / P2p / index.html&gt; </code> __にあります。 P2P層に作用する労働者の説明については、以下を参照してください。
  
== Welcome worker ==
+
==ウェルカムワーカー==
  
The welcome worker is responsible for accepting incoming connections and register them into the pool of connections managed by the P2P layer. It basically runs the <code>accept(2)</code> syscall and call <code>P2p_pool.accept &lt;../api/odoc/tezos-p2p/Tezos_p2p/P2p_pool/index.html#val-accept&gt;</code>__ so that it is made aware of an incoming connection. From there, the pool will decide how this new connection must be handled.
+
ウェルカムワーカーは、着信接続を受け入れ、それらをP2Pレイヤーによって管理される接続プールに登録する責任があります。基本的には、<code> accept(2)</code>システムコールを実行し、<code> P2p_pool.accept <../api/ odoc / tezos-p2p / Tezos_p2p / P2p_pool / index.html#val-accept> / code> __を使用して、着信接続を認識させます。そこからプールは、この新しい接続をどのように処理するかを決定します。
  
== Maintenance worker ==
+
==メンテナンスワーカー==
  
The maintenance worker is in charge of establishing an appropriate number of connections with other nodes in order to guarantee a realistic view of the state of the blockchain. It is created with a set of targets to reach regarding the desired amount of peers it needs to keep an active connection to.
+
メンテナンス担当者は、ブロックチェーンの状態を現実的に把握するために、他のノードと適切な数の接続を確立する役割を担っています。それはアクティブな接続を維持するのに必要なピアの望ましい量に関して到達する一連のターゲットで作成されます。
  
At the pool level, the minimum (resp. maximum) acceptable number of connections is defined.
+
プールレベルでは、許容可能な最小数(最大数)が定義されます。
  
At the maintenance worker level, two other sets of thresholds are defined: <code>target</code> (min and max) and <code>threshold</code> (min and max).
+
メンテナンスワーカーレベルでは、<code> target </code>(最小値と最大値)と<code>しきい値</code>(最小値と最大値)の2つの他のしきい値セットが定義されています。
  
Given these bounds, the maintenance worker:
+
これらの境界を考えると、メンテナンス担当者は:
  
* Will be triggered every two minutes, when asked by the shell, or when the minimum or maximum number of acceptable connections is reached, whichever happens first.
+
*シェルが尋ねたとき、または許容可能な接続の最小数または最大数に達したときのどちらか早い方が起きたときに、2分ごとにトリガーされます。
* Will perform the following actions when triggered: if the number of connections is above <code>max_threshold</code>, it will kill connections randomly until it reaches <code>max_target</code> connections. If the number of connections is below <code>min_threshold</code>, it will attempt to connect to peers until it reaches at least <code>min_target</code> connections (and never more than <code>max_target</code> connections).
+
*接続数が<code> max_threshold </code>を超えると、接続が<code> max_target </code>接続に到達するまでランダムに終了します。接続数が<code> min_threshold </code>未満の場合、少なくとも<code> min_target </code>接続に到達するまでピアに接続を試みます(<code> max_target </code>接続)。

2018年5月31日 (木) 00:08時点における最新版

..p2p:

ピアツーピア層[編集]

このドキュメントでは、Tezosシェルのピアツーピア層の内部動作について説明します。この部分は、他のノード(ゴシップ)とのネットワーク接続の確立と維持を担当しています。

P2P層はノードによってインスタンス化される。ネットワークを介して交換されるメッセージのタイプ(異なるP2Pプロトコルのバージョン/拡張を許可するため)、および各ピアに関連付けられたメタデータのタイプによってパラメータ化されます。後者は、私たちが持っている信頼のレベルを反映する各ピアのスコアを計算するのに便利です。異なるスコア値を持つピアと通信するときに、異なるポリシーを使用できます。

P2Pレイヤーは、接続のプール、それらの接続上の一連の操作、およびコードベースで広く使用されるワーカーパターンに従った一連のワーカーで構成されます。

P2Pレイヤーは、パッケージ: tezos-p2p にパッケージ化されています。

一般的な操作[編集]

入出力スケジューリング ? ?

P2P層は、帯域幅の使用を制御するとともに、異なるピア(例えば、読み出し/書き込みクォータ)に異なるポリシーを実装するために、I / Oスケジューリングを使用する。今のところ、各ピアにはグローバルに割り当てられた帯域幅の公平な配分が与えられますが、各ピアへの個々の割り当て帯域幅がピアのスコアの関数になるように計画されています。

暗号化 ?? ~~

各ピア間の接続は、 NaCl authenticated-encryption API <http://nacl.cr.yp.to/box.html> __を使用して暗号化されます。これは、ピア間の通信にセキュリティと改ざん防止の追加レベルを提供するために行われます。

メッセージキュー ? ?

基本I / Oスケジューリングに加えて、2つの有限サイズの型付きメッセージキューを使用して、各ピアの着信(発信)メッセージを格納します。これにより、ピアとの通信が可能になる速度がさらに制限されます。キューがいっぱいになると、追加のメッセージを読み取る(書き込む)ことはできません。 P2Pレイヤーによる高レベルの P2p_socket.connection </..api / odoc / tezos-p2p / Tezos_p2p / P2p_socket / index.html#type-connection&gt; __タイプは、 I / Oスケジューリング、ピアメタデータ、暗号鍵、およびこれらのキューで動作する専用のワーカーによって操作される2つのメッセージキューでアップグレードされます。

接続のプール ???</sub>?</sub>

上記のモジュールはすべて、P2Pレイヤのコアを構成する P2p_pool&lt; .. / api / odoc / tezos-p2p / Tezos_p2p / P2p_pool / index.html&gt; __、以下に説明する作業者プロセス。これは、さまざまな接続テーブルとそれらを照会するメソッドで構成されます。また、接続は、pingへの応答などの低レベルのメッセージがフィルタされ、アプリケーションレベルのメッセージだけが保持される別のメッセージキューで拡張されます。

P2Pレイヤのメインエントリポイントは、モジュール P2p </api / odoc / tezos-p2p / Tezos_p2p / P2p / index.html&gt; __にあります。 P2P層に作用する労働者の説明については、以下を参照してください。

ウェルカムワーカー[編集]

ウェルカムワーカーは、着信接続を受け入れ、それらをP2Pレイヤーによって管理される接続プールに登録する責任があります。基本的には、 accept(2)システムコールを実行し、 P2p_pool.accept <../api/ odoc / tezos-p2p / Tezos_p2p / P2p_pool / index.html#val-accept> / code> __を使用して、着信接続を認識させます。そこからプールは、この新しい接続をどのように処理するかを決定します。

メンテナンスワーカー[編集]

メンテナンス担当者は、ブロックチェーンの状態を現実的に把握するために、他のノードと適切な数の接続を確立する役割を担っています。それはアクティブな接続を維持するのに必要なピアの望ましい量に関して到達する一連のターゲットで作成されます。

プールレベルでは、許容可能な最小数(最大数)が定義されます。

メンテナンスワーカーレベルでは、<code> target (最小値と最大値)としきい値(最小値と最大値)の2つの他のしきい値セットが定義されています。

これらの境界を考えると、メンテナンス担当者は:

  • シェルが尋ねたとき、または許容可能な接続の最小数または最大数に達したときのどちらか早い方が起きたときに、2分ごとにトリガーされます。
  • 接続数が max_threshold を超えると、接続が max_target 接続に到達するまでランダムに終了します。接続数が min_threshold 未満の場合、少なくとも min_target 接続に到達するまでピアに接続を試みます( max_target 接続)。