Documentation
¶
Index ¶
- Constants
- func NewCombinedCache(policyCache cache.Cache, apiKeyCache cache.Cache, ...) cache.Cache
- type CombinedCache
- func (c *CombinedCache) CreateDeltaWatch(request *cache.DeltaRequest, subscription cache.Subscription, ...) (func(), error)
- func (c *CombinedCache) CreateWatch(request *cache.Request, subscription cache.Subscription, ...) (func(), error)
- func (c *CombinedCache) Fetch(ctx context.Context, request *cache.Request) (cache.Response, error)
- type PolicyManager
- func (pm *PolicyManager) AddRuntimeConfig(key string, rdc *models.RuntimeDeployConfig) error
- func (pm *PolicyManager) DeleteAPIConfig(kind, handle string) error
- func (pm *PolicyManager) GetResourceVersion() int64
- func (pm *PolicyManager) RemoveRuntimeConfig(key string) error
- func (pm *PolicyManager) SetRuntimeStore(store *storage.RuntimeConfigStore)
- func (pm *PolicyManager) SetTransformers(t models.ConfigTransformer)
- func (pm *PolicyManager) UpdateEventChannelSnapshot() error
- func (pm *PolicyManager) UpsertAPIConfig(cfg *models.StoredConfig) error
- type Server
- type ServerOption
- type SnapshotManager
- func (sm *SnapshotManager) GetEventChannelCache() cache.Cache
- func (sm *SnapshotManager) GetPolicyCache() cache.Cache
- func (sm *SnapshotManager) GetRouteCache() cache.Cache
- func (sm *SnapshotManager) SetConfigStore(store *storage.ConfigStore)
- func (sm *SnapshotManager) SetRuntimeStore(store *storage.RuntimeConfigStore)
- func (sm *SnapshotManager) UpdateSnapshot(ctx context.Context) error
- type TLSConfig
- type Translator
Constants ¶
const ( // PolicyChainTypeURL is the custom type URL for policy chain configurations PolicyChainTypeURL = "api-platform.wso2.org/v1.PolicyChainConfig" // RouteConfigTypeURL is the custom type URL for route config (metadata + resolver) RouteConfigTypeURL = "api-platform.wso2.org/v1.RouteConfig" // EventChannelConfigTypeURL is the custom type URL for event gateway channel configurations EventChannelConfigTypeURL = "api-platform.wso2.org/v1.EventChannelConfig" )
Variables ¶
This section is empty.
Functions ¶
func NewCombinedCache ¶
func NewCombinedCache(policyCache cache.Cache, apiKeyCache cache.Cache, lazyResourceCache cache.Cache, subscriptionCache cache.Cache, routeConfigCache cache.Cache, eventChannelCache cache.Cache, logger *slog.Logger) cache.Cache
NewCombinedCache creates a new combined cache that merges policy, API key, lazy resource, subscription, route config, and event channel caches. Returns a cache.Cache interface implementation.
Types ¶
type CombinedCache ¶
type CombinedCache struct {
// contains filtered or unexported fields
}
CombinedCache combines policy, API key, lazy resource, subscription, route config, and event channel caches to provide a unified xDS cache interface It implements cache.Cache interface by delegating to underlying caches
func (*CombinedCache) CreateDeltaWatch ¶
func (c *CombinedCache) CreateDeltaWatch(request *cache.DeltaRequest, subscription cache.Subscription, responseChan chan cache.DeltaResponse) (func(), error)
CreateDeltaWatch creates a delta watch for incremental xDS updates Implements cache.ConfigWatcher interface
func (*CombinedCache) CreateWatch ¶
func (c *CombinedCache) CreateWatch(request *cache.Request, subscription cache.Subscription, responseChan chan cache.Response) (func(), error)
CreateWatch creates a watch for resources in both policy and API key caches Implements cache.ConfigWatcher interface
type PolicyManager ¶
type PolicyManager struct {
// contains filtered or unexported fields
}
PolicyManager manages runtime deploy configurations and snapshot updates.
func NewPolicyManager ¶
func NewPolicyManager(snapshotManager *SnapshotManager, logger *slog.Logger) *PolicyManager
NewPolicyManager creates a new PolicyManager.
func (*PolicyManager) AddRuntimeConfig ¶
func (pm *PolicyManager) AddRuntimeConfig(key string, rdc *models.RuntimeDeployConfig) error
AddRuntimeConfig adds or updates a RuntimeDeployConfig and triggers snapshot update.
func (*PolicyManager) DeleteAPIConfig ¶
func (pm *PolicyManager) DeleteAPIConfig(kind, handle string) error
DeleteAPIConfig removes the RuntimeDeployConfig for the given kind/handle and triggers a snapshot update. A not-found error is silently ignored.
func (*PolicyManager) GetResourceVersion ¶
func (pm *PolicyManager) GetResourceVersion() int64
GetResourceVersion returns the current resource version used for xDS updates.
func (*PolicyManager) RemoveRuntimeConfig ¶
func (pm *PolicyManager) RemoveRuntimeConfig(key string) error
RemoveRuntimeConfig removes a RuntimeDeployConfig and triggers snapshot update.
func (*PolicyManager) SetRuntimeStore ¶
func (pm *PolicyManager) SetRuntimeStore(store *storage.RuntimeConfigStore)
SetRuntimeStore sets the RuntimeConfigStore.
func (*PolicyManager) SetTransformers ¶
func (pm *PolicyManager) SetTransformers(t models.ConfigTransformer)
SetTransformers sets the ConfigTransformer used by UpsertAPIConfig.
func (*PolicyManager) UpdateEventChannelSnapshot ¶
func (pm *PolicyManager) UpdateEventChannelSnapshot() error
UpdateEventChannelSnapshot triggers an update of just the event channel config cache. This is used for WebSubApi configs that don't need RuntimeDeployConfig transformation.
func (*PolicyManager) UpsertAPIConfig ¶
func (pm *PolicyManager) UpsertAPIConfig(cfg *models.StoredConfig) error
UpsertAPIConfig transforms cfg into a RuntimeDeployConfig and stores it, then triggers a snapshot update (both policy chain and route config caches).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the policy xDS gRPC server
func NewServer ¶
func NewServer(snapshotManager *SnapshotManager, apiKeySnapshotMgr *apikeyxds.APIKeySnapshotManager, lazyResourceSnapshotMgr *lazyresourcexds.LazyResourceSnapshotManager, subscriptionSnapshotMgr *subscriptionxds.SnapshotManager, port int, logger *slog.Logger, opts ...ServerOption) *Server
NewServer creates a new policy xDS server
type ServerOption ¶
type ServerOption func(*Server)
ServerOption is a functional option for configuring the Server
func WithOnFirstConnect ¶
func WithOnFirstConnect(ch chan struct{}) ServerOption
WithOnFirstConnect sets a channel that will be closed when the first xDS client connects
func WithTLS ¶
func WithTLS(certFile, keyFile string) ServerOption
WithTLS enables TLS with the provided certificate and key files
type SnapshotManager ¶
type SnapshotManager struct {
// contains filtered or unexported fields
}
SnapshotManager manages xDS snapshots for policy and route configurations. It holds LinearCaches for PolicyChainConfig, RouteConfig, and EventChannelConfig.
func NewSnapshotManager ¶
func NewSnapshotManager(logger *slog.Logger) *SnapshotManager
NewSnapshotManager creates a new policy snapshot manager with LinearCaches for custom type URLs.
func (*SnapshotManager) GetEventChannelCache ¶
func (sm *SnapshotManager) GetEventChannelCache() cache.Cache
GetEventChannelCache returns the event channel config cache.
func (*SnapshotManager) GetPolicyCache ¶
func (sm *SnapshotManager) GetPolicyCache() cache.Cache
GetPolicyCache returns the policy chain cache (backward compatible).
func (*SnapshotManager) GetRouteCache ¶
func (sm *SnapshotManager) GetRouteCache() cache.Cache
GetRouteCache returns the route config cache.
func (*SnapshotManager) SetConfigStore ¶
func (sm *SnapshotManager) SetConfigStore(store *storage.ConfigStore)
SetConfigStore sets the ConfigStore for translating WebSubApi configs to EventChannelConfig resources.
func (*SnapshotManager) SetRuntimeStore ¶
func (sm *SnapshotManager) SetRuntimeStore(store *storage.RuntimeConfigStore)
SetRuntimeStore sets the RuntimeConfigStore for the new API path.
func (*SnapshotManager) UpdateSnapshot ¶
func (sm *SnapshotManager) UpdateSnapshot(ctx context.Context) error
UpdateSnapshot generates new xDS snapshots from all RuntimeDeployConfigs.
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator converts RuntimeDeployConfig to xDS resources.
func NewTranslator ¶
func NewTranslator(logger *slog.Logger) *Translator
NewTranslator creates a new policy translator.
func (*Translator) TranslateRuntimeConfigs ¶
func (t *Translator) TranslateRuntimeConfigs(rdcs []*models.RuntimeDeployConfig) (map[string]map[string]types.Resource, error)
TranslateRuntimeConfigs translates RuntimeDeployConfigs to xDS resources. Returns two maps: PolicyChainTypeURL → keyed resources, RouteConfigTypeURL → keyed resources.
func (*Translator) TranslateWebSubApisToEventChannelConfigs ¶
func (t *Translator) TranslateWebSubApisToEventChannelConfigs(configs []*models.StoredConfig) map[string]types.Resource
TranslateWebSubApisToEventChannelConfigs translates WebSubApi StoredConfigs into EventChannelConfig xDS resources for the event gateway runtime.