Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. Total: 36h
  2.  
  3. 1. implement or find simple thread-safe buffered queue as replacement for go channels: 8h
  4. channels are required not only in SyncManager, other components need them as well
  5.  
  6. 2. SyncManager : 24h
  7. assumes using multiple worker threads dealing with same queues,
  8. state machine: need to formally implement methods where state is mentioned
  9. so I suppose boost::asio to be preferred
  10. most methods make locks, it makes sense in multithreaded environment. Consider using atomics or mutexes
  11. consider to refactor other code and determine if it requires locks
  12. takes external doSync() functional object, need to keep it in mind
  13. syncWorkerCount in lotus is a global const, need to decide whether to take it as create() param or make staic const
  14. methods names will be reworked, since lotus naming has poor quality
  15. methods parameters and results are not strict and are written in simplified pseudocode
  16.  
  17. depends:
  18. boost::asio
  19. libp2p::peerId
  20.  
  21. methods:
  22. create()
  23. start()
  24. stop()
  25. setPeerHead() // state aware
  26. Tipset selectSyncTarget()
  27. void syncScheduler()
  28. void scheduleIncoming() // state aware
  29. void scheduleProcessResult(SyncResult) // state aware
  30. void scheduleWorkSent()
  31. void syncWorker(int id)
  32. int syncedPeerCount()
  33. BootStrapState getBootstrapState()
  34. void setBootstrapState(BootStrapState)
  35. bool isBootstrapped()
  36.  
  37. tests:
  38. create success
  39. start/stop success
  40. set peer head success / acceptance test
  41. select sync target acceptance test
  42. syncScheduler acceptance test
  43. syncWorker acceptance test
  44.  
  45.  
  46. set bootstrapstate/check bootstrapstate success
  47. is bootstrapped check success
  48.  
  49.  
  50. 3. SyncTargetBucket : 3h
  51. type syncTargetBucket struct {
  52. tips []*types.TipSet
  53. count int
  54. }
  55.  
  56. depends:
  57. Tipset
  58.  
  59. methods:
  60. bool sameChainAs(Tipset[])
  61. void add()
  62. Tipset getHeaviestTipset()
  63. tests:
  64. create success
  65. add & contain success
  66. get heaviest tipset success
  67.  
  68.  
  69. 4. SyncBucketSet
  70. depends:
  71. SyncTargetBucket
  72.  
  73. methods:
  74. create(Tipset[])
  75. bool isRelatedToAny(Tipset)
  76. void insert(Tipset)
  77. SyncTargetBucket popBucket()
  78. void removeBucket(SyncTargetBucket)
  79. SyncTargetBucket PopRelated(Tipset)
  80. Tipset getHeaviest()
  81. bool isEmpty()
  82.  
  83.  
  84. 5. SyncerState: 1h
  85. depends:
  86. enum SyncStageState:
  87. Tipset // implemented
  88. chrono
  89.  
  90. methods:
  91. stage2string()
  92. setStage()
  93. init()
  94. setError() (error)
  95. takeSnapshot()
  96. tests:
  97. set stage success
  98. init success
  99. set error success
  100. take snapshot success
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement