2 * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.persisted;
10 import static com.google.common.base.Verify.verifyNotNull;
11 import static java.util.Objects.requireNonNull;
13 import com.google.common.io.ByteStreams;
14 import java.io.IOException;
15 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
16 import org.opendaylight.controller.cluster.datastore.persisted.AbstractIdentifiablePayload.SerialForm;
19 * Serialization proxy for {@link CloseLocalHistoryPayload}.
21 final class DH implements SerialForm {
23 private static final long serialVersionUID = 1L;
25 private LocalHistoryIdentifier identifier;
28 @SuppressWarnings("checkstyle:RedundantModifier")
33 DH(final byte[] bytes) {
34 this.bytes = requireNonNull(bytes);
38 public byte[] bytes() {
43 public void readExternal(final byte[] newBytes) throws IOException {
44 bytes = requireNonNull(newBytes);
45 identifier = verifyNotNull(LocalHistoryIdentifier.readFrom(ByteStreams.newDataInput(newBytes)));
49 public Object readResolve() {
50 return new CloseLocalHistoryPayload(identifier, bytes);