Documentation ¶
Index ¶
- Variables
- func GetIDGeneratorFromIPV4(opts ...Option) (idpkg.Snowflake, func(), error)
- func GetSingletonIDGeneratorByGRPCAPI(serviceAPIManager clientutil.ServiceAPIManager, ...) (idpkg.Snowflake, func(), error)
- func GetSingletonIDGeneratorByHTTPAPI(serviceAPIManager clientutil.ServiceAPIManager, ...) (idpkg.Snowflake, func(), error)
- func GetSingletonSnowflakeNode(idManager IDManager, req *nodeidresourcev1.GetNodeIdReq) (idpkg.Snowflake, func(), error)
- func SetSnowflake(node idpkg.Snowflake) error
- type IDManager
- type Option
- func DefaultOptions(logger log.Logger) []Option
- func WithGetNodeIdFromIPV4(isGetNodeIDFromIPV4 bool) Option
- func WithLogger(logger log.Logger) Option
- func WithMustGetNodeIdFromAPI(mustGetNodeIdForAPI bool) Option
- func WithNodeEpoch(nodeEpoch time.Time) Option
- func WithServerName(serverName clientutil.ServiceName) Option
- type SnowflakeNodeInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultTries = 3
)
View Source
var ( // NewSnowflakeNode func(int64) (idpkg.Snowflake, error) // idpkg.NewSonySonyflake // idpkg.NewBwmarrinSnowflake NewSnowflakeNode = idpkg.NewSonySonyflake )
Functions ¶
func GetIDGeneratorFromIPV4 ¶ added in v0.0.16
func GetSingletonIDGeneratorByGRPCAPI ¶ added in v0.0.16
func GetSingletonIDGeneratorByGRPCAPI(serviceAPIManager clientutil.ServiceAPIManager, req *nodeidresourcev1.GetNodeIdReq, opts ...Option) (idpkg.Snowflake, func(), error)
func GetSingletonIDGeneratorByHTTPAPI ¶ added in v0.0.16
func GetSingletonIDGeneratorByHTTPAPI(serviceAPIManager clientutil.ServiceAPIManager, req *nodeidresourcev1.GetNodeIdReq, opts ...Option) (idpkg.Snowflake, func(), error)
func GetSingletonSnowflakeNode ¶ added in v0.0.9
func GetSingletonSnowflakeNode(idManager IDManager, req *nodeidresourcev1.GetNodeIdReq) (idpkg.Snowflake, func(), error)
GetSingletonSnowflakeNode 获取节点 http GetSingletonIDGeneratorByHTTPAPI grpc GetSingletonIDGeneratorByGRPCAPI
func SetSnowflake ¶ added in v0.0.9
Types ¶
type IDManager ¶ added in v0.0.9
type IDManager interface { GetSingletonSnowflakeNode(ctx context.Context, req *nodeidresourcev1.GetNodeIdReq) (idpkg.Snowflake, func(), error) GetSnowflakeNode(ctx context.Context, req *nodeidresourcev1.GetNodeIdReq) (idpkg.Snowflake, func(), error) SetSnowflakeNode(ctx context.Context, req *nodeidresourcev1.GetNodeIdReq) (idpkg.Snowflake, func(), error) }
func NewIDManager ¶ added in v0.0.9
func NewIDManager(logger log.Logger, helper nodeidapi.NodeIDHelper) IDManager
type Option ¶
type Option func(*options)
func DefaultOptions ¶ added in v0.0.12
func WithGetNodeIdFromIPV4 ¶ added in v0.0.9
func WithLogger ¶
func WithMustGetNodeIdFromAPI ¶ added in v0.0.9
func WithNodeEpoch ¶ added in v0.0.10
func WithServerName ¶
func WithServerName(serverName clientutil.ServiceName) Option
type SnowflakeNodeInfo ¶ added in v0.0.9
Click to show internal directories.
Click to hide internal directories.