mod.rs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /// Acceptor class handles the acceptance of inbound socket connections. It's
  2. /// used to start listening on a local socket address, to accept incoming
  3. /// connections and to handle network errors.
  4. pub mod acceptor;
  5. /// Async channel that handles the sending of messages across the network.
  6. /// Public interface is used to create new channels, to stop and start
  7. /// a channel, and to send messages.
  8. ///
  9. /// Implements message functionality and the message subscriber subsystem.
  10. pub mod channel;
  11. /// Handles the creation of outbound connections. Used to establish an outbound
  12. /// connection.
  13. pub mod connector;
  14. /// Hosts are a list of network addresses used when establishing an outbound
  15. /// connection. Hosts are shared across the network through the address
  16. /// protocol. When attempting to connect, a node will loop through addresses in
  17. /// the host store until it finds ones to connect to.
  18. pub mod hosts;
  19. /// Generic publish/subscribe class that can dispatch any kind of message to a
  20. /// subscribed list of dispatchers. Dispatchers subscribe to a single
  21. /// message format of any type. This is a generalized version of the simple
  22. /// publish-subscribe class in system::Subscriber.
  23. ///
  24. /// Message Subsystem also enables the creation of new message subsystems,
  25. /// adding new dispatchers and clearing inactive channels.
  26. ///
  27. /// Message Subsystem maintains a list of dispatchers, which is a generalized
  28. /// version of a subscriber. Pub-sub is called on dispatchers through the
  29. /// functions 'subscribe' and 'notify'. Whereas system::Subscriber only allows
  30. /// messages of a single type, dispatchers can handle any kind of message. This
  31. /// generic message is called a payload and is processed and decoded by the
  32. /// Message Dispatcher.
  33. ///
  34. /// The Message Dispatcher is a class of subscribers that implements a
  35. /// generic trait called Message Dispatcher Interface, which allows us to
  36. /// process any kind of payload as a message.
  37. pub mod message_subscriber;
  38. /// Defines how to decode generic messages as well as implementing the common
  39. /// network messages that are sent between nodes as described by the Protocol
  40. /// submodule.
  41. ///
  42. /// Implements a type called Packet which is the base message type. Packets are
  43. /// converted into messages and passed to an event loop.
  44. pub mod message;
  45. /// P2P provides all core functionality to interact with the peer-to-peer
  46. /// network.
  47. ///
  48. /// Used to create a network, to start and run it, to broadcast messages across
  49. /// all channels, and to manage the channel store.
  50. ///
  51. /// The channel store is a hashmap of channel address that we can use to add and
  52. /// remove channels or check whether a channel is already is in the store.
  53. pub mod p2p;
  54. /// Defines the networking protocol used at each stage in a connection. Consists
  55. /// of a series of messages that are sent across the network at the different
  56. /// connection stages.
  57. ///
  58. /// When a node connects to a network for the first time, it must follow a seed
  59. /// protocol, which provides it with a list of network hosts to connect to. To
  60. /// establish a connection to another node, nodes must send version and version
  61. /// acknowledgement messages. During a connection, nodes continually get address
  62. /// and get-address messages to inform eachother about what nodes are on the
  63. /// network. Nodes also send out a ping and pong message which keeps the network
  64. /// from shutting down.
  65. ///
  66. /// Protocol submodule also implements a jobs manager than handles the
  67. /// asynchronous execution of the protocols.
  68. pub mod protocol;
  69. /// Defines the interaction between nodes during a connection. Consists of an
  70. /// inbound session, which describes how to set up an incoming connection, and
  71. /// an outbound session, which describes setting up an outbound connection. Also
  72. /// describes the seed session, which is the type of connection used when a node
  73. /// connects to the network for the first time. Implements the session trait
  74. /// which describes the common functions across all sessions.
  75. pub mod session;
  76. /// Network configuration settings.
  77. pub mod settings;
  78. /// Network transport implementations.
  79. pub mod transport;
  80. pub use acceptor::{Acceptor, AcceptorPtr};
  81. pub use channel::{Channel, ChannelPtr, Stream};
  82. pub use connector::Connector;
  83. pub use hosts::{Hosts, HostsPtr};
  84. pub use message::Message;
  85. pub use message_subscriber::MessageSubscription;
  86. pub use p2p::{P2p, P2pPtr};
  87. pub use protocol::{ProtocolBase, ProtocolBasePtr, ProtocolJobsManager, ProtocolJobsManagerPtr};
  88. pub use session::{SESSION_ALL, SESSION_INBOUND, SESSION_MANUAL, SESSION_OUTBOUND, SESSION_SEED};
  89. pub use settings::{Settings, SettingsPtr};
  90. pub use transport::{TcpTransport, TlsTransport, TorTransport, Transport};