Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Total: 36h
- 1. implement or find simple thread-safe buffered queue as replacement for go channels: 8h
- channels are required not only in SyncManager, other components need them as well
- 2. SyncManager : 24h
- assumes using multiple worker threads dealing with same queues,
- state machine: need to formally implement methods where state is mentioned
- so I suppose boost::asio to be preferred
- most methods make locks, it makes sense in multithreaded environment. Consider using atomics or mutexes
- consider to refactor other code and determine if it requires locks
- takes external doSync() functional object, need to keep it in mind
- syncWorkerCount in lotus is a global const, need to decide whether to take it as create() param or make staic const
- methods names will be reworked, since lotus naming has poor quality
- methods parameters and results are not strict and are written in simplified pseudocode
- depends:
- boost::asio
- libp2p::peerId
- methods:
- create()
- start()
- stop()
- setPeerHead() // state aware
- Tipset selectSyncTarget()
- void syncScheduler()
- void scheduleIncoming() // state aware
- void scheduleProcessResult(SyncResult) // state aware
- void scheduleWorkSent()
- void syncWorker(int id)
- int syncedPeerCount()
- BootStrapState getBootstrapState()
- void setBootstrapState(BootStrapState)
- bool isBootstrapped()
- tests:
- create success
- start/stop success
- set peer head success / acceptance test
- select sync target acceptance test
- syncScheduler acceptance test
- syncWorker acceptance test
- set bootstrapstate/check bootstrapstate success
- is bootstrapped check success
- 3. SyncTargetBucket : 3h
- type syncTargetBucket struct {
- tips []*types.TipSet
- count int
- }
- depends:
- Tipset
- methods:
- bool sameChainAs(Tipset[])
- void add()
- Tipset getHeaviestTipset()
- tests:
- create success
- add & contain success
- get heaviest tipset success
- 4. SyncBucketSet
- depends:
- SyncTargetBucket
- methods:
- create(Tipset[])
- bool isRelatedToAny(Tipset)
- void insert(Tipset)
- SyncTargetBucket popBucket()
- void removeBucket(SyncTargetBucket)
- SyncTargetBucket PopRelated(Tipset)
- Tipset getHeaviest()
- bool isEmpty()
- 5. SyncerState: 1h
- depends:
- enum SyncStageState:
- Tipset // implemented
- chrono
- methods:
- stage2string()
- setStage()
- init()
- setError() (error)
- takeSnapshot()
- tests:
- set stage success
- init success
- set error success
- take snapshot success
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement