network-size-estimation.tm 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <TeXmacs|2.1>
  2. <project|scheme-gnunet.tm>
  3. <style|tmmanual>
  4. <\body>
  5. <index|network size estimation><index|NSE>GNUnet has a service that roughly
  6. estimates the size of the network \U i.e., the number of
  7. peers.<space|1em>The module <scm|(gnu gnunet nse client)><index|(gnu gnunet
  8. nse client)> can be used to interact with this service.<space|1em>The
  9. connection is made with the procedure <scm|connect><subindex|connect|NSE>,
  10. which is accepts a <with|font-shape|italic|configuration> (see
  11. <todo|reference>) and some optional keyword arguments.<space|1em>This
  12. procedure can be called as <scm|(connect config #:updated updated
  13. #:connected connected #:disconnected disconnected)>.<space|1em>It returns a
  14. <with|font-shape|italic|NSE server object><index|NSE server
  15. object><subindex|server object|NSE>.
  16. The connection is made asynchronuously; the thunk <var|connected> will be
  17. called when the connection has actually been made.<space|1em>Whenever a new
  18. estimate becomes available, the (optional) procedure
  19. <var|updated><index|update procedure> is called with the new
  20. <with|font-shape|italic|estimate><index|estimate
  21. object>.<space|1em>Alternatively, the procedure
  22. <scm|estimate><index|estimate> can be called on the server object to return
  23. the latest available estimate.<space|1em>If the
  24. <with|font-shape|italic|server object> doesn't have an estimate yet, that
  25. procedure will return <scm|#false> instead of an estimate.
  26. When the connection is lost, the (optional) thunk <var|disconnected> is
  27. called and <scm|(gnu gnunet nse client)> will retry
  28. connecting.<space|1em>To close the current connection, if any, and stop
  29. reconnecting, the idempotent procedure <scm|disconnect!><subindex|disconnect!|NSE>
  30. can be called on the server object.
  31. <todo|input, validation, I/O errors?>
  32. The estimate object has a number of accessors:
  33. <\explain>
  34. <scm|(estimate:logarithmic-number-peers
  35. <var|estimate>)><index|estimate:logarithmic-number-peers>
  36. </explain|The base-2 logarithm of the number of peers (estimated), as a
  37. positive flonum, possibly zero or infinite>
  38. <\explain>
  39. <scm|(estimate:number-peers <var|estimate>)><index|estimate:number-peeers>
  40. </explain|The number of peers (estimated), as a flonum, at least <scm|1.0>
  41. and possibly infinite.<space|1em>This is not necessarily an (inexact)
  42. <scm|integer?>, as it is only an estimate.>
  43. <\explain>
  44. <scm|(estimate:timestamp estimate)><index|estimate:timestamp>
  45. </explain|A timestamp when the estimate was made <todo|something about
  46. epoch?>>
  47. <\explain>
  48. <scm|(estimate:standard-deviation <var|estimate>)><index|estimate:standard-deviation>
  49. <|explain>
  50. The estimated standard deviation on the base-2 logarithm of peers,
  51. calculated over the last 64 rounds, with the <math|<frac|N|N-1>>
  52. correction.<space|1em>This is a positive flonum, possibly zero or
  53. infinite, or not-a-number (indicating division of zero by zero).
  54. If the peer has been connected to the network for a while, the number is
  55. expected to be finite and strictly positive.
  56. </explain>
  57. Assuming the network size is stable and the errors on the logarithmic
  58. estimate are normally distributed, the procedure
  59. <scm|estimate:standard-deviation> can be used to put probablistic error
  60. bounds on the number of peers on the network. <todo|example>
  61. </body>
  62. <\initial>
  63. <\collection>
  64. <associate|page-medium|paper>
  65. <associate|save-aux|false>
  66. </collection>
  67. </initial>