mod.rs 4.3 KB

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