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;
17 import org.opendaylight.controller.cluster.datastore.utils.ImmutableUnsignedLongSet;
20 * Serialization proxy for {@link SkipTransactionsPayload}.
22 final class ST implements SerialForm {
24 private static final long serialVersionUID = 1L;
26 private ImmutableUnsignedLongSet transactionIds;
27 private LocalHistoryIdentifier identifier;
30 @SuppressWarnings("checkstyle:RedundantModifier")
35 ST(final byte[] bytes) {
36 this.bytes = requireNonNull(bytes);
40 public byte[] bytes() {
45 public void readExternal(final byte[] newBytes) throws IOException {
46 bytes = requireNonNull(newBytes);
48 final var in = ByteStreams.newDataInput(newBytes);
49 identifier = LocalHistoryIdentifier.readFrom(in);
50 transactionIds = verifyNotNull(ImmutableUnsignedLongSet.readFrom(in));
54 public Object readResolve() {
55 return new SkipTransactionsPayload(identifier, bytes, transactionIds);