Libp2p.Pubsub.RPCPB (libp2p_elixir v0.9.0)
Protobuf encoding/decoding for pubsub RPC messages.
Schema (from third_party/libp2p_specs/pubsub/README.md):
syntax = "proto2";
message RPC {
repeated SubOpts subscriptions = 1;
repeated Message publish = 2;
optional ControlMessage control = 3; // gossipsub
message SubOpts {
optional bool subscribe = 1;
optional string topicid = 2;
}
}Gossipsub extends the base RPC with an optional control field; see
third_party/libp2p_specs/pubsub/gossipsub/gossipsub-v1.0.md and
gossipsub-v1.1.md for the full Control message details.
Summary
Types
@type control_graft() :: %{topicID: binary()}
@type control_iwant() :: %{messageIDs: [binary()]}
@type control_message() :: %{ ihave: [control_ihave()], iwant: [control_iwant()], graft: [control_graft()], prune: [control_prune()] }
@type control_prune() :: %{ topicID: binary(), peers: [peer_info()], backoff: non_neg_integer() | nil }
@type t() :: %{ subscriptions: [subopts()], publish: [map()], control: control_message() | nil }
Functions
@spec decode_control(binary()) :: control_message()
@spec encode_control(control_message()) :: binary()