Skip to content
  • Philippe B.'s avatar
    P2p: centralize config datatypes in one module · eb1d90ae
    Philippe B. authored and Romain's avatar Romain committed
    The p2p layer is parametrized by several "generic" datatypes.
    
    These datatypes appear as polymorphic parameters in P2p functions.
    They aren't simply placeholders in the sense that the p2p layer
    can "operate" on them using functions passed as records in `P2p.create`.
    
    For instance,
    
    ```
    type 'peer_meta peer_meta_config = {
      peer_meta_encoding : 'peer_meta Data_encoding.t;
      peer_meta_initial : unit -> 'peer_meta;
      score : 'peer_meta -> float;
    }
    ```
    
    defines a `'peer_meta` ADT. The P2p operate on it using the function
    provided in a record `peer_meta_config`, passed by the upper layer.
    
    Before this commit, these types where duplicated in several places.
    They were initially defined in the module that primarly use them, and
    then re-exported in `P2p`.
    
    This commit centralizes their definition and documentation in a
    "leaf module" `P2p_params`, reducing redundancy.
    eb1d90ae