2 * Copyright (c) 2021 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.access.commands;
10 import akka.actor.ActorRef;
11 import com.google.common.annotations.Beta;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import com.google.common.collect.ImmutableList;
14 import com.google.common.primitives.UnsignedLong;
15 import java.util.Collection;
16 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.opendaylight.controller.cluster.access.ABIVersion;
19 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
22 * Request to skip a number of {@link TransactionIdentifier}s within a {code local history}. This request is essentially
23 * equivalent to {@link TransactionPurgeRequest} for {@link #getTarget()}, but also carries additional sibling
24 * {@link TransactionIdentifier}s in {@link #getOthers()}.
27 * This request is sent by the frontend to inform the backend that a set of {@link TransactionIdentifier}s are
28 * explicitly retired and are guaranteed to never be used by the frontend.
31 public final class SkipTransactionsRequest extends TransactionRequest<SkipTransactionsRequest> {
32 private static final long serialVersionUID = 1L;
34 // Note: UnsignedLong is arbitrary, yang.common.Uint64 would work just as well, we really want an immutable
35 // List<long>, though.
36 private final @NonNull ImmutableList<UnsignedLong> others;
38 public SkipTransactionsRequest(final TransactionIdentifier target, final long sequence,
39 final ActorRef replyTo, final Collection<UnsignedLong> others) {
40 super(target, sequence, replyTo);
41 this.others = ImmutableList.copyOf(others);
45 * Return this {@link #getTarget()}s sibling {@link TransactionIdentifier}s.
47 * @return Siblings values of {@link TransactionIdentifier#getTransactionId()}
49 public List<UnsignedLong> getOthers() {
54 protected SkipTransactionsRequestV1 externalizableProxy(final ABIVersion version) {
55 return new SkipTransactionsRequestV1(this);
59 protected SkipTransactionsRequest cloneAsVersion(final ABIVersion version) {
64 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
65 final var helper = super.addToStringAttributes(toStringHelper);
66 if (!others.isEmpty()) {
67 helper.add("others", others);