Versions in this module Expand all Collapse all v0 v0.1.0 Jun 15, 2023 Changes in this version + const GlobalDCLocation + const MaxSuffixBits + const UpdateTimestampGuard + var PriorityCheck = time.Minute + func CalSuffixBits(maxSuffix int32) int + func FilterAvailableLeadership() func(ag *allocatorGroup) bool + func FilterDCLocation(dcLocation string) func(ag *allocatorGroup) bool + func FilterUnavailableLeadership() func(ag *allocatorGroup) bool + func FilterUninitialized() func(ag *allocatorGroup) bool + type AdminHandler struct + func NewAdminHandler(handler Handler, rd *render.Render) *AdminHandler + func (h *AdminHandler) ResetTS(w http.ResponseWriter, r *http.Request) + type Allocator interface + GenerateTSO func(count uint32) (pdpb.Timestamp, error) + Initialize func(suffix int) error + IsInitialize func() bool + Reset func() + SetTSO func(tso uint64, ignoreSmaller, skipUpperBoundCheck bool) error + UpdateTSO func() error + func NewGlobalTSOAllocator(ctx context.Context, am *AllocatorManager, startGlobalLeaderLoop bool) Allocator + func NewLocalTSOAllocator(am *AllocatorManager, leadership *election.Leadership, dcLocation string) Allocator + type AllocatorGroupFilter func(ag *allocatorGroup) bool + type AllocatorManager struct + func NewAllocatorManager(ctx context.Context, keyspaceGroupID uint32, member ElectionMember, ...) *AllocatorManager + func (am *AllocatorManager) AllocatorDaemon(ctx context.Context) + func (am *AllocatorManager) CleanUpDCLocation() error + func (am *AllocatorManager) ClusterDCLocationChecker() + func (am *AllocatorManager) EnableLocalTSO() bool + func (am *AllocatorManager) GetAllocator(dcLocation string) (Allocator, error) + func (am *AllocatorManager) GetAllocators(filters ...AllocatorGroupFilter) []Allocator + func (am *AllocatorManager) GetClusterDCLocations() map[string]DCLocationInfo + func (am *AllocatorManager) GetClusterDCLocationsFromEtcd() (clusterDCLocations map[string][]uint64, err error) + func (am *AllocatorManager) GetClusterDCLocationsNumber() int + func (am *AllocatorManager) GetDCLocationInfo(dcLocation string) (DCLocationInfo, bool) + func (am *AllocatorManager) GetHoldingLocalAllocatorLeaders() ([]*LocalTSOAllocator, error) + func (am *AllocatorManager) GetLocalAllocatorLeaders() (map[string]*pdpb.Member, error) + func (am *AllocatorManager) GetLocalTSOSuffixPath(dcLocation string) string + func (am *AllocatorManager) GetLocalTSOSuffixPathPrefix() string + func (am *AllocatorManager) GetMaxLocalTSO(ctx context.Context) (*pdpb.Timestamp, error) + func (am *AllocatorManager) GetSuffixBits() int + func (am *AllocatorManager) HandleRequest(dcLocation string, count uint32) (pdpb.Timestamp, error) + func (am *AllocatorManager) PriorityChecker() + func (am *AllocatorManager) ResetAllocatorGroup(dcLocation string) + func (am *AllocatorManager) SetLocalTSOConfig(dcLocation string) error + func (am *AllocatorManager) SetUpGlobalAllocator(ctx context.Context, leadership *election.Leadership, ...) + func (am *AllocatorManager) TransferAllocatorForDCLocation(dcLocation string, memberID uint64) error + type Config interface + GetLeaderLease func() int64 + GetMaxResetTSGap func() time.Duration + GetTLSConfig func() *grpcutil.TLSConfig + GetTSOSaveInterval func() time.Duration + GetTSOUpdatePhysicalInterval func() time.Duration + IsLocalTSOEnabled func() bool + type DCLocationInfo struct + ServerIDs []uint64 + Suffix int32 + type ElectionMember interface + CampaignLeader func(leaseTimeout int64) error + CheckLeader func() (leader member.ElectionLeader, checkAgain bool) + Client func() *clientv3.Client + EnableLeader func() + GetDCLocationPath func(id uint64) string + GetDCLocationPathPrefix func() string + GetLastLeaderUpdatedTime func() time.Time + GetLeaderID func() uint64 + GetLeaderListenUrls func() []string + GetLeaderPath func() string + GetLeadership func() *election.Leadership + GetMember func() interface{} + ID func() uint64 + IsLeader func() bool + IsLeaderElected func() bool + KeepLeader func(ctx context.Context) + MemberValue func() string + Name func() string + PreCheckLeader func() error + ResetLeader func() + type GlobalTSOAllocator struct + func (gta *GlobalTSOAllocator) GenerateTSO(count uint32) (pdpb.Timestamp, error) + func (gta *GlobalTSOAllocator) Initialize(int) error + func (gta *GlobalTSOAllocator) IsInitialize() bool + func (gta *GlobalTSOAllocator) Reset() + func (gta *GlobalTSOAllocator) SetTSO(tso uint64, ignoreSmaller, skipUpperBoundCheck bool) error + func (gta *GlobalTSOAllocator) SyncMaxTS(ctx context.Context, dcLocationMap map[string]DCLocationInfo, ...) error + func (gta *GlobalTSOAllocator) UpdateTSO() error + type Handler interface + ResetTS func(ts uint64, ignoreSmaller, skipUpperBoundCheck bool, keyspaceGroupID uint32) error + type KeyspaceGroupManager struct + func NewKeyspaceGroupManager(ctx context.Context, tsoServiceID *discovery.ServiceRegistryEntry, ...) *KeyspaceGroupManager + func (kgm *KeyspaceGroupManager) Close() + func (kgm *KeyspaceGroupManager) GetAllocatorManager(keyspaceGroupID uint32) (*AllocatorManager, error) + func (kgm *KeyspaceGroupManager) GetElectionMember(keyspaceID, keyspaceGroupID uint32) (ElectionMember, error) + func (kgm *KeyspaceGroupManager) HandleTSORequest(keyspaceID, keyspaceGroupID uint32, dcLocation string, count uint32) (ts pdpb.Timestamp, currentKeyspaceGroupID uint32, err error) + func (kgm *KeyspaceGroupManager) Initialize() error + type LocalTSOAllocator struct + func (lta *LocalTSOAllocator) CampaignAllocatorLeader(leaseTimeout int64, cmps ...clientv3.Cmp) error + func (lta *LocalTSOAllocator) CheckAllocatorLeader() (*pdpb.Member, int64, bool) + func (lta *LocalTSOAllocator) EnableAllocatorLeader() + func (lta *LocalTSOAllocator) GenerateTSO(count uint32) (pdpb.Timestamp, error) + func (lta *LocalTSOAllocator) GetAllocatorLeader() *pdpb.Member + func (lta *LocalTSOAllocator) GetCurrentTSO() (*pdpb.Timestamp, error) + func (lta *LocalTSOAllocator) GetDCLocation() string + func (lta *LocalTSOAllocator) GetMember() ElectionMember + func (lta *LocalTSOAllocator) Initialize(suffix int) error + func (lta *LocalTSOAllocator) IsAllocatorLeader() bool + func (lta *LocalTSOAllocator) IsInitialize() bool + func (lta *LocalTSOAllocator) KeepAllocatorLeader(ctx context.Context) + func (lta *LocalTSOAllocator) Reset() + func (lta *LocalTSOAllocator) SetTSO(tso uint64, ignoreSmaller, skipUpperBoundCheck bool) error + func (lta *LocalTSOAllocator) UpdateTSO() error + func (lta *LocalTSOAllocator) WatchAllocatorLeader(serverCtx context.Context, allocatorLeader *pdpb.Member, revision int64) + func (lta *LocalTSOAllocator) WriteTSO(maxTS *pdpb.Timestamp) error + type ServiceConfig interface + GeBackendEndpoints func() string + GetAdvertiseListenAddr func() string + GetListenAddr func() string + GetName func() string + type TestServiceConfig struct + AdvertiseListenAddr string + BackendEndpoints string + LeaderLease int64 + ListenAddr string + LocalTSOEnabled bool + MaxResetTSGap time.Duration + Name string + TLSConfig *grpcutil.TLSConfig + TSOSaveInterval time.Duration + TSOUpdatePhysicalInterval time.Duration + func (c *TestServiceConfig) GeBackendEndpoints() string + func (c *TestServiceConfig) GetAdvertiseListenAddr() string + func (c *TestServiceConfig) GetLeaderLease() int64 + func (c *TestServiceConfig) GetListenAddr() string + func (c *TestServiceConfig) GetMaxResetTSGap() time.Duration + func (c *TestServiceConfig) GetName() string + func (c *TestServiceConfig) GetTLSConfig() *grpcutil.TLSConfig + func (c *TestServiceConfig) GetTSOSaveInterval() time.Duration + func (c *TestServiceConfig) GetTSOUpdatePhysicalInterval() time.Duration + func (c *TestServiceConfig) IsLocalTSOEnabled() bool