Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(doc): Update specific-id.md #565

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions documentation/docs/guide/specific-id.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ cosid:
group_year_biz:
group:
by: year
pattern: yyyy
converter:
type: to_string
to-string:
Expand Down Expand Up @@ -511,6 +512,146 @@ cosid:
```
:::

## group_year_month_biz

使用 _SegmentId_ 算法,要求输出的ID字符串:
- 起始序号:`0`
- 格式:`<prefix><year_month><sequence>`
- 分组:按年月分组,序号从0开始。即跨月序号需要重置为0.
- 序号位:8位数值,不足8位前补0
- 例如:`BIZ-240516-00000061`

::: code-group
```yaml {7-17} [配置]
cosid:
segment:
enabled: true
distributor:
type: redis
provider:
group_year_month_biz:
group:
by: year_month
pattern: yyyyMM
converter:
type: to_string
to-string:
pad-start: true
char-size: 8
prefix: BIZ-
group-prefix:
enabled: true
```
```json [配置信息]
{
"group_year_month_biz": {
"kind": "StringSegmentId",
"actual": {
"kind": "SegmentChainId",
"fetchTime": 1715851229,
"maxId": 110,
"offset": 90,
"sequence": 91,
"step": 20,
"isExpired": false,
"isOverflow": false,
"isAvailable": true,
"converter": {
"kind": "Radix62IdConverter",
"radix": 62,
"charSize": 11,
"padStart": true,
"maxId": 9223372036854776000
}
},
"converter": {
"kind": "PrefixIdConverter",
"prefix": "BIZ-",
"actual": {
"kind": "GroupedPrefixIdConverter",
"delimiter": "-",
"actual": {
"kind": "ToStringIdConverter",
"padStart": true,
"charSize": 8
}
}
}
}
}
```
:::

## group_year_month_day_biz

使用 _SegmentId_ 算法,要求输出的ID字符串:
- 起始序号:`0`
- 格式:`<prefix><year_month_day><sequence>`
- 分组:按日期分组,序号从0开始。即明天序号需要重置为0.
- 序号位:8位数值,不足8位前补0
- 例如:`BIZ-240516-00000001`

::: code-group
```yaml {7-17} [配置]
cosid:
segment:
enabled: true
distributor:
type: redis
provider:
group_year_month_day_biz:
group:
by: year_month_day
pattern: yyMMdd
converter:
type: to_string
to-string:
pad-start: true
char-size: 8
prefix: BIZ-
group-prefix:
enabled: true
```
```json [配置信息]
{
"group_year_month_day_biz": {
"kind": "StringSegmentId",
"actual": {
"kind": "SegmentChainId",
"fetchTime": 1715851229,
"maxId": 80,
"offset": 60,
"sequence": 60,
"step": 20,
"isExpired": false,
"isOverflow": false,
"isAvailable": true,
"converter": {
"kind": "Radix62IdConverter",
"radix": 62,
"charSize": 11,
"padStart": true,
"maxId": 9223372036854776000
}
},
"converter": {
"kind": "PrefixIdConverter",
"prefix": "BIZ-",
"actual": {
"kind": "GroupedPrefixIdConverter",
"delimiter": "-",
"actual": {
"kind": "ToStringIdConverter",
"padStart": true,
"charSize": 8
}
}
}
}
}
```
:::

## 百万级规模集群实例的全局ID

使用 _CosIdGenerator_ 算法,要求支持百万级规模集群实例的全局ID生成器。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ cosid:
group_year_month_day_biz:
group:
by: year_month_day
pattern: yyyyMMdd
pattern: yyMMdd
converter:
type: to_string
to-string:
Expand Down