Documentation
¶
Overview ¶
Package controlplane defines versioned snapshots for service discovery, configuration and governance policy distribution.
Index ¶
- Constants
- func DeduplicateSnapshotEvents(ctx context.Context, in <-chan SnapshotEvent) <-chan SnapshotEvent
- type CompositeProvider
- type ConfigContributor
- type DiscoveryContributor
- type DiscoverySnapshotSource
- type EndpointSnapshot
- type GovernanceContributor
- type GovernanceRuleSource
- type MetadataContributor
- type Provider
- type ProviderSource
- type ServiceSnapshot
- type Snapshot
- type SnapshotConsumerAction
- type SnapshotConsumerDispatch
- type SnapshotConsumerHook
- type SnapshotConsumerHooks
- type SnapshotContributor
- type SnapshotContributorFunc
- type SnapshotDiff
- type SnapshotEvent
- type StaticProvider
Constants ¶
View Source
const DefaultSnapshotVersion = "gofly-control-plane.v1"
Variables ¶
This section is empty.
Functions ¶
func DeduplicateSnapshotEvents ¶
func DeduplicateSnapshotEvents(ctx context.Context, in <-chan SnapshotEvent) <-chan SnapshotEvent
Types ¶
type CompositeProvider ¶
type CompositeProvider struct {
Version string
Name string
Contributors []SnapshotContributor
WatchInterval time.Duration
}
func (CompositeProvider) Load ¶
func (p CompositeProvider) Load(ctx context.Context) (Snapshot, error)
func (CompositeProvider) Source ¶
func (p CompositeProvider) Source() string
func (CompositeProvider) Watch ¶
func (p CompositeProvider) Watch(ctx context.Context) (<-chan SnapshotEvent, error)
type ConfigContributor ¶
type ConfigContributor struct {
Configs map[string]json.RawMessage
}
func (ConfigContributor) ContributeSnapshot ¶
func (c ConfigContributor) ContributeSnapshot(_ context.Context, snapshot *Snapshot) error
type DiscoveryContributor ¶
type DiscoveryContributor struct {
Registry DiscoverySnapshotSource
}
func (DiscoveryContributor) ContributeSnapshot ¶
func (c DiscoveryContributor) ContributeSnapshot(_ context.Context, snapshot *Snapshot) error
type DiscoverySnapshotSource ¶
type EndpointSnapshot ¶
type GovernanceContributor ¶
type GovernanceContributor struct {
Rules GovernanceRuleSource
}
func (GovernanceContributor) ContributeSnapshot ¶
func (c GovernanceContributor) ContributeSnapshot(_ context.Context, snapshot *Snapshot) error
type GovernanceRuleSource ¶
type GovernanceRuleSource interface {
Snapshot() []governance.Rule
}
type MetadataContributor ¶
func (MetadataContributor) ContributeSnapshot ¶
func (c MetadataContributor) ContributeSnapshot(_ context.Context, snapshot *Snapshot) error
type ProviderSource ¶
type ProviderSource interface {
Source() string
}
type ServiceSnapshot ¶
type ServiceSnapshot struct {
Name string `json:"name"`
Endpoints []EndpointSnapshot `json:"endpoints,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type Snapshot ¶
type Snapshot struct {
Version string `json:"version,omitempty"`
Checksum string `json:"checksum,omitempty"`
Services []ServiceSnapshot `json:"services,omitempty"`
Configs map[string]json.RawMessage `json:"configs,omitempty"`
Policies []governance.Rule `json:"policies,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func DecodeSnapshotJSON ¶
func (Snapshot) StableChecksum ¶
func (Snapshot) WithChecksum ¶
type SnapshotConsumerAction ¶
type SnapshotConsumerAction struct {
ChangeType string `json:"changeType"`
Action string `json:"action"`
Reason string `json:"reason"`
Scopes []string `json:"scopes,omitempty"`
RequiresFullReconcile bool `json:"requiresFullReconcile"`
NextActions []string `json:"nextActions,omitempty"`
}
func ConsumerActionForDiff ¶
func ConsumerActionForDiff(diff SnapshotDiff) SnapshotConsumerAction
func DefaultConsumerActions ¶
func DefaultConsumerActions() []SnapshotConsumerAction
type SnapshotConsumerDispatch ¶
type SnapshotConsumerDispatch struct {
ChangeType string `json:"changeType"`
Action string `json:"action"`
Invoked []string `json:"invoked,omitempty"`
Skipped bool `json:"skipped"`
RequiresFullReconcile bool `json:"requiresFullReconcile"`
}
func DispatchSnapshotConsumerAction ¶
func DispatchSnapshotConsumerAction(ctx context.Context, action SnapshotConsumerAction, snapshot Snapshot, hooks SnapshotConsumerHooks) (SnapshotConsumerDispatch, error)
func DispatchSnapshotDiff ¶
func DispatchSnapshotDiff(ctx context.Context, diff SnapshotDiff, snapshot Snapshot, hooks SnapshotConsumerHooks) (SnapshotConsumerDispatch, error)
type SnapshotConsumerHook ¶
type SnapshotConsumerHook func(context.Context, SnapshotConsumerAction, Snapshot) error
type SnapshotConsumerHooks ¶
type SnapshotConsumerHooks struct {
LoadBaseline SnapshotConsumerHook
InspectSnapshot SnapshotConsumerHook
RefreshConfigPlanner SnapshotConsumerHook
RefreshRoutingModel SnapshotConsumerHook
ReloadGovernanceGates SnapshotConsumerHook
RefreshCapabilityCache SnapshotConsumerHook
FullReconcile SnapshotConsumerHook
}
type SnapshotContributor ¶
type SnapshotContributorFunc ¶
func (SnapshotContributorFunc) ContributeSnapshot ¶
func (f SnapshotContributorFunc) ContributeSnapshot(ctx context.Context, snapshot *Snapshot) error
type SnapshotDiff ¶
type SnapshotDiff struct {
FromChecksum string `json:"fromChecksum,omitempty"`
ToChecksum string `json:"toChecksum,omitempty"`
Changed bool `json:"changed"`
ChangeType string `json:"changeType"`
ChangedFields []string `json:"changedFields,omitempty"`
}
func DiffSnapshotChecksum ¶
func DiffSnapshotChecksum(fromChecksum string, to Snapshot) SnapshotDiff
func DiffSnapshots ¶
func DiffSnapshots(from, to Snapshot) SnapshotDiff
type SnapshotEvent ¶
type StaticProvider ¶
func (StaticProvider) Source ¶
func (p StaticProvider) Source() string
func (StaticProvider) Watch ¶
func (p StaticProvider) Watch(ctx context.Context) (<-chan SnapshotEvent, error)
Click to show internal directories.
Click to hide internal directories.