idmng

package
v0.0.0-...-8d187f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIDs

func GetIDs(orgID int, resourceType string, count int) (ids []int, err error)

func GetMasterGRPCConn

func GetMasterGRPCConn() (*grpc.ClientConn, error)

func NewDescIDAllocator

func NewDescIDAllocator(org *common.ORG, resourceType string, min, max int) descIDAllocator

func ReleaseIDs

func ReleaseIDs(orgID int, resourceType string, ids []int) (err error)

Types

type AscIDAllocator

type AscIDAllocator struct {
	// contains filtered or unexported fields
}

func NewAscIDAllocator

func NewAscIDAllocator(org *common.ORG, resourceType string, min, max int) AscIDAllocator

func (*AscIDAllocator) Allocate

func (a *AscIDAllocator) Allocate(count int) ([]int, error)

func (*AscIDAllocator) Recycle

func (a *AscIDAllocator) Recycle(ids []int)

func (*AscIDAllocator) Refresh

func (a *AscIDAllocator) Refresh() error

func (*AscIDAllocator) SetAllocationCountStrict

func (a *AscIDAllocator) SetAllocationCountStrict(allocationCountStrict bool)

func (*AscIDAllocator) SetInUseIDsProvider

func (a *AscIDAllocator) SetInUseIDsProvider(provider inUseIDsProvider)

func (*AscIDAllocator) SetSorter

func (a *AscIDAllocator) SetSorter(sorter sorter)

func (*AscIDAllocator) SetUnusedIDFirst

func (a *AscIDAllocator) SetUnusedIDFirst(unusedIDFirst bool)

type IDManager

type IDManager struct {
	// contains filtered or unexported fields
}

func GetIDManager

func GetIDManager(orgID int) (*IDManager, error)

func (*IDManager) AllocateIDs

func (m *IDManager) AllocateIDs(resourceType string, count int) []int

func (*IDManager) RecycleIDs

func (m *IDManager) RecycleIDs(resourceType string, ids []int)

func (*IDManager) Refresh

func (m *IDManager) Refresh() error

type IDManagers

type IDManagers struct {
	// contains filtered or unexported fields
}

func GetIDManagers

func GetIDManagers() *IDManagers

func (*IDManagers) Init

func (m *IDManagers) Init(ctx context.Context, cfg config.RecorderConfig)

func (*IDManagers) NewIDManagerAndInitIfNotExists

func (m *IDManagers) NewIDManagerAndInitIfNotExists(orgID int) (*IDManager, error)

func (*IDManagers) Start

func (m *IDManagers) Start(ctx context.Context) error

func (*IDManagers) Stop

func (m *IDManagers) Stop()

type IDPool

type IDPool[MT MySQLModel] struct {
	AscIDAllocator
	// contains filtered or unexported fields
}

缓存资源可用于分配的ID,提供ID的刷新、分配、回收接口

func (*IDPool) Allocate

func (a *IDPool) Allocate(count int) ([]int, error)

func (*IDPool) Recycle

func (a *IDPool) Recycle(ids []int)

func (*IDPool) Refresh

func (a *IDPool) Refresh() error

func (*IDPool) SetAllocationCountStrict

func (a *IDPool) SetAllocationCountStrict(allocationCountStrict bool)

func (*IDPool) SetInUseIDsProvider

func (a *IDPool) SetInUseIDsProvider(provider inUseIDsProvider)

func (*IDPool) SetSorter

func (a *IDPool) SetSorter(sorter sorter)

func (*IDPool) SetUnusedIDFirst

func (a *IDPool) SetUnusedIDFirst(unusedIDFirst bool)

type IDPoolUpdater

type IDPoolUpdater interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL