Backend

Landscape

backend-landscape.svg

BoltDB Backend

Landscape

bolt-backend.svg

run

启动 Timer,定时提交;或者在收到停止信号时,提交并退出。代码很简单,如下所示

  1. func (b *backend) run() {
  2. defer close(b.donec)
  3. t := time.NewTimer(b.batchInterval)
  4. defer t.Stop()
  5. for {
  6. select {
  7. case <-t.C:
  8. case <-b.stopc:
  9. b.batchTx.CommitAndStop()
  10. return
  11. }
  12. b.batchTx.Commit()
  13. t.Reset(b.batchInterval)
  14. }
  15. }

Transaction Relationship

tx-relation.svg

Buffer

tx-buffer.svg

MVCC

Store

store.svg

References

Watchable

Landscape

watchable.svg

Watcher Creation

watcher-creation.svg

通过 watchStream 创建的全部 watcher 的 ch 全部指向了 watchStream.ch。事件走向为 watcher -> watchStream。watcher 管理由 watcherGroup 负责
watcher-group.svg

Nofity Waiter

notify-waiter.svg