From ee85198e7fdaf1e7de29e37669650f3ce8b0b00e Mon Sep 17 00:00:00 2001 From: Xargin Date: Sun, 8 Jul 2018 23:00:30 +0800 Subject: [PATCH] add diagram for dist id --- ch6-cloud/ch6-07-dist-id.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ch6-cloud/ch6-07-dist-id.md b/ch6-cloud/ch6-07-dist-id.md index e69de29..ae704c8 100644 --- a/ch6-cloud/ch6-07-dist-id.md +++ b/ch6-cloud/ch6-07-dist-id.md @@ -0,0 +1,26 @@ +# 6.7. 分布式 id 生成器 + +``` + + datacenter_id sequence_id + unused + │ │ + │ │ │ + │ │ │ + │ │ │ │ │ + │ │ │ │ │ + ▼ │◀────────────────── 41 bits ────────────────────▶│ ▼ ▼ + ┌─────┼──────────────────────────────────────────────────────┼────────┬────────┬────────────────┐ + │ 0 │ 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 │ 00000 │ 00000 │ 0000 0000 0000 │ + └─────┴──────────────────────────────────────────────────────┴────────┴────────┴────────────────┘ + ▲ ▲ + │ │ + │ │ + │ │ + │ │ + │ │ + │ │ + + time in milliseconds worker_id + +```