public final class SnowflakeKeyGenerateAlgorithm extends Object implements KeyGenerateAlgorithm, org.apache.shardingsphere.infra.instance.InstanceContextAware
Length of key is 64 bit.
1 bit sign bit.
41 bits timestamp offset from 2016.11.01(ShardingSphere distributed primary key published data) to now.
10 bits worker process id.
12 bits auto increment offset in one mills
| 限定符和类型 | 字段和说明 |
|---|---|
static long |
EPOCH |
| 构造器和说明 |
|---|
SnowflakeKeyGenerateAlgorithm() |
| 限定符和类型 | 方法和说明 |
|---|---|
Long |
generateKey() |
String |
getType() |
void |
init(Properties props) |
boolean |
isDefault() |
void |
setInstanceContext(org.apache.shardingsphere.infra.instance.InstanceContext instanceContext) |
public void init(Properties props)
init 在接口中 org.apache.shardingsphere.infra.util.spi.lifecycle.SPIPostProcessorpublic void setInstanceContext(org.apache.shardingsphere.infra.instance.InstanceContext instanceContext)
setInstanceContext 在接口中 org.apache.shardingsphere.infra.instance.InstanceContextAwarepublic Long generateKey()
generateKey 在接口中 KeyGenerateAlgorithmpublic String getType()
getType 在接口中 org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIpublic boolean isDefault()
isDefault 在接口中 org.apache.shardingsphere.infra.util.spi.type.required.RequiredSPICopyright © 2022 The Apache Software Foundation. All rights reserved.