Skip to content

Commit

Permalink
Expose OnSuccessfulSync from the broker syncer
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis committed Jul 23, 2020
1 parent b4bed33 commit 1094935
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pkg/syncer/broker/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type ResourceConfig struct {
// LocalTransform function used to transform a local resource to the equivalent broker resource.
LocalTransform syncer.TransformFunc

// OnSuccessfulSync function invoked after a successful sync operation.
LocalOnSuccessfulSync syncer.OnSuccessfulSyncFunc

// BrokerResourceType the type of the broker resources to sync to the local source.
BrokerResourceType runtime.Object

Expand Down Expand Up @@ -144,16 +147,17 @@ func NewSyncerWithDetail(config *SyncerConfig, localClient, brokerClient dynamic

for _, rc := range config.ResourceConfigs {
localSyncer, err := syncer.NewResourceSyncer(&syncer.ResourceSyncerConfig{
Name: fmt.Sprintf("local -> broker for %T", rc.LocalResourceType),
SourceClient: localClient,
SourceNamespace: rc.LocalSourceNamespace,
LocalClusterID: config.LocalClusterID,
Direction: syncer.LocalToRemote,
RestMapper: restMapper,
Federator: brokerSyncer.remoteFederator,
ResourceType: rc.LocalResourceType,
Transform: rc.LocalTransform,
Scheme: config.Scheme,
Name: fmt.Sprintf("local -> broker for %T", rc.LocalResourceType),
SourceClient: localClient,
SourceNamespace: rc.LocalSourceNamespace,
LocalClusterID: config.LocalClusterID,
Direction: syncer.LocalToRemote,
RestMapper: restMapper,
Federator: brokerSyncer.remoteFederator,
ResourceType: rc.LocalResourceType,
Transform: rc.LocalTransform,
OnSuccessfulSync: rc.LocalOnSuccessfulSync,
Scheme: config.Scheme,
})

if err != nil {
Expand Down

0 comments on commit 1094935

Please sign in to comment.