Skip to content

Commit 6dac38b

Browse files
committed
use options and parameter to sync from storage
1 parent 0496c33 commit 6dac38b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

sdk/impl.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,12 @@ func (c *Client) GetRestoreByOpID(ctx context.Context, opid string) (*RestoreMet
262262
return restore.GetRestoreMetaByOPID(ctx, c.conn, opid)
263263
}
264264

265-
func (c *Client) SyncFromStorage(ctx context.Context) (CommandID, error) {
266-
opid, err := ctrl.SendResync(ctx, c.conn)
265+
func (c *Client) SyncFromStorage(ctx context.Context, skipRestores bool) (CommandID, error) {
266+
var opts *ctrl.ResyncCmd
267+
if skipRestores {
268+
opts = &ctrl.ResyncCmd{SkipRestores: true}
269+
}
270+
opid, err := ctrl.SendResync(ctx, c.conn, opts)
267271
return CommandID(opid.String()), err
268272
}
269273

@@ -272,12 +276,12 @@ func (c *Client) SyncFromExternalStorage(ctx context.Context, name string) (Comm
272276
return NoOpID, errors.New("name is not provided")
273277
}
274278

275-
opid, err := ctrl.SendSyncMetaFrom(ctx, c.conn, name)
279+
opid, err := ctrl.SendResync(ctx, c.conn, &ctrl.ResyncCmd{Name: name})
276280
return CommandID(opid.String()), err
277281
}
278282

279283
func (c *Client) SyncFromAllExternalStorages(ctx context.Context) (CommandID, error) {
280-
opid, err := ctrl.SendSyncMetaFrom(ctx, c.conn, "")
284+
opid, err := ctrl.SendResync(ctx, c.conn, &ctrl.ResyncCmd{All: true})
281285
return CommandID(opid.String()), err
282286
}
283287

@@ -286,12 +290,12 @@ func (c *Client) ClearSyncFromExternalStorage(ctx context.Context, name string)
286290
return NoOpID, errors.New("name is not provided")
287291
}
288292

289-
opid, err := ctrl.SendClearMetaFrom(ctx, c.conn, name)
293+
opid, err := ctrl.SendResync(ctx, c.conn, &ctrl.ResyncCmd{Name: name, Clear: true})
290294
return CommandID(opid.String()), err
291295
}
292296

293297
func (c *Client) ClearSyncFromAllExternalStorages(ctx context.Context) (CommandID, error) {
294-
opid, err := ctrl.SendClearMetaFrom(ctx, c.conn, "")
298+
opid, err := ctrl.SendResync(ctx, c.conn, &ctrl.ResyncCmd{All: true, Clear: true})
295299
return CommandID(opid.String()), err
296300
}
297301

0 commit comments

Comments
 (0)