|
30 | 30 | import java.util.Objects; |
31 | 31 | import java.util.Set; |
32 | 32 | import java.util.UUID; |
| 33 | +import org.apache.ignite.internal.Order; |
33 | 34 | import org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord; |
34 | 35 | import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId; |
35 | 36 | import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer; |
36 | 37 | import org.apache.ignite.internal.util.tostring.GridToStringInclude; |
37 | 38 | import org.apache.ignite.internal.util.typedef.F; |
38 | 39 | import org.apache.ignite.internal.util.typedef.internal.S; |
39 | 40 | import org.apache.ignite.internal.util.typedef.internal.U; |
| 41 | +import org.apache.ignite.plugin.extensions.communication.Message; |
| 42 | +import org.apache.ignite.plugin.extensions.communication.MessageFactory; |
40 | 43 | import org.jetbrains.annotations.Nullable; |
41 | 44 |
|
42 | 45 | /** |
43 | 46 | * Snapshot metadata file. |
44 | 47 | * <p> |
45 | 48 | * All changes must be made with the respect of RU rules. |
46 | 49 | */ |
47 | | -public class SnapshotMetadata implements Serializable { |
| 50 | +public class SnapshotMetadata implements Message, Serializable { |
48 | 51 | /** Serial version uid. */ |
49 | 52 | private static final long serialVersionUID = 0L; |
50 | 53 |
|
51 | 54 | /** Unique snapshot request id. */ |
52 | | - private final UUID rqId; |
| 55 | + @Order(0) |
| 56 | + UUID rqId; |
53 | 57 |
|
54 | 58 | /** Snapshot name. */ |
55 | 59 | @GridToStringInclude |
56 | | - private final String snpName; |
| 60 | + @Order(1) |
| 61 | + String snpName; |
57 | 62 |
|
58 | 63 | /** Consistent id of a node to which this metadata relates. */ |
59 | 64 | @GridToStringInclude |
60 | | - private final String consId; |
| 65 | + @Order(2) |
| 66 | + String consId; |
61 | 67 |
|
62 | 68 | /** |
63 | 69 | * Directory related to the current consistent node id on which partition files are stored. |
64 | 70 | * For some of the cases, consId doesn't equal the directory name. |
65 | 71 | */ |
66 | | - private final String folderName; |
| 72 | + @Order(3) |
| 73 | + String folderName; |
67 | 74 |
|
68 | 75 | /** |
69 | 76 | * If {@code true} then compress partition files. |
70 | 77 | * This shouldn't be confused with {@link SnapshotMetadata#comprGrpIds} which represents how Ignite keeps data in memory pages |
71 | 78 | * while {@link SnapshotMetadata#comprParts} represents how dump files are stored on disk. |
72 | 79 | */ |
73 | | - private final boolean comprParts; |
| 80 | + @Order(4) |
| 81 | + boolean comprParts; |
74 | 82 |
|
75 | 83 | /** Page size of stored snapshot data. */ |
76 | | - private final int pageSize; |
| 84 | + @Order(5) |
| 85 | + int pageSize; |
77 | 86 |
|
78 | 87 | /** The list of cache groups ids which were included into snapshot. */ |
79 | 88 | @GridToStringInclude |
80 | | - private final List<Integer> grpIds; |
| 89 | + @Order(6) |
| 90 | + List<Integer> grpIds; |
81 | 91 |
|
82 | 92 | /** The set of affected by snapshot baseline nodes. */ |
83 | 93 | @GridToStringInclude |
84 | | - private final Set<String> bltNodes; |
| 94 | + @Order(7) |
| 95 | + Set<String> bltNodes; |
85 | 96 |
|
86 | 97 | /** WAL pointer to {@link ClusterSnapshotRecord} if exists. */ |
87 | | - private final @Nullable WALPointer snpRecPtr; |
| 98 | + @Order(8) |
| 99 | + @Nullable WALPointer snpRecPtr; |
88 | 100 |
|
89 | 101 | /** |
90 | 102 | * Map of cache group partitions from which snapshot has been taken on the local node. This map can be empty |
91 | 103 | * since for instance, due to the node filter there is no cache data on node. |
92 | 104 | */ |
93 | 105 | @GridToStringInclude |
94 | | - private transient Map<Integer, Set<Integer>> locParts = new HashMap<>(); |
| 106 | + @Order(9) |
| 107 | + transient Map<Integer, Set<Integer>> locParts = new HashMap<>(); |
95 | 108 |
|
96 | 109 | /** Master key digest for encrypted caches. */ |
97 | 110 | @GridToStringInclude |
98 | | - @Nullable private final byte[] masterKeyDigest; |
| 111 | + @Order(10) |
| 112 | + @Nullable byte[] masterKeyDigest; |
99 | 113 |
|
100 | 114 | /** Warnings occurred at snapshot creation. */ |
101 | 115 | @GridToStringInclude |
102 | | - @Nullable private List<String> warnings; |
| 116 | + @Order(11) |
| 117 | + @Nullable List<String> warnings; |
103 | 118 |
|
104 | 119 | /** Creation timestamp in milliseconds since Unix epoch. */ |
105 | | - private long snapshotTime; |
| 120 | + @Order(12) |
| 121 | + long snapshotTime; |
106 | 122 |
|
107 | 123 | /** */ |
108 | | - private transient Set<Integer> comprGrpIds; |
| 124 | + @Order(13) |
| 125 | + @Nullable transient Set<Integer> comprGrpIds; |
109 | 126 |
|
110 | 127 | /** */ |
111 | 128 | private boolean hasComprGrps; |
112 | 129 |
|
113 | 130 | /** If {@code true} snapshot only primary copies of partitions. */ |
114 | | - private boolean onlyPrimary; |
| 131 | + @Order(14) |
| 132 | + boolean onlyPrimary; |
115 | 133 |
|
116 | 134 | /** If {@code true} cache group dump stored. */ |
117 | | - private boolean dump; |
| 135 | + @Order(15) |
| 136 | + boolean dump; |
118 | 137 |
|
119 | 138 | /** Encryption key. */ |
120 | | - private @Nullable byte[] encKey; |
| 139 | + @Order(16) |
| 140 | + @Nullable byte[] encKey; |
| 141 | + |
| 142 | + /** Empty constructor for a {@link MessageFactory}. */ |
| 143 | + public SnapshotMetadata() { |
| 144 | + // No-op. |
| 145 | + } |
121 | 146 |
|
122 | 147 | /** |
123 | 148 | * @param rqId Unique request id. |
|
0 commit comments