Sync executes a sync between two remotes.
(ctx context.Context, req SyncRequest)
| 61 | |
| 62 | // Sync executes a sync between two remotes. |
| 63 | func (c *Client) Sync(ctx context.Context, req SyncRequest) (SyncResult, error) { |
| 64 | if err := req.Validate(); err != nil { |
| 65 | return SyncResult{}, err |
| 66 | } |
| 67 | cfg, err := c.buildSyncConfig(ctx, req.Source, req.Target, req.Scope, req.Policy, req.CollectStats, false) |
| 68 | if err != nil { |
| 69 | return SyncResult{}, err |
| 70 | } |
| 71 | result, err := internalbridge.Run(ctx, cfg) |
| 72 | if err != nil { |
| 73 | return SyncResult{}, fmt.Errorf("sync: %w", err) |
| 74 | } |
| 75 | return internalbridge.FromSyncResult(result), nil |
| 76 | } |
| 77 | |
| 78 | // Replicate executes source-authoritative relay-only replication between two remotes. |
| 79 | func (c *Client) Replicate(ctx context.Context, req SyncRequest) (SyncResult, error) { |