Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientFactory ¶
type ClientFactory struct {
Config *config.McpServerConfig
Logger *slog.Logger
// Single instance of license client
Client *license.CustomLicensesApiService
ClientMu sync.RWMutex
Initialized bool
}
ClientFactory provides a centralized way to create license clients This eliminates DRY violations by providing a single source of truth for license client creation
func NewClientFactory ¶
func NewClientFactory(config *config.McpServerConfig, logger *slog.Logger) *ClientFactory
NewClientFactory creates a new license client factory
type ClientFactoryProvider ¶
type ClientFactoryProvider interface {
// CreateLicenseClient creates a license client with mode-specific logic
CreateLicenseClient(ctx context.Context, factory *ClientFactory) (*license.CustomLicensesApiService, error)
}
ClientFactoryProvider defines the interface for mode-specific client creation logic This allows different implementations for internal and external modes
var DefaultFactoryProvider ClientFactoryProvider
DefaultFactoryProvider holds the active high-level factory provider implementation
type LicenseCache ¶
type LicenseCache struct {
// contains filtered or unexported fields
}
LicenseCache provides thread-safe caching for license information
func GetGlobalLicenseCache ¶
func GetGlobalLicenseCache(cacheTtl time.Duration, cleanInterval time.Duration) *LicenseCache
GetGlobalLicenseCache returns the global license cache instance
func NewLicenseCache ¶
func NewLicenseCache(ttl time.Duration) *LicenseCache
NewLicenseCache creates a new license cache with the specified TTL
func (*LicenseCache) CleanExpired ¶
func (lc *LicenseCache) CleanExpired()
CleanExpired removes expired entries from the cache
func (*LicenseCache) Clear ¶
func (lc *LicenseCache) Clear()
Clear removes all entries from the cache
func (*LicenseCache) Get ¶
func (lc *LicenseCache) Get(accountID string) ([]string, bool)
Get retrieves cached license information for an account
func (*LicenseCache) Set ¶
func (lc *LicenseCache) Set(accountID string, licensedModules []string)
Set stores license information for an account in the cache
func (*LicenseCache) Size ¶
func (lc *LicenseCache) Size() int
Size returns the current number of entries in the cache
type LicenseCacheEntry ¶
LicenseCacheEntry represents a cached license entry with TTL
func (*LicenseCacheEntry) IsExpired ¶
func (e *LicenseCacheEntry) IsExpired() bool
IsExpired checks if the cache entry has expired