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 {
23 private static final long serialVersionUID = 1L;
25 private ImmutableUnsignedLongSet transactionIds;
26 private LocalHistoryIdentifier identifier;
29 @SuppressWarnings("checkstyle:RedundantModifier")
34 ST(final byte[] bytes) {
35 this.bytes = requireNonNull(bytes);
39 public byte[] bytes() {
44 public void readExternal(final byte[] newBytes) throws IOException {
45 bytes = requireNonNull(newBytes);
47 final var in = ByteStreams.newDataInput(newBytes);
48 identifier = LocalHistoryIdentifier.readFrom(in);
49 transactionIds = verifyNotNull(ImmutableUnsignedLongSet.readFrom(in));
53 public Object readResolve() {
54 return new SkipTransactionsPayload(identifier, bytes, transactionIds);