8 releases (breaking)

0.15.0 Sep 23, 2022
0.14.0 May 31, 2022
0.13.0 May 19, 2022
0.12.0 Feb 8, 2022
0.1.0 Oct 4, 2021

#71 in #near

Download history 60/week @ 2024-03-11 18/week @ 2024-03-18 9/week @ 2024-03-25 87/week @ 2024-04-01 12/week @ 2024-04-08 20/week @ 2024-04-15 36/week @ 2024-04-22 17/week @ 2024-04-29 13/week @ 2024-05-06 20/week @ 2024-05-13 49/week @ 2024-05-20 21/week @ 2024-05-27 35/week @ 2024-06-03 15/week @ 2024-06-10 43/week @ 2024-06-17 20/week @ 2024-06-24

117 downloads per month
Used in 7 crates (via near-network)

MIT/Apache

790KB
17K SLoC

Overview

TODO - already in another PR

Project structure

  • network_protocol.rs - contains types, which are part of network protocol, they should be changed with care. All of them derive BorshSerialize / BorshDeserialize
  • types.rs - TODO
  • config.rs - TODO
  • actix.rs - TODO

near-network-primitives

near-network-primitives is a package that contains network types that are meant to be shared between multiple crates, without having to import near-network. Note that, the current split doesn't follow that logic.

We have a few use cases:

  • Messages used by ClientActor, ViewClientActor, near-network.
  • external packages, which want to analyze traffic, they don't need to import near-network, importing just network types should be enough for them

Dependencies:

  • deepsize - optional - provides api for counting sizes of structs
  • actix - required - provides implementation actix Message - we could make it optional
  • borsh - required - serialization / deserialization of network messages - could be made optional

Current state of the package

near-network

near-network exports the following to the outside:

  • PeerManagerActor
  • PeerManagerActor related Actix messages
  • Part of borsh serialized network messages exchanged between nodes.

Actors below, their related messages, are considered private:

  • PeerActor
  • RoutingTableActor
  • EdgeValidatorActor

near-network-primitives

near-network-primitives provides

  • ClientActor related Actix messages
  • ViewClientActor related Actix messages
  • Part of borsh serialized network messages exchanged between nodes.
  • NetworkConfig - its logic is split between utils.rs and types.rs.

Dependencies

~17–28MB
~365K SLoC