Vladsz83 commented on code in PR #13666: URL: https://github.com/apache/ignite/pull/13666#discussion_r4375719348
########## modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotListJobResult.java: ########## @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.persistence.snapshot; + +import java.util.Map; +import org.apache.ignite.internal.Order; +import org.apache.ignite.internal.dto.IgniteDataTransferObject; +import org.jetbrains.annotations.Nullable; + +/** Per-node result of the snapshot list task. Contains information about the snapshots found on the node. */ +public final class SnapshotListJobResult extends IgniteDataTransferObject { + /** Serial version uid. */ + private static final long serialVersionUID = 0L; + + /** Local node's snapshot descriptions. */ + @Order(0) + Map<String, SnapshotInfo> snapshots; + + /** Default constructor for serialization purposes. */ + public SnapshotListJobResult() { + // No-op. + } + + /** */ + public SnapshotListJobResult(Map<String, SnapshotInfo> snapshots) { + this.snapshots = snapshots; + } + + /** @return Snapshot descriptions by snapshot name. */ + public Map<String, SnapshotInfo> snapshots() { + return snapshots; + } + + /** Holds information about a snapshot or its parts: size, creation time, number of incremental parts or external storages. */ + public static class SnapshotInfo extends IgniteDataTransferObject { + /** Serial version uid. */ + private static final long serialVersionUID = 0L; + + /** Total size of a snapshot. Or size of its external storages or incremental parts. */ + @Order(0) + long size; + + /** Creation date of the snapshot or of its incremental parts. */ + @Order(1) + @Nullable Long date; Review Comment: > unboxing on constructor and boxing here, why do we need it ? The constructors create: - The main description. A snapshot has a creation date, so we do not expect it to be `@Nullable` in the constructor. - Description of incremental snapshot parts. Incremental snapshots can be created later. So, they have their own date, and we always pass it to the constructor. No need to be `@Nullable` and boxed in the constructor. - Description of snapshot external storages. There is no date in this constructor because we do not print dates for external storages. The storages come with the main snapshot data. So, the date variable is `@Nullable` for external storages. Looks fair. In contrast, `cnt` is used only for external storages and incremental snapshots. So it is `@Nullable` for the main snapshot data but is not expected to be @Nullable in the constructors for external storages and incremental snapshots. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
