generated from Warchant/cmake-hunter-seed
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathworker_mock.hpp
105 lines (85 loc) · 4.27 KB
/
worker_mock.hpp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <gmock/gmock.h>
#include "sector_storage/worker.hpp"
namespace fc::sector_storage {
class WorkerMock : public Worker {
public:
MOCK_METHOD2(moveStorage,
outcome::result<CallId>(const SectorRef &, SectorFileType));
MOCK_METHOD4(fetch,
outcome::result<CallId>(const SectorRef &,
const SectorFileType &,
PathType,
AcquireMode));
MOCK_METHOD5(unsealPiece,
outcome::result<CallId>(const SectorRef &,
UnpaddedByteIndex,
const UnpaddedPieceSize &,
const SealRandomness &,
const CID &));
outcome::result<CallId> readPiece(PieceData output,
const SectorRef §or,
UnpaddedByteIndex offset,
const UnpaddedPieceSize &size) override {
return doReadPiece(output.getFd(), sector, offset, size);
}
MOCK_METHOD4(doReadPiece,
outcome::result<CallId>(int,
const SectorRef &,
UnpaddedByteIndex,
const UnpaddedPieceSize &));
MOCK_METHOD0(getInfo, outcome::result<primitives::WorkerInfo>());
MOCK_METHOD0(getSupportedTask,
outcome::result<std::set<primitives::TaskType>>());
MOCK_METHOD0(getAccessiblePaths,
outcome::result<std::vector<primitives::StoragePath>>());
MOCK_METHOD3(sealPreCommit1,
outcome::result<CallId>(const SectorRef &,
const SealRandomness &,
const std::vector<PieceInfo> &));
MOCK_METHOD2(sealPreCommit2,
outcome::result<CallId>(const SectorRef &,
const PreCommit1Output &));
MOCK_METHOD5(sealCommit1,
outcome::result<CallId>(const SectorRef &,
const SealRandomness &,
const InteractiveRandomness &,
const std::vector<PieceInfo> &,
const SectorCids &));
MOCK_METHOD2(sealCommit2,
outcome::result<CallId>(const SectorRef &,
const Commit1Output &));
MOCK_METHOD2(replicaUpdate,
outcome::result<CallId>(const SectorRef &,
const std::vector<PieceInfo> &));
MOCK_METHOD4(proveReplicaUpdate1,
outcome::result<CallId>(
const SectorRef &, const CID &, const CID &, const CID &));
MOCK_METHOD5(proveReplicaUpdate2,
outcome::result<CallId>(const SectorRef &,
const CID &,
const CID &,
const CID &,
const Update1Output &));
MOCK_METHOD2(finalizeSector,
outcome::result<CallId>(const SectorRef &,
std::vector<Range>));
outcome::result<CallId> addPiece(const SectorRef §or,
VectorCoW<UnpaddedPieceSize> piece_sizes,
const UnpaddedPieceSize &new_piece_size,
PieceData piece_data) override {
return doAddPiece(
sector, piece_sizes.mut(), new_piece_size, piece_data.getFd());
}
MOCK_METHOD4(doAddPiece,
outcome::result<CallId>(const SectorRef &,
const std::vector<UnpaddedPieceSize> &,
const UnpaddedPieceSize &,
int));
MOCK_METHOD1(ping, void(std::function<void(const bool)>));
};
} // namespace fc::sector_storage