forked from ydb-platform/nbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_disk_from_incremental.go
67 lines (53 loc) · 1.64 KB
/
delete_disk_from_incremental.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package dataplane
import (
"context"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/dataplane/config"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/dataplane/protos"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/dataplane/snapshot/storage"
"github.com/ydb-platform/nbs/cloud/tasks"
)
////////////////////////////////////////////////////////////////////////////////
type deleteDiskFromIncrementalTask struct {
storage storage.Storage
config *config.DataplaneConfig
request *protos.DeleteDiskFromIncrementalRequest
state *protos.DeleteDiskFromIncrementalState
}
func (t *deleteDiskFromIncrementalTask) Save() ([]byte, error) {
return proto.Marshal(t.state)
}
func (t *deleteDiskFromIncrementalTask) Load(request, state []byte) error {
t.request = &protos.DeleteDiskFromIncrementalRequest{}
err := proto.Unmarshal(request, t.request)
if err != nil {
return err
}
t.state = &protos.DeleteDiskFromIncrementalState{}
return proto.Unmarshal(state, t.state)
}
func (t *deleteDiskFromIncrementalTask) Run(
ctx context.Context,
execCtx tasks.ExecutionContext,
) error {
return t.storage.DeleteDiskFromIncremental(
ctx,
t.request.Disk.ZoneId,
t.request.Disk.DiskId,
)
}
func (t *deleteDiskFromIncrementalTask) Cancel(
ctx context.Context,
execCtx tasks.ExecutionContext,
) error {
return nil
}
func (t *deleteDiskFromIncrementalTask) GetMetadata(
ctx context.Context,
) (proto.Message, error) {
return &empty.Empty{}, nil
}
func (t *deleteDiskFromIncrementalTask) GetResponse() proto.Message {
return &empty.Empty{}
}