Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Segment ¶
type Segment struct {
Start int64 // Inclusive start ID
End int64 // Inclusive end ID (max_id)
Current int64 // Current ID being distributed
}
Segment represents a range of IDs
type SegmentBuffer ¶
type SegmentBuffer struct {
BizTag int32
Step int32
Current *Segment
Next *Segment
*SegmentIDGen
// contains filtered or unexported fields
}
SegmentBuffer manages double buffering of segments
type SegmentIDGen ¶
type SegmentIDGen struct {
// contains filtered or unexported fields
}
SegmentIDGen is the main struct for distributed ID generation
func NewSegmentIDGen ¶
func NewSegmentIDGen(ctx context.Context, config Config) (*SegmentIDGen, error)
NewSegmentIDGen creates a new ID generator instance dsn: Postgres connection string
func (*SegmentIDGen) Close ¶
func (g *SegmentIDGen) Close()
Close is a no-op as connection is managed globally
Click to show internal directories.
Click to hide internal directories.