diff --git a/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/ActiveActiveBaseSpec.scala b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/ActiveActiveBaseSpec.scala new file mode 100644 index 0000000000..cfa8a820dc --- /dev/null +++ b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/ActiveActiveBaseSpec.scala @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +package akka.persistence.typed + +import java.util.concurrent.atomic.AtomicInteger + +import akka.actor.testkit.typed.scaladsl.{ LogCapturing, ScalaTestWithActorTestKit } +import akka.persistence.testkit.{ PersistenceTestKitPlugin, PersistenceTestKitSnapshotPlugin } +import org.scalatest.concurrent.Eventually +import org.scalatest.wordspec.AnyWordSpecLike + +object ActiveActiveBaseSpec { + val R1 = ReplicaId("R1") + val R2 = ReplicaId("R2") + val AllReplicas = Set(R1, R2) +} + +abstract class ActiveActiveBaseSpec + extends ScalaTestWithActorTestKit( + PersistenceTestKitPlugin.config.withFallback(PersistenceTestKitSnapshotPlugin.config)) + with AnyWordSpecLike + with LogCapturing + with Eventually { + + val ids = new AtomicInteger(0) + def nextEntityId: String = s"e-${ids.getAndIncrement()}" + +} diff --git a/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/CounterSpec.scala b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/CounterSpec.scala new file mode 100644 index 0000000000..6393784eed --- /dev/null +++ b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/CounterSpec.scala @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2017-2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt + +import akka.actor.typed.ActorRef +import akka.actor.typed.scaladsl.Behaviors +import akka.persistence.testkit.query.scaladsl.PersistenceTestKitReadJournal +import akka.persistence.typed.crdt.CounterSpec.PlainCounter.{ Decrement, Get, Increment } +import akka.persistence.typed.scaladsl.{ ActiveActiveEventSourcing, Effect, EventSourcedBehavior } +import akka.persistence.typed.{ ActiveActiveBaseSpec, ReplicaId } + +object CounterSpec { + + object PlainCounter { + sealed trait Command + case class Get(reply: ActorRef[Long]) extends Command + case object Increment extends Command + case object Decrement extends Command + } + + import ActiveActiveBaseSpec._ + + def apply( + entityId: String, + replicaId: ReplicaId, + snapshotEvery: Long = 100, + eventProbe: Option[ActorRef[Counter.Updated]] = None) = + Behaviors.setup[PlainCounter.Command] { context => + ActiveActiveEventSourcing.withSharedJournal( + entityId, + replicaId, + AllReplicas, + PersistenceTestKitReadJournal.Identifier) { ctx => + EventSourcedBehavior[PlainCounter.Command, Counter.Updated, Counter]( + ctx.persistenceId, + Counter.empty, + (state, command) => + command match { + case PlainCounter.Increment => + context.log.info("Increment. Current state {}", state.value) + Effect.persist(Counter.Updated(1)) + case PlainCounter.Decrement => + Effect.persist(Counter.Updated(-1)) + case Get(replyTo) => + context.log.info("Get request. {} {}", state.value, state.value.longValue()) + replyTo ! state.value.longValue() + Effect.none + }, + (counter, event) => { + eventProbe.foreach(_ ! event) + counter.applyOperation(event) + }).snapshotWhen { (_, _, seqNr) => + seqNr % snapshotEvery == 0 + } + } + } +} + +class CounterSpec extends ActiveActiveBaseSpec { + + import CounterSpec._ + import ActiveActiveBaseSpec._ + + "Active active entity using CRDT counter" should { + "replicate" in { + val id = nextEntityId + val r1 = spawn(apply(id, R1)) + val r2 = spawn(apply(id, R2)) + val r1Probe = createTestProbe[Long]() + val r2Probe = createTestProbe[Long]() + + r1 ! Increment + r1 ! Increment + + eventually { + r1 ! Get(r1Probe.ref) + r1Probe.expectMessage(2L) + r2 ! Get(r2Probe.ref) + r2Probe.expectMessage(2L) + } + + for (n <- 1 to 10) { + if (n % 2 == 0) r1 ! Increment + else r1 ! Decrement + } + for (_ <- 1 to 10) { + r2 ! Increment + } + + eventually { + r1 ! Get(r1Probe.ref) + r1Probe.expectMessage(12L) + r2 ! Get(r2Probe.ref) + r2Probe.expectMessage(12L) + } + } + } + + "recover from snapshot" in { + val id = nextEntityId + + { + val r1 = spawn(apply(id, R1, 2)) + val r2 = spawn(apply(id, R2, 2)) + val r1Probe = createTestProbe[Long]() + val r2Probe = createTestProbe[Long]() + + r1 ! Increment + r1 ! Increment + + eventually { + r1 ! Get(r1Probe.ref) + r1Probe.expectMessage(2L) + r2 ! Get(r2Probe.ref) + r2Probe.expectMessage(2L) + } + } + { + val r2EventProbe = createTestProbe[Counter.Updated]() + val r2 = spawn(apply(id, R2, 2, Some(r2EventProbe.ref))) + val r2Probe = createTestProbe[Long]() + eventually { + r2 ! Get(r2Probe.ref) + r2Probe.expectMessage(2L) + } + + r2EventProbe.expectNoMessage() + } + } +} diff --git a/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/LwwSpec.scala b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/LwwSpec.scala new file mode 100644 index 0000000000..8c0718b39a --- /dev/null +++ b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/LwwSpec.scala @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt + +import akka.actor.typed.{ ActorRef, Behavior } +import akka.persistence.testkit.query.scaladsl.PersistenceTestKitReadJournal +import akka.persistence.typed.scaladsl.{ ActiveActiveEventSourcing, Effect, EventSourcedBehavior } +import akka.persistence.typed.{ ActiveActiveBaseSpec, ReplicaId } +import akka.serialization.jackson.CborSerializable + +object LwwSpec { + + import ActiveActiveBaseSpec._ + + sealed trait Command + final case class Update(item: String, timestamp: Long, error: ActorRef[String]) extends Command + final case class Get(replyTo: ActorRef[Registry]) extends Command + + sealed trait Event extends CborSerializable + final case class Changed(item: String, timestamp: LwwTime) extends Event + + final case class Registry(item: String, updatedTimestamp: LwwTime) extends CborSerializable + + object LwwRegistry { + + def apply(entityId: String, replica: ReplicaId): Behavior[Command] = { + ActiveActiveEventSourcing.withSharedJournal( + entityId, + replica, + AllReplicas, + PersistenceTestKitReadJournal.Identifier) { aaContext => + EventSourcedBehavior[Command, Event, Registry]( + aaContext.persistenceId, + Registry("", LwwTime(Long.MinValue, aaContext.replicaId)), + (state, command) => + command match { + case Update(s, timestmap, error) => + if (s == "") { + error ! "bad value" + Effect.none + } else { + Effect.persist(Changed(s, state.updatedTimestamp.increase(timestmap, aaContext.replicaId))) + } + case Get(replyTo) => + replyTo ! state + Effect.none + }, + (state, event) => + event match { + case Changed(s, timestamp) => + if (timestamp.isAfter(state.updatedTimestamp)) Registry(s, timestamp) + else state + }) + } + } + + } +} + +class LwwSpec extends ActiveActiveBaseSpec { + import LwwSpec._ + import ActiveActiveBaseSpec._ + + class Setup { + val entityId = nextEntityId + val r1 = spawn(LwwRegistry.apply(entityId, R1)) + val r2 = spawn(LwwRegistry.apply(entityId, R2)) + val r1Probe = createTestProbe[String]() + val r2Probe = createTestProbe[String]() + val r1GetProbe = createTestProbe[Registry]() + val r2GetProbe = createTestProbe[Registry]() + } + + "Lww Active Active Event Sourced Behavior" should { + "replicate a single event" in new Setup { + r1 ! Update("a1", 1L, r1Probe.ref) + eventually { + val probe = createTestProbe[Registry]() + r2 ! Get(probe.ref) + probe.expectMessage(Registry("a1", LwwTime(1L, R1))) + } + } + + "resolve conflict" in new Setup { + r1 ! Update("a1", 1L, r1Probe.ref) + r2 ! Update("b1", 2L, r2Probe.ref) + eventually { + r1 ! Get(r1GetProbe.ref) + r2 ! Get(r2GetProbe.ref) + r1GetProbe.expectMessage(Registry("b1", LwwTime(2L, R2))) + r2GetProbe.expectMessage(Registry("b1", LwwTime(2L, R2))) + } + } + + "have deterministic tiebreak when the same time" in new Setup { + r1 ! Update("a1", 1L, r1Probe.ref) + r2 ! Update("b1", 1L, r2Probe.ref) + // R1 < R2 + eventually { + r1 ! Get(r1GetProbe.ref) + r2 ! Get(r2GetProbe.ref) + r1GetProbe.expectMessage(Registry("a1", LwwTime(1L, R1))) + r2GetProbe.expectMessage(Registry("a1", LwwTime(1L, R1))) + } + } + } + +} diff --git a/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/ORSetSpec.scala b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/ORSetSpec.scala new file mode 100644 index 0000000000..ce65f0b9da --- /dev/null +++ b/akka-persistence-typed-tests/src/test/scala/akka/persistence/typed/crdt/ORSetSpec.scala @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2017-2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt + +import akka.actor.typed.{ ActorRef, Behavior } +import akka.persistence.testkit.query.scaladsl.PersistenceTestKitReadJournal +import akka.persistence.typed.scaladsl.{ ActiveActiveEventSourcing, Effect, EventSourcedBehavior } +import akka.persistence.typed.{ ActiveActiveBaseSpec, ReplicaId } +import ORSetSpec.ORSetEntity._ +import akka.persistence.typed.ActiveActiveBaseSpec.{ R1, R2 } +import akka.persistence.typed.crdt.ORSetSpec.ORSetEntity + +import scala.util.Random + +object ORSetSpec { + + import ActiveActiveBaseSpec._ + + object ORSetEntity { + sealed trait Command + final case class Get(replyTo: ActorRef[Set[String]]) extends Command + final case class Add(elem: String) extends Command + final case class AddAll(elems: Set[String]) extends Command + final case class Remove(elem: String) extends Command + + def apply(entityId: String, replica: ReplicaId): Behavior[ORSetEntity.Command] = { + + ActiveActiveEventSourcing.withSharedJournal( + entityId, + replica, + AllReplicas, + PersistenceTestKitReadJournal.Identifier) { aaContext => + EventSourcedBehavior[Command, ORSet.DeltaOp, ORSet[String]]( + aaContext.persistenceId, + ORSet(replica), + (state, command) => + command match { + case Add(elem) => + Effect.persist(state + elem) + case AddAll(elems) => + Effect.persist(state.addAll(elems.toSet)) + case Remove(elem) => + Effect.persist(state - elem) + case Get(replyTo) => + Effect.none.thenRun(state => replyTo ! state.elements) + + }, + (state, operation) => state.applyOperation(operation)) + } + } + } + +} + +class ORSetSpec extends ActiveActiveBaseSpec { + + class Setup { + val entityId = nextEntityId + val r1 = spawn(ORSetEntity.apply(entityId, R1)) + val r2 = spawn(ORSetEntity.apply(entityId, R2)) + val r1GetProbe = createTestProbe[Set[String]]() + val r2GetProbe = createTestProbe[Set[String]]() + + def assertForAllReplicas(state: Set[String]): Unit = { + eventually { + r1 ! Get(r1GetProbe.ref) + r1GetProbe.expectMessage(state) + r2 ! Get(r2GetProbe.ref) + r2GetProbe.expectMessage(state) + } + } + } + + def randomDelay(): Unit = { + // exercise different timing scenarios + Thread.sleep(Random.nextInt(200).toLong) + } + + "ORSet Active Active Entity" should { + + "support concurrent updates" in new Setup { + r1 ! Add("a1") + r2 ! Add("b1") + assertForAllReplicas(Set("a1", "b1")) + r2 ! Remove("b1") + assertForAllReplicas(Set("a1")) + r2 ! Add("b1") + for (n <- 2 to 10) { + r1 ! Add(s"a$n") + if (n % 3 == 0) + randomDelay() + r2 ! Add(s"b$n") + } + r1 ! AddAll((11 to 13).map(n => s"a$n").toSet) + r2 ! AddAll((11 to 13).map(n => s"b$n").toSet) + val expected = (1 to 13).flatMap(n => List(s"a$n", s"b$n")).toSet + assertForAllReplicas(expected) + } + } +} diff --git a/akka-persistence-typed-tests/src/test/scala/docs/akka/persistence/typed/AABlogExampleSpec.scala b/akka-persistence-typed-tests/src/test/scala/docs/akka/persistence/typed/AABlogExampleSpec.scala index 6c297f4ea1..f67fd19226 100644 --- a/akka-persistence-typed-tests/src/test/scala/docs/akka/persistence/typed/AABlogExampleSpec.scala +++ b/akka-persistence-typed-tests/src/test/scala/docs/akka/persistence/typed/AABlogExampleSpec.scala @@ -11,6 +11,7 @@ import akka.actor.typed.scaladsl.{ ActorContext, Behaviors } import akka.persistence.testkit.PersistenceTestKitPlugin import akka.persistence.testkit.query.scaladsl.PersistenceTestKitReadJournal import akka.persistence.typed.ReplicaId +import akka.persistence.typed.crdt.LwwTime import akka.persistence.typed.scaladsl._ import akka.serialization.jackson.CborSerializable import org.scalatest.concurrent.{ Eventually, ScalaFutures } diff --git a/akka-persistence-typed/src/main/java/akka/persistence/typed/serialization/Crdts.java b/akka-persistence-typed/src/main/java/akka/persistence/typed/serialization/Crdts.java new file mode 100644 index 0000000000..dad9330ab0 --- /dev/null +++ b/akka-persistence-typed/src/main/java/akka/persistence/typed/serialization/Crdts.java @@ -0,0 +1,6665 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Crdts.proto + +package akka.persistence.typed.serialization; + +public final class Crdts { + private Crdts() {} + + public static void registerAllExtensions( + akka.protobufv3.internal.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(akka.protobufv3.internal.ExtensionRegistry registry) { + registerAllExtensions((akka.protobufv3.internal.ExtensionRegistryLite) registry); + } + /** Protobuf enum {@code ORSetDeltaOp} */ + public enum ORSetDeltaOp implements akka.protobufv3.internal.ProtocolMessageEnum { + /** Add = 0; */ + Add(0), + /** Remove = 1; */ + Remove(1), + /** Full = 2; */ + Full(2), + ; + + /** Add = 0; */ + public static final int Add_VALUE = 0; + /** Remove = 1; */ + public static final int Remove_VALUE = 1; + /** Full = 2; */ + public static final int Full_VALUE = 2; + + public final int getNumber() { + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ORSetDeltaOp valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ORSetDeltaOp forNumber(int value) { + switch (value) { + case 0: + return Add; + case 1: + return Remove; + case 2: + return Full; + default: + return null; + } + } + + public static akka.protobufv3.internal.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final akka.protobufv3.internal.Internal.EnumLiteMap + internalValueMap = + new akka.protobufv3.internal.Internal.EnumLiteMap() { + public ORSetDeltaOp findValueByNumber(int number) { + return ORSetDeltaOp.forNumber(number); + } + }; + + public final akka.protobufv3.internal.Descriptors.EnumValueDescriptor getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + + public final akka.protobufv3.internal.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final akka.protobufv3.internal.Descriptors.EnumDescriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.getDescriptor().getEnumTypes().get(0); + } + + private static final ORSetDeltaOp[] VALUES = values(); + + public static ORSetDeltaOp valueOf( + akka.protobufv3.internal.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ORSetDeltaOp(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:ORSetDeltaOp) + } + + public interface CounterOrBuilder + extends + // @@protoc_insertion_point(interface_extends:Counter) + akka.protobufv3.internal.MessageOrBuilder { + + /** + * required bytes value = 1; + * + * @return Whether the value field is set. + */ + boolean hasValue(); + /** + * required bytes value = 1; + * + * @return The value. + */ + akka.protobufv3.internal.ByteString getValue(); + } + /** Protobuf type {@code Counter} */ + public static final class Counter extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:Counter) + CounterOrBuilder { + private static final long serialVersionUID = 0L; + // Use Counter.newBuilder() to construct. + private Counter(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Counter() { + value_ = akka.protobufv3.internal.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new Counter(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Counter( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + bitField0_ |= 0x00000001; + value_ = input.readBytes(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_Counter_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts.internal_static_Counter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.Counter.class, + akka.persistence.typed.serialization.Crdts.Counter.Builder.class); + } + + private int bitField0_; + public static final int VALUE_FIELD_NUMBER = 1; + private akka.protobufv3.internal.ByteString value_; + /** + * required bytes value = 1; + * + * @return Whether the value field is set. + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required bytes value = 1; + * + * @return The value. + */ + public akka.protobufv3.internal.ByteString getValue() { + return value_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasValue()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeBytes(1, value_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += akka.protobufv3.internal.CodedOutputStream.computeBytesSize(1, value_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.Counter)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.Counter other = + (akka.persistence.typed.serialization.Crdts.Counter) obj; + + if (hasValue() != other.hasValue()) return false; + if (hasValue()) { + if (!getValue().equals(other.getValue())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasValue()) { + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + java.nio.ByteBuffer data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom(byte[] data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseDelimitedFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.Counter parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(akka.persistence.typed.serialization.Crdts.Counter prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code Counter} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:Counter) + akka.persistence.typed.serialization.Crdts.CounterOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_Counter_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts.internal_static_Counter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.Counter.class, + akka.persistence.typed.serialization.Crdts.Counter.Builder.class); + } + + // Construct using akka.persistence.typed.serialization.Crdts.Counter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + value_ = akka.protobufv3.internal.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts.internal_static_Counter_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.Counter getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.Counter.getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.Counter build() { + akka.persistence.typed.serialization.Crdts.Counter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.Counter buildPartial() { + akka.persistence.typed.serialization.Crdts.Counter result = + new akka.persistence.typed.serialization.Crdts.Counter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + to_bitField0_ |= 0x00000001; + } + result.value_ = value_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.Counter) { + return mergeFrom((akka.persistence.typed.serialization.Crdts.Counter) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.persistence.typed.serialization.Crdts.Counter other) { + if (other == akka.persistence.typed.serialization.Crdts.Counter.getDefaultInstance()) + return this; + if (other.hasValue()) { + setValue(other.getValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasValue()) { + return false; + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.Counter parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.Counter) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private akka.protobufv3.internal.ByteString value_ = + akka.protobufv3.internal.ByteString.EMPTY; + /** + * required bytes value = 1; + * + * @return Whether the value field is set. + */ + public boolean hasValue() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required bytes value = 1; + * + * @return The value. + */ + public akka.protobufv3.internal.ByteString getValue() { + return value_; + } + /** + * required bytes value = 1; + * + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(akka.protobufv3.internal.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + value_ = value; + onChanged(); + return this; + } + /** + * required bytes value = 1; + * + * @return This builder for chaining. + */ + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000001); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:Counter) + } + + // @@protoc_insertion_point(class_scope:Counter) + private static final akka.persistence.typed.serialization.Crdts.Counter DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.Counter(); + } + + public static akka.persistence.typed.serialization.Crdts.Counter getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public Counter parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new Counter(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.Counter getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface CounterUpdateOrBuilder + extends + // @@protoc_insertion_point(interface_extends:CounterUpdate) + akka.protobufv3.internal.MessageOrBuilder { + + /** + * required bytes delta = 1; + * + * @return Whether the delta field is set. + */ + boolean hasDelta(); + /** + * required bytes delta = 1; + * + * @return The delta. + */ + akka.protobufv3.internal.ByteString getDelta(); + } + /** Protobuf type {@code CounterUpdate} */ + public static final class CounterUpdate extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:CounterUpdate) + CounterUpdateOrBuilder { + private static final long serialVersionUID = 0L; + // Use CounterUpdate.newBuilder() to construct. + private CounterUpdate(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CounterUpdate() { + delta_ = akka.protobufv3.internal.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new CounterUpdate(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CounterUpdate( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + bitField0_ |= 0x00000001; + delta_ = input.readBytes(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_CounterUpdate_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_CounterUpdate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.CounterUpdate.class, + akka.persistence.typed.serialization.Crdts.CounterUpdate.Builder.class); + } + + private int bitField0_; + public static final int DELTA_FIELD_NUMBER = 1; + private akka.protobufv3.internal.ByteString delta_; + /** + * required bytes delta = 1; + * + * @return Whether the delta field is set. + */ + public boolean hasDelta() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required bytes delta = 1; + * + * @return The delta. + */ + public akka.protobufv3.internal.ByteString getDelta() { + return delta_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasDelta()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeBytes(1, delta_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += akka.protobufv3.internal.CodedOutputStream.computeBytesSize(1, delta_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.CounterUpdate)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.CounterUpdate other = + (akka.persistence.typed.serialization.Crdts.CounterUpdate) obj; + + if (hasDelta() != other.hasDelta()) return false; + if (hasDelta()) { + if (!getDelta().equals(other.getDelta())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasDelta()) { + hash = (37 * hash) + DELTA_FIELD_NUMBER; + hash = (53 * hash) + getDelta().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + java.nio.ByteBuffer data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom(byte[] data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseDelimitedFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + akka.persistence.typed.serialization.Crdts.CounterUpdate prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code CounterUpdate} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:CounterUpdate) + akka.persistence.typed.serialization.Crdts.CounterUpdateOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_CounterUpdate_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_CounterUpdate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.CounterUpdate.class, + akka.persistence.typed.serialization.Crdts.CounterUpdate.Builder.class); + } + + // Construct using akka.persistence.typed.serialization.Crdts.CounterUpdate.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + delta_ = akka.protobufv3.internal.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts.internal_static_CounterUpdate_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.CounterUpdate getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.CounterUpdate.getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.CounterUpdate build() { + akka.persistence.typed.serialization.Crdts.CounterUpdate result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.CounterUpdate buildPartial() { + akka.persistence.typed.serialization.Crdts.CounterUpdate result = + new akka.persistence.typed.serialization.Crdts.CounterUpdate(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + to_bitField0_ |= 0x00000001; + } + result.delta_ = delta_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.CounterUpdate) { + return mergeFrom((akka.persistence.typed.serialization.Crdts.CounterUpdate) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.persistence.typed.serialization.Crdts.CounterUpdate other) { + if (other == akka.persistence.typed.serialization.Crdts.CounterUpdate.getDefaultInstance()) + return this; + if (other.hasDelta()) { + setDelta(other.getDelta()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasDelta()) { + return false; + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.CounterUpdate parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.CounterUpdate) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private akka.protobufv3.internal.ByteString delta_ = + akka.protobufv3.internal.ByteString.EMPTY; + /** + * required bytes delta = 1; + * + * @return Whether the delta field is set. + */ + public boolean hasDelta() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required bytes delta = 1; + * + * @return The delta. + */ + public akka.protobufv3.internal.ByteString getDelta() { + return delta_; + } + /** + * required bytes delta = 1; + * + * @param value The delta to set. + * @return This builder for chaining. + */ + public Builder setDelta(akka.protobufv3.internal.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + delta_ = value; + onChanged(); + return this; + } + /** + * required bytes delta = 1; + * + * @return This builder for chaining. + */ + public Builder clearDelta() { + bitField0_ = (bitField0_ & ~0x00000001); + delta_ = getDefaultInstance().getDelta(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:CounterUpdate) + } + + // @@protoc_insertion_point(class_scope:CounterUpdate) + private static final akka.persistence.typed.serialization.Crdts.CounterUpdate DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.CounterUpdate(); + } + + public static akka.persistence.typed.serialization.Crdts.CounterUpdate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public CounterUpdate parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new CounterUpdate(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.CounterUpdate getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ORSetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:ORSet) + akka.protobufv3.internal.MessageOrBuilder { + + /** + * required string originDc = 1; + * + * @return Whether the originDc field is set. + */ + boolean hasOriginDc(); + /** + * required string originDc = 1; + * + * @return The originDc. + */ + java.lang.String getOriginDc(); + /** + * required string originDc = 1; + * + * @return The bytes for originDc. + */ + akka.protobufv3.internal.ByteString getOriginDcBytes(); + + /** + * required .VersionVector vvector = 2; + * + * @return Whether the vvector field is set. + */ + boolean hasVvector(); + /** + * required .VersionVector vvector = 2; + * + * @return The vvector. + */ + akka.persistence.typed.serialization.Crdts.VersionVector getVvector(); + /** required .VersionVector vvector = 2; */ + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder getVvectorOrBuilder(); + + /** repeated .VersionVector dots = 3; */ + java.util.List getDotsList(); + /** repeated .VersionVector dots = 3; */ + akka.persistence.typed.serialization.Crdts.VersionVector getDots(int index); + /** repeated .VersionVector dots = 3; */ + int getDotsCount(); + /** repeated .VersionVector dots = 3; */ + java.util.List + getDotsOrBuilderList(); + /** repeated .VersionVector dots = 3; */ + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder getDotsOrBuilder(int index); + + /** + * repeated string stringElements = 4; + * + * @return A list containing the stringElements. + */ + java.util.List getStringElementsList(); + /** + * repeated string stringElements = 4; + * + * @return The count of stringElements. + */ + int getStringElementsCount(); + /** + * repeated string stringElements = 4; + * + * @param index The index of the element to return. + * @return The stringElements at the given index. + */ + java.lang.String getStringElements(int index); + /** + * repeated string stringElements = 4; + * + * @param index The index of the value to return. + * @return The bytes of the stringElements at the given index. + */ + akka.protobufv3.internal.ByteString getStringElementsBytes(int index); + + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return A list containing the intElements. + */ + java.util.List getIntElementsList(); + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return The count of intElements. + */ + int getIntElementsCount(); + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @param index The index of the element to return. + * @return The intElements at the given index. + */ + int getIntElements(int index); + + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return A list containing the longElements. + */ + java.util.List getLongElementsList(); + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return The count of longElements. + */ + int getLongElementsCount(); + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @param index The index of the element to return. + * @return The longElements at the given index. + */ + long getLongElements(int index); + + /** repeated .Payload otherElements = 7; */ + java.util.List getOtherElementsList(); + /** repeated .Payload otherElements = 7; */ + akka.remote.ContainerFormats.Payload getOtherElements(int index); + /** repeated .Payload otherElements = 7; */ + int getOtherElementsCount(); + /** repeated .Payload otherElements = 7; */ + java.util.List + getOtherElementsOrBuilderList(); + /** repeated .Payload otherElements = 7; */ + akka.remote.ContainerFormats.PayloadOrBuilder getOtherElementsOrBuilder(int index); + } + /** Protobuf type {@code ORSet} */ + public static final class ORSet extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:ORSet) + ORSetOrBuilder { + private static final long serialVersionUID = 0L; + // Use ORSet.newBuilder() to construct. + private ORSet(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ORSet() { + originDc_ = ""; + dots_ = java.util.Collections.emptyList(); + stringElements_ = akka.protobufv3.internal.LazyStringArrayList.EMPTY; + intElements_ = emptyIntList(); + longElements_ = emptyLongList(); + otherElements_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new ORSet(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ORSet( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + akka.protobufv3.internal.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000001; + originDc_ = bs; + break; + } + case 18: + { + akka.persistence.typed.serialization.Crdts.VersionVector.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) != 0)) { + subBuilder = vvector_.toBuilder(); + } + vvector_ = + input.readMessage( + akka.persistence.typed.serialization.Crdts.VersionVector.PARSER, + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(vvector_); + vvector_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000002; + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + dots_ = + new java.util.ArrayList< + akka.persistence.typed.serialization.Crdts.VersionVector>(); + mutable_bitField0_ |= 0x00000004; + } + dots_.add( + input.readMessage( + akka.persistence.typed.serialization.Crdts.VersionVector.PARSER, + extensionRegistry)); + break; + } + case 34: + { + akka.protobufv3.internal.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + stringElements_ = new akka.protobufv3.internal.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000008; + } + stringElements_.add(bs); + break; + } + case 40: + { + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + intElements_ = newIntList(); + mutable_bitField0_ |= 0x00000010; + } + intElements_.addInt(input.readSInt32()); + break; + } + case 42: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000010) != 0) && input.getBytesUntilLimit() > 0) { + intElements_ = newIntList(); + mutable_bitField0_ |= 0x00000010; + } + while (input.getBytesUntilLimit() > 0) { + intElements_.addInt(input.readSInt32()); + } + input.popLimit(limit); + break; + } + case 48: + { + if (!((mutable_bitField0_ & 0x00000020) != 0)) { + longElements_ = newLongList(); + mutable_bitField0_ |= 0x00000020; + } + longElements_.addLong(input.readSInt64()); + break; + } + case 50: + { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000020) != 0) && input.getBytesUntilLimit() > 0) { + longElements_ = newLongList(); + mutable_bitField0_ |= 0x00000020; + } + while (input.getBytesUntilLimit() > 0) { + longElements_.addLong(input.readSInt64()); + } + input.popLimit(limit); + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000040) != 0)) { + otherElements_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000040; + } + otherElements_.add( + input.readMessage( + akka.remote.ContainerFormats.Payload.PARSER, extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) != 0)) { + dots_ = java.util.Collections.unmodifiableList(dots_); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + stringElements_ = stringElements_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000010) != 0)) { + intElements_.makeImmutable(); // C + } + if (((mutable_bitField0_ & 0x00000020) != 0)) { + longElements_.makeImmutable(); // C + } + if (((mutable_bitField0_ & 0x00000040) != 0)) { + otherElements_ = java.util.Collections.unmodifiableList(otherElements_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_ORSet_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts.internal_static_ORSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.ORSet.class, + akka.persistence.typed.serialization.Crdts.ORSet.Builder.class); + } + + private int bitField0_; + public static final int ORIGINDC_FIELD_NUMBER = 1; + private volatile java.lang.Object originDc_; + /** + * required string originDc = 1; + * + * @return Whether the originDc field is set. + */ + public boolean hasOriginDc() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string originDc = 1; + * + * @return The originDc. + */ + public java.lang.String getOriginDc() { + java.lang.Object ref = originDc_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + akka.protobufv3.internal.ByteString bs = (akka.protobufv3.internal.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + originDc_ = s; + } + return s; + } + } + /** + * required string originDc = 1; + * + * @return The bytes for originDc. + */ + public akka.protobufv3.internal.ByteString getOriginDcBytes() { + java.lang.Object ref = originDc_; + if (ref instanceof java.lang.String) { + akka.protobufv3.internal.ByteString b = + akka.protobufv3.internal.ByteString.copyFromUtf8((java.lang.String) ref); + originDc_ = b; + return b; + } else { + return (akka.protobufv3.internal.ByteString) ref; + } + } + + public static final int VVECTOR_FIELD_NUMBER = 2; + private akka.persistence.typed.serialization.Crdts.VersionVector vvector_; + /** + * required .VersionVector vvector = 2; + * + * @return Whether the vvector field is set. + */ + public boolean hasVvector() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required .VersionVector vvector = 2; + * + * @return The vvector. + */ + public akka.persistence.typed.serialization.Crdts.VersionVector getVvector() { + return vvector_ == null + ? akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance() + : vvector_; + } + /** required .VersionVector vvector = 2; */ + public akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder getVvectorOrBuilder() { + return vvector_ == null + ? akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance() + : vvector_; + } + + public static final int DOTS_FIELD_NUMBER = 3; + private java.util.List dots_; + /** repeated .VersionVector dots = 3; */ + public java.util.List getDotsList() { + return dots_; + } + /** repeated .VersionVector dots = 3; */ + public java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder> + getDotsOrBuilderList() { + return dots_; + } + /** repeated .VersionVector dots = 3; */ + public int getDotsCount() { + return dots_.size(); + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVector getDots(int index) { + return dots_.get(index); + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder getDotsOrBuilder( + int index) { + return dots_.get(index); + } + + public static final int STRINGELEMENTS_FIELD_NUMBER = 4; + private akka.protobufv3.internal.LazyStringList stringElements_; + /** + * repeated string stringElements = 4; + * + * @return A list containing the stringElements. + */ + public akka.protobufv3.internal.ProtocolStringList getStringElementsList() { + return stringElements_; + } + /** + * repeated string stringElements = 4; + * + * @return The count of stringElements. + */ + public int getStringElementsCount() { + return stringElements_.size(); + } + /** + * repeated string stringElements = 4; + * + * @param index The index of the element to return. + * @return The stringElements at the given index. + */ + public java.lang.String getStringElements(int index) { + return stringElements_.get(index); + } + /** + * repeated string stringElements = 4; + * + * @param index The index of the value to return. + * @return The bytes of the stringElements at the given index. + */ + public akka.protobufv3.internal.ByteString getStringElementsBytes(int index) { + return stringElements_.getByteString(index); + } + + public static final int INTELEMENTS_FIELD_NUMBER = 5; + private akka.protobufv3.internal.Internal.IntList intElements_; + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return A list containing the intElements. + */ + public java.util.List getIntElementsList() { + return intElements_; + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return The count of intElements. + */ + public int getIntElementsCount() { + return intElements_.size(); + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @param index The index of the element to return. + * @return The intElements at the given index. + */ + public int getIntElements(int index) { + return intElements_.getInt(index); + } + + private int intElementsMemoizedSerializedSize = -1; + + public static final int LONGELEMENTS_FIELD_NUMBER = 6; + private akka.protobufv3.internal.Internal.LongList longElements_; + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return A list containing the longElements. + */ + public java.util.List getLongElementsList() { + return longElements_; + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return The count of longElements. + */ + public int getLongElementsCount() { + return longElements_.size(); + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @param index The index of the element to return. + * @return The longElements at the given index. + */ + public long getLongElements(int index) { + return longElements_.getLong(index); + } + + private int longElementsMemoizedSerializedSize = -1; + + public static final int OTHERELEMENTS_FIELD_NUMBER = 7; + private java.util.List otherElements_; + /** repeated .Payload otherElements = 7; */ + public java.util.List getOtherElementsList() { + return otherElements_; + } + /** repeated .Payload otherElements = 7; */ + public java.util.List + getOtherElementsOrBuilderList() { + return otherElements_; + } + /** repeated .Payload otherElements = 7; */ + public int getOtherElementsCount() { + return otherElements_.size(); + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.Payload getOtherElements(int index) { + return otherElements_.get(index); + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.PayloadOrBuilder getOtherElementsOrBuilder(int index) { + return otherElements_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasOriginDc()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasVvector()) { + memoizedIsInitialized = 0; + return false; + } + if (!getVvector().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getDotsCount(); i++) { + if (!getDots(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getOtherElementsCount(); i++) { + if (!getOtherElements(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) != 0)) { + akka.protobufv3.internal.GeneratedMessageV3.writeString(output, 1, originDc_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getVvector()); + } + for (int i = 0; i < dots_.size(); i++) { + output.writeMessage(3, dots_.get(i)); + } + for (int i = 0; i < stringElements_.size(); i++) { + akka.protobufv3.internal.GeneratedMessageV3.writeString( + output, 4, stringElements_.getRaw(i)); + } + if (getIntElementsList().size() > 0) { + output.writeUInt32NoTag(42); + output.writeUInt32NoTag(intElementsMemoizedSerializedSize); + } + for (int i = 0; i < intElements_.size(); i++) { + output.writeSInt32NoTag(intElements_.getInt(i)); + } + if (getLongElementsList().size() > 0) { + output.writeUInt32NoTag(50); + output.writeUInt32NoTag(longElementsMemoizedSerializedSize); + } + for (int i = 0; i < longElements_.size(); i++) { + output.writeSInt64NoTag(longElements_.getLong(i)); + } + for (int i = 0; i < otherElements_.size(); i++) { + output.writeMessage(7, otherElements_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += akka.protobufv3.internal.GeneratedMessageV3.computeStringSize(1, originDc_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += akka.protobufv3.internal.CodedOutputStream.computeMessageSize(2, getVvector()); + } + for (int i = 0; i < dots_.size(); i++) { + size += akka.protobufv3.internal.CodedOutputStream.computeMessageSize(3, dots_.get(i)); + } + { + int dataSize = 0; + for (int i = 0; i < stringElements_.size(); i++) { + dataSize += computeStringSizeNoTag(stringElements_.getRaw(i)); + } + size += dataSize; + size += 1 * getStringElementsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < intElements_.size(); i++) { + dataSize += + akka.protobufv3.internal.CodedOutputStream.computeSInt32SizeNoTag( + intElements_.getInt(i)); + } + size += dataSize; + if (!getIntElementsList().isEmpty()) { + size += 1; + size += akka.protobufv3.internal.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + intElementsMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + for (int i = 0; i < longElements_.size(); i++) { + dataSize += + akka.protobufv3.internal.CodedOutputStream.computeSInt64SizeNoTag( + longElements_.getLong(i)); + } + size += dataSize; + if (!getLongElementsList().isEmpty()) { + size += 1; + size += akka.protobufv3.internal.CodedOutputStream.computeInt32SizeNoTag(dataSize); + } + longElementsMemoizedSerializedSize = dataSize; + } + for (int i = 0; i < otherElements_.size(); i++) { + size += + akka.protobufv3.internal.CodedOutputStream.computeMessageSize(7, otherElements_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.ORSet)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.ORSet other = + (akka.persistence.typed.serialization.Crdts.ORSet) obj; + + if (hasOriginDc() != other.hasOriginDc()) return false; + if (hasOriginDc()) { + if (!getOriginDc().equals(other.getOriginDc())) return false; + } + if (hasVvector() != other.hasVvector()) return false; + if (hasVvector()) { + if (!getVvector().equals(other.getVvector())) return false; + } + if (!getDotsList().equals(other.getDotsList())) return false; + if (!getStringElementsList().equals(other.getStringElementsList())) return false; + if (!getIntElementsList().equals(other.getIntElementsList())) return false; + if (!getLongElementsList().equals(other.getLongElementsList())) return false; + if (!getOtherElementsList().equals(other.getOtherElementsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasOriginDc()) { + hash = (37 * hash) + ORIGINDC_FIELD_NUMBER; + hash = (53 * hash) + getOriginDc().hashCode(); + } + if (hasVvector()) { + hash = (37 * hash) + VVECTOR_FIELD_NUMBER; + hash = (53 * hash) + getVvector().hashCode(); + } + if (getDotsCount() > 0) { + hash = (37 * hash) + DOTS_FIELD_NUMBER; + hash = (53 * hash) + getDotsList().hashCode(); + } + if (getStringElementsCount() > 0) { + hash = (37 * hash) + STRINGELEMENTS_FIELD_NUMBER; + hash = (53 * hash) + getStringElementsList().hashCode(); + } + if (getIntElementsCount() > 0) { + hash = (37 * hash) + INTELEMENTS_FIELD_NUMBER; + hash = (53 * hash) + getIntElementsList().hashCode(); + } + if (getLongElementsCount() > 0) { + hash = (37 * hash) + LONGELEMENTS_FIELD_NUMBER; + hash = (53 * hash) + getLongElementsList().hashCode(); + } + if (getOtherElementsCount() > 0) { + hash = (37 * hash) + OTHERELEMENTS_FIELD_NUMBER; + hash = (53 * hash) + getOtherElementsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + java.nio.ByteBuffer data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom(byte[] data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseDelimitedFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(akka.persistence.typed.serialization.Crdts.ORSet prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code ORSet} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:ORSet) + akka.persistence.typed.serialization.Crdts.ORSetOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_ORSet_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts.internal_static_ORSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.ORSet.class, + akka.persistence.typed.serialization.Crdts.ORSet.Builder.class); + } + + // Construct using akka.persistence.typed.serialization.Crdts.ORSet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) { + getVvectorFieldBuilder(); + getDotsFieldBuilder(); + getOtherElementsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + originDc_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (vvectorBuilder_ == null) { + vvector_ = null; + } else { + vvectorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (dotsBuilder_ == null) { + dots_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + dotsBuilder_.clear(); + } + stringElements_ = akka.protobufv3.internal.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + intElements_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000010); + longElements_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000020); + if (otherElementsBuilder_ == null) { + otherElements_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + } else { + otherElementsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts.internal_static_ORSet_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSet getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSet build() { + akka.persistence.typed.serialization.Crdts.ORSet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSet buildPartial() { + akka.persistence.typed.serialization.Crdts.ORSet result = + new akka.persistence.typed.serialization.Crdts.ORSet(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + to_bitField0_ |= 0x00000001; + } + result.originDc_ = originDc_; + if (((from_bitField0_ & 0x00000002) != 0)) { + if (vvectorBuilder_ == null) { + result.vvector_ = vvector_; + } else { + result.vvector_ = vvectorBuilder_.build(); + } + to_bitField0_ |= 0x00000002; + } + if (dotsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + dots_ = java.util.Collections.unmodifiableList(dots_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.dots_ = dots_; + } else { + result.dots_ = dotsBuilder_.build(); + } + if (((bitField0_ & 0x00000008) != 0)) { + stringElements_ = stringElements_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.stringElements_ = stringElements_; + if (((bitField0_ & 0x00000010) != 0)) { + intElements_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.intElements_ = intElements_; + if (((bitField0_ & 0x00000020) != 0)) { + longElements_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.longElements_ = longElements_; + if (otherElementsBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0)) { + otherElements_ = java.util.Collections.unmodifiableList(otherElements_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.otherElements_ = otherElements_; + } else { + result.otherElements_ = otherElementsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.ORSet) { + return mergeFrom((akka.persistence.typed.serialization.Crdts.ORSet) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.persistence.typed.serialization.Crdts.ORSet other) { + if (other == akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance()) + return this; + if (other.hasOriginDc()) { + bitField0_ |= 0x00000001; + originDc_ = other.originDc_; + onChanged(); + } + if (other.hasVvector()) { + mergeVvector(other.getVvector()); + } + if (dotsBuilder_ == null) { + if (!other.dots_.isEmpty()) { + if (dots_.isEmpty()) { + dots_ = other.dots_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureDotsIsMutable(); + dots_.addAll(other.dots_); + } + onChanged(); + } + } else { + if (!other.dots_.isEmpty()) { + if (dotsBuilder_.isEmpty()) { + dotsBuilder_.dispose(); + dotsBuilder_ = null; + dots_ = other.dots_; + bitField0_ = (bitField0_ & ~0x00000004); + dotsBuilder_ = + akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders + ? getDotsFieldBuilder() + : null; + } else { + dotsBuilder_.addAllMessages(other.dots_); + } + } + } + if (!other.stringElements_.isEmpty()) { + if (stringElements_.isEmpty()) { + stringElements_ = other.stringElements_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureStringElementsIsMutable(); + stringElements_.addAll(other.stringElements_); + } + onChanged(); + } + if (!other.intElements_.isEmpty()) { + if (intElements_.isEmpty()) { + intElements_ = other.intElements_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureIntElementsIsMutable(); + intElements_.addAll(other.intElements_); + } + onChanged(); + } + if (!other.longElements_.isEmpty()) { + if (longElements_.isEmpty()) { + longElements_ = other.longElements_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureLongElementsIsMutable(); + longElements_.addAll(other.longElements_); + } + onChanged(); + } + if (otherElementsBuilder_ == null) { + if (!other.otherElements_.isEmpty()) { + if (otherElements_.isEmpty()) { + otherElements_ = other.otherElements_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureOtherElementsIsMutable(); + otherElements_.addAll(other.otherElements_); + } + onChanged(); + } + } else { + if (!other.otherElements_.isEmpty()) { + if (otherElementsBuilder_.isEmpty()) { + otherElementsBuilder_.dispose(); + otherElementsBuilder_ = null; + otherElements_ = other.otherElements_; + bitField0_ = (bitField0_ & ~0x00000040); + otherElementsBuilder_ = + akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders + ? getOtherElementsFieldBuilder() + : null; + } else { + otherElementsBuilder_.addAllMessages(other.otherElements_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasOriginDc()) { + return false; + } + if (!hasVvector()) { + return false; + } + if (!getVvector().isInitialized()) { + return false; + } + for (int i = 0; i < getDotsCount(); i++) { + if (!getDots(i).isInitialized()) { + return false; + } + } + for (int i = 0; i < getOtherElementsCount(); i++) { + if (!getOtherElements(i).isInitialized()) { + return false; + } + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.ORSet parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.ORSet) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object originDc_ = ""; + /** + * required string originDc = 1; + * + * @return Whether the originDc field is set. + */ + public boolean hasOriginDc() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string originDc = 1; + * + * @return The originDc. + */ + public java.lang.String getOriginDc() { + java.lang.Object ref = originDc_; + if (!(ref instanceof java.lang.String)) { + akka.protobufv3.internal.ByteString bs = (akka.protobufv3.internal.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + originDc_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string originDc = 1; + * + * @return The bytes for originDc. + */ + public akka.protobufv3.internal.ByteString getOriginDcBytes() { + java.lang.Object ref = originDc_; + if (ref instanceof String) { + akka.protobufv3.internal.ByteString b = + akka.protobufv3.internal.ByteString.copyFromUtf8((java.lang.String) ref); + originDc_ = b; + return b; + } else { + return (akka.protobufv3.internal.ByteString) ref; + } + } + /** + * required string originDc = 1; + * + * @param value The originDc to set. + * @return This builder for chaining. + */ + public Builder setOriginDc(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + originDc_ = value; + onChanged(); + return this; + } + /** + * required string originDc = 1; + * + * @return This builder for chaining. + */ + public Builder clearOriginDc() { + bitField0_ = (bitField0_ & ~0x00000001); + originDc_ = getDefaultInstance().getOriginDc(); + onChanged(); + return this; + } + /** + * required string originDc = 1; + * + * @param value The bytes for originDc to set. + * @return This builder for chaining. + */ + public Builder setOriginDcBytes(akka.protobufv3.internal.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + originDc_ = value; + onChanged(); + return this; + } + + private akka.persistence.typed.serialization.Crdts.VersionVector vvector_; + private akka.protobufv3.internal.SingleFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder, + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder> + vvectorBuilder_; + /** + * required .VersionVector vvector = 2; + * + * @return Whether the vvector field is set. + */ + public boolean hasVvector() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required .VersionVector vvector = 2; + * + * @return The vvector. + */ + public akka.persistence.typed.serialization.Crdts.VersionVector getVvector() { + if (vvectorBuilder_ == null) { + return vvector_ == null + ? akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance() + : vvector_; + } else { + return vvectorBuilder_.getMessage(); + } + } + /** required .VersionVector vvector = 2; */ + public Builder setVvector(akka.persistence.typed.serialization.Crdts.VersionVector value) { + if (vvectorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + vvector_ = value; + onChanged(); + } else { + vvectorBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + /** required .VersionVector vvector = 2; */ + public Builder setVvector( + akka.persistence.typed.serialization.Crdts.VersionVector.Builder builderForValue) { + if (vvectorBuilder_ == null) { + vvector_ = builderForValue.build(); + onChanged(); + } else { + vvectorBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + /** required .VersionVector vvector = 2; */ + public Builder mergeVvector(akka.persistence.typed.serialization.Crdts.VersionVector value) { + if (vvectorBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && vvector_ != null + && vvector_ + != akka.persistence.typed.serialization.Crdts.VersionVector + .getDefaultInstance()) { + vvector_ = + akka.persistence.typed.serialization.Crdts.VersionVector.newBuilder(vvector_) + .mergeFrom(value) + .buildPartial(); + } else { + vvector_ = value; + } + onChanged(); + } else { + vvectorBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + /** required .VersionVector vvector = 2; */ + public Builder clearVvector() { + if (vvectorBuilder_ == null) { + vvector_ = null; + onChanged(); + } else { + vvectorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + /** required .VersionVector vvector = 2; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Builder getVvectorBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getVvectorFieldBuilder().getBuilder(); + } + /** required .VersionVector vvector = 2; */ + public akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder + getVvectorOrBuilder() { + if (vvectorBuilder_ != null) { + return vvectorBuilder_.getMessageOrBuilder(); + } else { + return vvector_ == null + ? akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance() + : vvector_; + } + } + /** required .VersionVector vvector = 2; */ + private akka.protobufv3.internal.SingleFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder, + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder> + getVvectorFieldBuilder() { + if (vvectorBuilder_ == null) { + vvectorBuilder_ = + new akka.protobufv3.internal.SingleFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder, + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder>( + getVvector(), getParentForChildren(), isClean()); + vvector_ = null; + } + return vvectorBuilder_; + } + + private java.util.List dots_ = + java.util.Collections.emptyList(); + + private void ensureDotsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + dots_ = + new java.util.ArrayList( + dots_); + bitField0_ |= 0x00000004; + } + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder, + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder> + dotsBuilder_; + + /** repeated .VersionVector dots = 3; */ + public java.util.List + getDotsList() { + if (dotsBuilder_ == null) { + return java.util.Collections.unmodifiableList(dots_); + } else { + return dotsBuilder_.getMessageList(); + } + } + /** repeated .VersionVector dots = 3; */ + public int getDotsCount() { + if (dotsBuilder_ == null) { + return dots_.size(); + } else { + return dotsBuilder_.getCount(); + } + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVector getDots(int index) { + if (dotsBuilder_ == null) { + return dots_.get(index); + } else { + return dotsBuilder_.getMessage(index); + } + } + /** repeated .VersionVector dots = 3; */ + public Builder setDots( + int index, akka.persistence.typed.serialization.Crdts.VersionVector value) { + if (dotsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDotsIsMutable(); + dots_.set(index, value); + onChanged(); + } else { + dotsBuilder_.setMessage(index, value); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder setDots( + int index, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder builderForValue) { + if (dotsBuilder_ == null) { + ensureDotsIsMutable(); + dots_.set(index, builderForValue.build()); + onChanged(); + } else { + dotsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder addDots(akka.persistence.typed.serialization.Crdts.VersionVector value) { + if (dotsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDotsIsMutable(); + dots_.add(value); + onChanged(); + } else { + dotsBuilder_.addMessage(value); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder addDots( + int index, akka.persistence.typed.serialization.Crdts.VersionVector value) { + if (dotsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDotsIsMutable(); + dots_.add(index, value); + onChanged(); + } else { + dotsBuilder_.addMessage(index, value); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder addDots( + akka.persistence.typed.serialization.Crdts.VersionVector.Builder builderForValue) { + if (dotsBuilder_ == null) { + ensureDotsIsMutable(); + dots_.add(builderForValue.build()); + onChanged(); + } else { + dotsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder addDots( + int index, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder builderForValue) { + if (dotsBuilder_ == null) { + ensureDotsIsMutable(); + dots_.add(index, builderForValue.build()); + onChanged(); + } else { + dotsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder addAllDots( + java.lang.Iterable + values) { + if (dotsBuilder_ == null) { + ensureDotsIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, dots_); + onChanged(); + } else { + dotsBuilder_.addAllMessages(values); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder clearDots() { + if (dotsBuilder_ == null) { + dots_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + dotsBuilder_.clear(); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public Builder removeDots(int index) { + if (dotsBuilder_ == null) { + ensureDotsIsMutable(); + dots_.remove(index); + onChanged(); + } else { + dotsBuilder_.remove(index); + } + return this; + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Builder getDotsBuilder( + int index) { + return getDotsFieldBuilder().getBuilder(index); + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder getDotsOrBuilder( + int index) { + if (dotsBuilder_ == null) { + return dots_.get(index); + } else { + return dotsBuilder_.getMessageOrBuilder(index); + } + } + /** repeated .VersionVector dots = 3; */ + public java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder> + getDotsOrBuilderList() { + if (dotsBuilder_ != null) { + return dotsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(dots_); + } + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Builder addDotsBuilder() { + return getDotsFieldBuilder() + .addBuilder( + akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance()); + } + /** repeated .VersionVector dots = 3; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Builder addDotsBuilder( + int index) { + return getDotsFieldBuilder() + .addBuilder( + index, + akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance()); + } + /** repeated .VersionVector dots = 3; */ + public java.util.List + getDotsBuilderList() { + return getDotsFieldBuilder().getBuilderList(); + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder, + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder> + getDotsFieldBuilder() { + if (dotsBuilder_ == null) { + dotsBuilder_ = + new akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder, + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder>( + dots_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); + dots_ = null; + } + return dotsBuilder_; + } + + private akka.protobufv3.internal.LazyStringList stringElements_ = + akka.protobufv3.internal.LazyStringArrayList.EMPTY; + + private void ensureStringElementsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + stringElements_ = new akka.protobufv3.internal.LazyStringArrayList(stringElements_); + bitField0_ |= 0x00000008; + } + } + /** + * repeated string stringElements = 4; + * + * @return A list containing the stringElements. + */ + public akka.protobufv3.internal.ProtocolStringList getStringElementsList() { + return stringElements_.getUnmodifiableView(); + } + /** + * repeated string stringElements = 4; + * + * @return The count of stringElements. + */ + public int getStringElementsCount() { + return stringElements_.size(); + } + /** + * repeated string stringElements = 4; + * + * @param index The index of the element to return. + * @return The stringElements at the given index. + */ + public java.lang.String getStringElements(int index) { + return stringElements_.get(index); + } + /** + * repeated string stringElements = 4; + * + * @param index The index of the value to return. + * @return The bytes of the stringElements at the given index. + */ + public akka.protobufv3.internal.ByteString getStringElementsBytes(int index) { + return stringElements_.getByteString(index); + } + /** + * repeated string stringElements = 4; + * + * @param index The index to set the value at. + * @param value The stringElements to set. + * @return This builder for chaining. + */ + public Builder setStringElements(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringElementsIsMutable(); + stringElements_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string stringElements = 4; + * + * @param value The stringElements to add. + * @return This builder for chaining. + */ + public Builder addStringElements(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringElementsIsMutable(); + stringElements_.add(value); + onChanged(); + return this; + } + /** + * repeated string stringElements = 4; + * + * @param values The stringElements to add. + * @return This builder for chaining. + */ + public Builder addAllStringElements(java.lang.Iterable values) { + ensureStringElementsIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, stringElements_); + onChanged(); + return this; + } + /** + * repeated string stringElements = 4; + * + * @return This builder for chaining. + */ + public Builder clearStringElements() { + stringElements_ = akka.protobufv3.internal.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * repeated string stringElements = 4; + * + * @param value The bytes of the stringElements to add. + * @return This builder for chaining. + */ + public Builder addStringElementsBytes(akka.protobufv3.internal.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureStringElementsIsMutable(); + stringElements_.add(value); + onChanged(); + return this; + } + + private akka.protobufv3.internal.Internal.IntList intElements_ = emptyIntList(); + + private void ensureIntElementsIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + intElements_ = mutableCopy(intElements_); + bitField0_ |= 0x00000010; + } + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return A list containing the intElements. + */ + public java.util.List getIntElementsList() { + return ((bitField0_ & 0x00000010) != 0) + ? java.util.Collections.unmodifiableList(intElements_) + : intElements_; + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return The count of intElements. + */ + public int getIntElementsCount() { + return intElements_.size(); + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @param index The index of the element to return. + * @return The intElements at the given index. + */ + public int getIntElements(int index) { + return intElements_.getInt(index); + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @param index The index to set the value at. + * @param value The intElements to set. + * @return This builder for chaining. + */ + public Builder setIntElements(int index, int value) { + ensureIntElementsIsMutable(); + intElements_.setInt(index, value); + onChanged(); + return this; + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @param value The intElements to add. + * @return This builder for chaining. + */ + public Builder addIntElements(int value) { + ensureIntElementsIsMutable(); + intElements_.addInt(value); + onChanged(); + return this; + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @param values The intElements to add. + * @return This builder for chaining. + */ + public Builder addAllIntElements(java.lang.Iterable values) { + ensureIntElementsIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, intElements_); + onChanged(); + return this; + } + /** + * repeated sint32 intElements = 5 [packed = true]; + * + * @return This builder for chaining. + */ + public Builder clearIntElements() { + intElements_ = emptyIntList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + private akka.protobufv3.internal.Internal.LongList longElements_ = emptyLongList(); + + private void ensureLongElementsIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + longElements_ = mutableCopy(longElements_); + bitField0_ |= 0x00000020; + } + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return A list containing the longElements. + */ + public java.util.List getLongElementsList() { + return ((bitField0_ & 0x00000020) != 0) + ? java.util.Collections.unmodifiableList(longElements_) + : longElements_; + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return The count of longElements. + */ + public int getLongElementsCount() { + return longElements_.size(); + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @param index The index of the element to return. + * @return The longElements at the given index. + */ + public long getLongElements(int index) { + return longElements_.getLong(index); + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @param index The index to set the value at. + * @param value The longElements to set. + * @return This builder for chaining. + */ + public Builder setLongElements(int index, long value) { + ensureLongElementsIsMutable(); + longElements_.setLong(index, value); + onChanged(); + return this; + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @param value The longElements to add. + * @return This builder for chaining. + */ + public Builder addLongElements(long value) { + ensureLongElementsIsMutable(); + longElements_.addLong(value); + onChanged(); + return this; + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @param values The longElements to add. + * @return This builder for chaining. + */ + public Builder addAllLongElements(java.lang.Iterable values) { + ensureLongElementsIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, longElements_); + onChanged(); + return this; + } + /** + * repeated sint64 longElements = 6 [packed = true]; + * + * @return This builder for chaining. + */ + public Builder clearLongElements() { + longElements_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + + private java.util.List otherElements_ = + java.util.Collections.emptyList(); + + private void ensureOtherElementsIsMutable() { + if (!((bitField0_ & 0x00000040) != 0)) { + otherElements_ = + new java.util.ArrayList(otherElements_); + bitField0_ |= 0x00000040; + } + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.remote.ContainerFormats.Payload, + akka.remote.ContainerFormats.Payload.Builder, + akka.remote.ContainerFormats.PayloadOrBuilder> + otherElementsBuilder_; + + /** repeated .Payload otherElements = 7; */ + public java.util.List getOtherElementsList() { + if (otherElementsBuilder_ == null) { + return java.util.Collections.unmodifiableList(otherElements_); + } else { + return otherElementsBuilder_.getMessageList(); + } + } + /** repeated .Payload otherElements = 7; */ + public int getOtherElementsCount() { + if (otherElementsBuilder_ == null) { + return otherElements_.size(); + } else { + return otherElementsBuilder_.getCount(); + } + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.Payload getOtherElements(int index) { + if (otherElementsBuilder_ == null) { + return otherElements_.get(index); + } else { + return otherElementsBuilder_.getMessage(index); + } + } + /** repeated .Payload otherElements = 7; */ + public Builder setOtherElements(int index, akka.remote.ContainerFormats.Payload value) { + if (otherElementsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOtherElementsIsMutable(); + otherElements_.set(index, value); + onChanged(); + } else { + otherElementsBuilder_.setMessage(index, value); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder setOtherElements( + int index, akka.remote.ContainerFormats.Payload.Builder builderForValue) { + if (otherElementsBuilder_ == null) { + ensureOtherElementsIsMutable(); + otherElements_.set(index, builderForValue.build()); + onChanged(); + } else { + otherElementsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder addOtherElements(akka.remote.ContainerFormats.Payload value) { + if (otherElementsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOtherElementsIsMutable(); + otherElements_.add(value); + onChanged(); + } else { + otherElementsBuilder_.addMessage(value); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder addOtherElements(int index, akka.remote.ContainerFormats.Payload value) { + if (otherElementsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOtherElementsIsMutable(); + otherElements_.add(index, value); + onChanged(); + } else { + otherElementsBuilder_.addMessage(index, value); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder addOtherElements( + akka.remote.ContainerFormats.Payload.Builder builderForValue) { + if (otherElementsBuilder_ == null) { + ensureOtherElementsIsMutable(); + otherElements_.add(builderForValue.build()); + onChanged(); + } else { + otherElementsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder addOtherElements( + int index, akka.remote.ContainerFormats.Payload.Builder builderForValue) { + if (otherElementsBuilder_ == null) { + ensureOtherElementsIsMutable(); + otherElements_.add(index, builderForValue.build()); + onChanged(); + } else { + otherElementsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder addAllOtherElements( + java.lang.Iterable values) { + if (otherElementsBuilder_ == null) { + ensureOtherElementsIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, otherElements_); + onChanged(); + } else { + otherElementsBuilder_.addAllMessages(values); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder clearOtherElements() { + if (otherElementsBuilder_ == null) { + otherElements_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + } else { + otherElementsBuilder_.clear(); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public Builder removeOtherElements(int index) { + if (otherElementsBuilder_ == null) { + ensureOtherElementsIsMutable(); + otherElements_.remove(index); + onChanged(); + } else { + otherElementsBuilder_.remove(index); + } + return this; + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.Payload.Builder getOtherElementsBuilder(int index) { + return getOtherElementsFieldBuilder().getBuilder(index); + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.PayloadOrBuilder getOtherElementsOrBuilder(int index) { + if (otherElementsBuilder_ == null) { + return otherElements_.get(index); + } else { + return otherElementsBuilder_.getMessageOrBuilder(index); + } + } + /** repeated .Payload otherElements = 7; */ + public java.util.List + getOtherElementsOrBuilderList() { + if (otherElementsBuilder_ != null) { + return otherElementsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(otherElements_); + } + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.Payload.Builder addOtherElementsBuilder() { + return getOtherElementsFieldBuilder() + .addBuilder(akka.remote.ContainerFormats.Payload.getDefaultInstance()); + } + /** repeated .Payload otherElements = 7; */ + public akka.remote.ContainerFormats.Payload.Builder addOtherElementsBuilder(int index) { + return getOtherElementsFieldBuilder() + .addBuilder(index, akka.remote.ContainerFormats.Payload.getDefaultInstance()); + } + /** repeated .Payload otherElements = 7; */ + public java.util.List + getOtherElementsBuilderList() { + return getOtherElementsFieldBuilder().getBuilderList(); + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.remote.ContainerFormats.Payload, + akka.remote.ContainerFormats.Payload.Builder, + akka.remote.ContainerFormats.PayloadOrBuilder> + getOtherElementsFieldBuilder() { + if (otherElementsBuilder_ == null) { + otherElementsBuilder_ = + new akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.remote.ContainerFormats.Payload, + akka.remote.ContainerFormats.Payload.Builder, + akka.remote.ContainerFormats.PayloadOrBuilder>( + otherElements_, + ((bitField0_ & 0x00000040) != 0), + getParentForChildren(), + isClean()); + otherElements_ = null; + } + return otherElementsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:ORSet) + } + + // @@protoc_insertion_point(class_scope:ORSet) + private static final akka.persistence.typed.serialization.Crdts.ORSet DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.ORSet(); + } + + public static akka.persistence.typed.serialization.Crdts.ORSet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public ORSet parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new ORSet(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSet getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ORSetDeltaGroupOrBuilder + extends + // @@protoc_insertion_point(interface_extends:ORSetDeltaGroup) + akka.protobufv3.internal.MessageOrBuilder { + + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + java.util.List + getEntriesList(); + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry getEntries(int index); + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + int getEntriesCount(); + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder> + getEntriesOrBuilderList(); + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder getEntriesOrBuilder( + int index); + } + /** Protobuf type {@code ORSetDeltaGroup} */ + public static final class ORSetDeltaGroup extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:ORSetDeltaGroup) + ORSetDeltaGroupOrBuilder { + private static final long serialVersionUID = 0L; + // Use ORSetDeltaGroup.newBuilder() to construct. + private ORSetDeltaGroup(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ORSetDeltaGroup() { + entries_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new ORSetDeltaGroup(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ORSetDeltaGroup( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + entries_ = + new java.util.ArrayList< + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry>(); + mutable_bitField0_ |= 0x00000001; + } + entries_.add( + input.readMessage( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.PARSER, + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + entries_ = java.util.Collections.unmodifiableList(entries_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_ORSetDeltaGroup_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.class, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Builder.class); + } + + public interface EntryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:ORSetDeltaGroup.Entry) + akka.protobufv3.internal.MessageOrBuilder { + + /** + * required .ORSetDeltaOp operation = 1; + * + * @return Whether the operation field is set. + */ + boolean hasOperation(); + /** + * required .ORSetDeltaOp operation = 1; + * + * @return The operation. + */ + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp getOperation(); + + /** + * required .ORSet underlying = 2; + * + * @return Whether the underlying field is set. + */ + boolean hasUnderlying(); + /** + * required .ORSet underlying = 2; + * + * @return The underlying. + */ + akka.persistence.typed.serialization.Crdts.ORSet getUnderlying(); + /** required .ORSet underlying = 2; */ + akka.persistence.typed.serialization.Crdts.ORSetOrBuilder getUnderlyingOrBuilder(); + } + /** Protobuf type {@code ORSetDeltaGroup.Entry} */ + public static final class Entry extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:ORSetDeltaGroup.Entry) + EntryOrBuilder { + private static final long serialVersionUID = 0L; + // Use Entry.newBuilder() to construct. + private Entry(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Entry() { + operation_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new Entry(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Entry( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp value = + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + operation_ = rawValue; + } + break; + } + case 18: + { + akka.persistence.typed.serialization.Crdts.ORSet.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) != 0)) { + subBuilder = underlying_.toBuilder(); + } + underlying_ = + input.readMessage( + akka.persistence.typed.serialization.Crdts.ORSet.PARSER, + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(underlying_); + underlying_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000002; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_Entry_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_Entry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.class, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder.class); + } + + private int bitField0_; + public static final int OPERATION_FIELD_NUMBER = 1; + private int operation_; + /** + * required .ORSetDeltaOp operation = 1; + * + * @return Whether the operation field is set. + */ + public boolean hasOperation() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required .ORSetDeltaOp operation = 1; + * + * @return The operation. + */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaOp getOperation() { + @SuppressWarnings("deprecation") + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp result = + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp.valueOf(operation_); + return result == null + ? akka.persistence.typed.serialization.Crdts.ORSetDeltaOp.Add + : result; + } + + public static final int UNDERLYING_FIELD_NUMBER = 2; + private akka.persistence.typed.serialization.Crdts.ORSet underlying_; + /** + * required .ORSet underlying = 2; + * + * @return Whether the underlying field is set. + */ + public boolean hasUnderlying() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required .ORSet underlying = 2; + * + * @return The underlying. + */ + public akka.persistence.typed.serialization.Crdts.ORSet getUnderlying() { + return underlying_ == null + ? akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance() + : underlying_; + } + /** required .ORSet underlying = 2; */ + public akka.persistence.typed.serialization.Crdts.ORSetOrBuilder getUnderlyingOrBuilder() { + return underlying_ == null + ? akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance() + : underlying_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasOperation()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasUnderlying()) { + memoizedIsInitialized = 0; + return false; + } + if (!getUnderlying().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeEnum(1, operation_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getUnderlying()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += akka.protobufv3.internal.CodedOutputStream.computeEnumSize(1, operation_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += akka.protobufv3.internal.CodedOutputStream.computeMessageSize(2, getUnderlying()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry other = + (akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry) obj; + + if (hasOperation() != other.hasOperation()) return false; + if (hasOperation()) { + if (operation_ != other.operation_) return false; + } + if (hasUnderlying() != other.hasUnderlying()) return false; + if (hasUnderlying()) { + if (!getUnderlying().equals(other.getUnderlying())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasOperation()) { + hash = (37 * hash) + OPERATION_FIELD_NUMBER; + hash = (53 * hash) + operation_; + } + if (hasUnderlying()) { + hash = (37 * hash) + UNDERLYING_FIELD_NUMBER; + hash = (53 * hash) + getUnderlying().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + java.nio.ByteBuffer data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + byte[] data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + java.io.InputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + parseDelimitedFrom( + java.io.InputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code ORSetDeltaGroup.Entry} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:ORSetDeltaGroup.Entry) + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_Entry_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_Entry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.class, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder.class); + } + + // Construct using + // akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) { + getUnderlyingFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + operation_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + if (underlyingBuilder_ == null) { + underlying_ = null; + } else { + underlyingBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_Entry_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + .getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry build() { + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry buildPartial() { + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry result = + new akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + to_bitField0_ |= 0x00000001; + } + result.operation_ = operation_; + if (((from_bitField0_ & 0x00000002) != 0)) { + if (underlyingBuilder_ == null) { + result.underlying_ = underlying_; + } else { + result.underlying_ = underlyingBuilder_.build(); + } + to_bitField0_ |= 0x00000002; + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry) { + return mergeFrom( + (akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry other) { + if (other + == akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + .getDefaultInstance()) return this; + if (other.hasOperation()) { + setOperation(other.getOperation()); + } + if (other.hasUnderlying()) { + mergeUnderlying(other.getUnderlying()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasOperation()) { + return false; + } + if (!hasUnderlying()) { + return false; + } + if (!getUnderlying().isInitialized()) { + return false; + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private int operation_ = 0; + /** + * required .ORSetDeltaOp operation = 1; + * + * @return Whether the operation field is set. + */ + public boolean hasOperation() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required .ORSetDeltaOp operation = 1; + * + * @return The operation. + */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaOp getOperation() { + @SuppressWarnings("deprecation") + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp result = + akka.persistence.typed.serialization.Crdts.ORSetDeltaOp.valueOf(operation_); + return result == null + ? akka.persistence.typed.serialization.Crdts.ORSetDeltaOp.Add + : result; + } + /** + * required .ORSetDeltaOp operation = 1; + * + * @param value The operation to set. + * @return This builder for chaining. + */ + public Builder setOperation(akka.persistence.typed.serialization.Crdts.ORSetDeltaOp value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + operation_ = value.getNumber(); + onChanged(); + return this; + } + /** + * required .ORSetDeltaOp operation = 1; + * + * @return This builder for chaining. + */ + public Builder clearOperation() { + bitField0_ = (bitField0_ & ~0x00000001); + operation_ = 0; + onChanged(); + return this; + } + + private akka.persistence.typed.serialization.Crdts.ORSet underlying_; + private akka.protobufv3.internal.SingleFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.ORSet, + akka.persistence.typed.serialization.Crdts.ORSet.Builder, + akka.persistence.typed.serialization.Crdts.ORSetOrBuilder> + underlyingBuilder_; + /** + * required .ORSet underlying = 2; + * + * @return Whether the underlying field is set. + */ + public boolean hasUnderlying() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required .ORSet underlying = 2; + * + * @return The underlying. + */ + public akka.persistence.typed.serialization.Crdts.ORSet getUnderlying() { + if (underlyingBuilder_ == null) { + return underlying_ == null + ? akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance() + : underlying_; + } else { + return underlyingBuilder_.getMessage(); + } + } + /** required .ORSet underlying = 2; */ + public Builder setUnderlying(akka.persistence.typed.serialization.Crdts.ORSet value) { + if (underlyingBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + underlying_ = value; + onChanged(); + } else { + underlyingBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + /** required .ORSet underlying = 2; */ + public Builder setUnderlying( + akka.persistence.typed.serialization.Crdts.ORSet.Builder builderForValue) { + if (underlyingBuilder_ == null) { + underlying_ = builderForValue.build(); + onChanged(); + } else { + underlyingBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + /** required .ORSet underlying = 2; */ + public Builder mergeUnderlying(akka.persistence.typed.serialization.Crdts.ORSet value) { + if (underlyingBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && underlying_ != null + && underlying_ + != akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance()) { + underlying_ = + akka.persistence.typed.serialization.Crdts.ORSet.newBuilder(underlying_) + .mergeFrom(value) + .buildPartial(); + } else { + underlying_ = value; + } + onChanged(); + } else { + underlyingBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + /** required .ORSet underlying = 2; */ + public Builder clearUnderlying() { + if (underlyingBuilder_ == null) { + underlying_ = null; + onChanged(); + } else { + underlyingBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + /** required .ORSet underlying = 2; */ + public akka.persistence.typed.serialization.Crdts.ORSet.Builder getUnderlyingBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getUnderlyingFieldBuilder().getBuilder(); + } + /** required .ORSet underlying = 2; */ + public akka.persistence.typed.serialization.Crdts.ORSetOrBuilder getUnderlyingOrBuilder() { + if (underlyingBuilder_ != null) { + return underlyingBuilder_.getMessageOrBuilder(); + } else { + return underlying_ == null + ? akka.persistence.typed.serialization.Crdts.ORSet.getDefaultInstance() + : underlying_; + } + } + /** required .ORSet underlying = 2; */ + private akka.protobufv3.internal.SingleFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.ORSet, + akka.persistence.typed.serialization.Crdts.ORSet.Builder, + akka.persistence.typed.serialization.Crdts.ORSetOrBuilder> + getUnderlyingFieldBuilder() { + if (underlyingBuilder_ == null) { + underlyingBuilder_ = + new akka.protobufv3.internal.SingleFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.ORSet, + akka.persistence.typed.serialization.Crdts.ORSet.Builder, + akka.persistence.typed.serialization.Crdts.ORSetOrBuilder>( + getUnderlying(), getParentForChildren(), isClean()); + underlying_ = null; + } + return underlyingBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:ORSetDeltaGroup.Entry) + } + + // @@protoc_insertion_point(class_scope:ORSetDeltaGroup.Entry) + private static final akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry(); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public Entry parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new Entry(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int ENTRIES_FIELD_NUMBER = 1; + private java.util.List + entries_; + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public java.util.List + getEntriesList() { + return entries_; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder> + getEntriesOrBuilderList() { + return entries_; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public int getEntriesCount() { + return entries_.size(); + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry getEntries(int index) { + return entries_.get(index); + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder + getEntriesOrBuilder(int index) { + return entries_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + for (int i = 0; i < getEntriesCount(); i++) { + if (!getEntries(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < entries_.size(); i++) { + output.writeMessage(1, entries_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < entries_.size(); i++) { + size += akka.protobufv3.internal.CodedOutputStream.computeMessageSize(1, entries_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup other = + (akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup) obj; + + if (!getEntriesList().equals(other.getEntriesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getEntriesCount() > 0) { + hash = (37 * hash) + ENTRIES_FIELD_NUMBER; + hash = (53 * hash) + getEntriesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + java.nio.ByteBuffer data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom(byte[] data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseDelimitedFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code ORSetDeltaGroup} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:ORSetDeltaGroup) + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroupOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.class, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Builder.class); + } + + // Construct using akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) { + getEntriesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (entriesBuilder_ == null) { + entries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + entriesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts + .internal_static_ORSetDeltaGroup_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup + getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup build() { + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup buildPartial() { + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup result = + new akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup(this); + int from_bitField0_ = bitField0_; + if (entriesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + entries_ = java.util.Collections.unmodifiableList(entries_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.entries_ = entries_; + } else { + result.entries_ = entriesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup) { + return mergeFrom((akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup other) { + if (other + == akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.getDefaultInstance()) + return this; + if (entriesBuilder_ == null) { + if (!other.entries_.isEmpty()) { + if (entries_.isEmpty()) { + entries_ = other.entries_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureEntriesIsMutable(); + entries_.addAll(other.entries_); + } + onChanged(); + } + } else { + if (!other.entries_.isEmpty()) { + if (entriesBuilder_.isEmpty()) { + entriesBuilder_.dispose(); + entriesBuilder_ = null; + entries_ = other.entries_; + bitField0_ = (bitField0_ & ~0x00000001); + entriesBuilder_ = + akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders + ? getEntriesFieldBuilder() + : null; + } else { + entriesBuilder_.addAllMessages(other.entries_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + for (int i = 0; i < getEntriesCount(); i++) { + if (!getEntries(i).isInitialized()) { + return false; + } + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List + entries_ = java.util.Collections.emptyList(); + + private void ensureEntriesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + entries_ = + new java.util.ArrayList< + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry>(entries_); + bitField0_ |= 0x00000001; + } + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder> + entriesBuilder_; + + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public java.util.List + getEntriesList() { + if (entriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(entries_); + } else { + return entriesBuilder_.getMessageList(); + } + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public int getEntriesCount() { + if (entriesBuilder_ == null) { + return entries_.size(); + } else { + return entriesBuilder_.getCount(); + } + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry getEntries( + int index) { + if (entriesBuilder_ == null) { + return entries_.get(index); + } else { + return entriesBuilder_.getMessage(index); + } + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder setEntries( + int index, akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.set(index, value); + onChanged(); + } else { + entriesBuilder_.setMessage(index, value); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder setEntries( + int index, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder + builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.set(index, builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder addEntries( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.add(value); + onChanged(); + } else { + entriesBuilder_.addMessage(value); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder addEntries( + int index, akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.add(index, value); + onChanged(); + } else { + entriesBuilder_.addMessage(index, value); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder addEntries( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder + builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder addEntries( + int index, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder + builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(index, builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder addAllEntries( + java.lang.Iterable< + ? extends akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry> + values) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, entries_); + onChanged(); + } else { + entriesBuilder_.addAllMessages(values); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder clearEntries() { + if (entriesBuilder_ == null) { + entries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + entriesBuilder_.clear(); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public Builder removeEntries(int index) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.remove(index); + onChanged(); + } else { + entriesBuilder_.remove(index); + } + return this; + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder + getEntriesBuilder(int index) { + return getEntriesFieldBuilder().getBuilder(index); + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder + getEntriesOrBuilder(int index) { + if (entriesBuilder_ == null) { + return entries_.get(index); + } else { + return entriesBuilder_.getMessageOrBuilder(index); + } + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder> + getEntriesOrBuilderList() { + if (entriesBuilder_ != null) { + return entriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(entries_); + } + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder + addEntriesBuilder() { + return getEntriesFieldBuilder() + .addBuilder( + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + .getDefaultInstance()); + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder + addEntriesBuilder(int index) { + return getEntriesFieldBuilder() + .addBuilder( + index, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry + .getDefaultInstance()); + } + /** repeated .ORSetDeltaGroup.Entry entries = 1; */ + public java.util.List< + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder> + getEntriesBuilderList() { + return getEntriesFieldBuilder().getBuilderList(); + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder> + getEntriesFieldBuilder() { + if (entriesBuilder_ == null) { + entriesBuilder_ = + new akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.Entry.Builder, + akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup.EntryOrBuilder>( + entries_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + entries_ = null; + } + return entriesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:ORSetDeltaGroup) + } + + // @@protoc_insertion_point(class_scope:ORSetDeltaGroup) + private static final akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup(); + } + + public static akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public ORSetDeltaGroup parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new ORSetDeltaGroup(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.ORSetDeltaGroup getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface VersionVectorOrBuilder + extends + // @@protoc_insertion_point(interface_extends:VersionVector) + akka.protobufv3.internal.MessageOrBuilder { + + /** repeated .VersionVector.Entry entries = 1; */ + java.util.List getEntriesList(); + /** repeated .VersionVector.Entry entries = 1; */ + akka.persistence.typed.serialization.Crdts.VersionVector.Entry getEntries(int index); + /** repeated .VersionVector.Entry entries = 1; */ + int getEntriesCount(); + /** repeated .VersionVector.Entry entries = 1; */ + java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder> + getEntriesOrBuilderList(); + /** repeated .VersionVector.Entry entries = 1; */ + akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder getEntriesOrBuilder( + int index); + } + /** Protobuf type {@code VersionVector} */ + public static final class VersionVector extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:VersionVector) + VersionVectorOrBuilder { + private static final long serialVersionUID = 0L; + // Use VersionVector.newBuilder() to construct. + private VersionVector(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private VersionVector() { + entries_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new VersionVector(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private VersionVector( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + entries_ = + new java.util.ArrayList< + akka.persistence.typed.serialization.Crdts.VersionVector.Entry>(); + mutable_bitField0_ |= 0x00000001; + } + entries_.add( + input.readMessage( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.PARSER, + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + entries_ = java.util.Collections.unmodifiableList(entries_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_VersionVector_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.VersionVector.class, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder.class); + } + + public interface EntryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:VersionVector.Entry) + akka.protobufv3.internal.MessageOrBuilder { + + /** + * required string key = 1; + * + * @return Whether the key field is set. + */ + boolean hasKey(); + /** + * required string key = 1; + * + * @return The key. + */ + java.lang.String getKey(); + /** + * required string key = 1; + * + * @return The bytes for key. + */ + akka.protobufv3.internal.ByteString getKeyBytes(); + + /** + * required int64 version = 2; + * + * @return Whether the version field is set. + */ + boolean hasVersion(); + /** + * required int64 version = 2; + * + * @return The version. + */ + long getVersion(); + } + /** Protobuf type {@code VersionVector.Entry} */ + public static final class Entry extends akka.protobufv3.internal.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:VersionVector.Entry) + EntryOrBuilder { + private static final long serialVersionUID = 0L; + // Use Entry.newBuilder() to construct. + private Entry(akka.protobufv3.internal.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Entry() { + key_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + akka.protobufv3.internal.GeneratedMessageV3.UnusedPrivateParameter unused) { + return new Entry(); + } + + @java.lang.Override + public final akka.protobufv3.internal.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Entry( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + akka.protobufv3.internal.UnknownFieldSet.Builder unknownFields = + akka.protobufv3.internal.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + akka.protobufv3.internal.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000001; + key_ = bs; + break; + } + case 16: + { + bitField0_ |= 0x00000002; + version_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobufv3.internal.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_Entry_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_Entry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.class, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder.class); + } + + private int bitField0_; + public static final int KEY_FIELD_NUMBER = 1; + private volatile java.lang.Object key_; + /** + * required string key = 1; + * + * @return Whether the key field is set. + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string key = 1; + * + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + akka.protobufv3.internal.ByteString bs = (akka.protobufv3.internal.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } + } + /** + * required string key = 1; + * + * @return The bytes for key. + */ + public akka.protobufv3.internal.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof java.lang.String) { + akka.protobufv3.internal.ByteString b = + akka.protobufv3.internal.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (akka.protobufv3.internal.ByteString) ref; + } + } + + public static final int VERSION_FIELD_NUMBER = 2; + private long version_; + /** + * required int64 version = 2; + * + * @return Whether the version field is set. + */ + public boolean hasVersion() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required int64 version = 2; + * + * @return The version. + */ + public long getVersion() { + return version_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasVersion()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + akka.protobufv3.internal.GeneratedMessageV3.writeString(output, 1, key_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeInt64(2, version_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += akka.protobufv3.internal.GeneratedMessageV3.computeStringSize(1, key_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += akka.protobufv3.internal.CodedOutputStream.computeInt64Size(2, version_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.VersionVector.Entry)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.VersionVector.Entry other = + (akka.persistence.typed.serialization.Crdts.VersionVector.Entry) obj; + + if (hasKey() != other.hasKey()) return false; + if (hasKey()) { + if (!getKey().equals(other.getKey())) return false; + } + if (hasVersion() != other.hasVersion()) return false; + if (hasVersion()) { + if (getVersion() != other.getVersion()) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasKey()) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + } + if (hasVersion()) { + hash = (37 * hash) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + akka.protobufv3.internal.Internal.hashLong(getVersion()); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + java.nio.ByteBuffer data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + byte[] data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + java.io.InputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry + parseDelimitedFrom( + java.io.InputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code VersionVector.Entry} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:VersionVector.Entry) + akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_Entry_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_Entry_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.class, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder.class); + } + + // Construct using + // akka.persistence.typed.serialization.Crdts.VersionVector.Entry.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + key_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + version_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_Entry_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry + getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.VersionVector.Entry + .getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry build() { + akka.persistence.typed.serialization.Crdts.VersionVector.Entry result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry buildPartial() { + akka.persistence.typed.serialization.Crdts.VersionVector.Entry result = + new akka.persistence.typed.serialization.Crdts.VersionVector.Entry(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + to_bitField0_ |= 0x00000001; + } + result.key_ = key_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.version_ = version_; + to_bitField0_ |= 0x00000002; + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.VersionVector.Entry) { + return mergeFrom( + (akka.persistence.typed.serialization.Crdts.VersionVector.Entry) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry other) { + if (other + == akka.persistence.typed.serialization.Crdts.VersionVector.Entry + .getDefaultInstance()) return this; + if (other.hasKey()) { + bitField0_ |= 0x00000001; + key_ = other.key_; + onChanged(); + } + if (other.hasVersion()) { + setVersion(other.getVersion()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + if (!hasKey()) { + return false; + } + if (!hasVersion()) { + return false; + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.VersionVector.Entry parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.VersionVector.Entry) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object key_ = ""; + /** + * required string key = 1; + * + * @return Whether the key field is set. + */ + public boolean hasKey() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * required string key = 1; + * + * @return The key. + */ + public java.lang.String getKey() { + java.lang.Object ref = key_; + if (!(ref instanceof java.lang.String)) { + akka.protobufv3.internal.ByteString bs = (akka.protobufv3.internal.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + key_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string key = 1; + * + * @return The bytes for key. + */ + public akka.protobufv3.internal.ByteString getKeyBytes() { + java.lang.Object ref = key_; + if (ref instanceof String) { + akka.protobufv3.internal.ByteString b = + akka.protobufv3.internal.ByteString.copyFromUtf8((java.lang.String) ref); + key_ = b; + return b; + } else { + return (akka.protobufv3.internal.ByteString) ref; + } + } + /** + * required string key = 1; + * + * @param value The key to set. + * @return This builder for chaining. + */ + public Builder setKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + onChanged(); + return this; + } + /** + * required string key = 1; + * + * @return This builder for chaining. + */ + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000001); + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + /** + * required string key = 1; + * + * @param value The bytes for key to set. + * @return This builder for chaining. + */ + public Builder setKeyBytes(akka.protobufv3.internal.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + key_ = value; + onChanged(); + return this; + } + + private long version_; + /** + * required int64 version = 2; + * + * @return Whether the version field is set. + */ + public boolean hasVersion() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * required int64 version = 2; + * + * @return The version. + */ + public long getVersion() { + return version_; + } + /** + * required int64 version = 2; + * + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(long value) { + bitField0_ |= 0x00000002; + version_ = value; + onChanged(); + return this; + } + /** + * required int64 version = 2; + * + * @return This builder for chaining. + */ + public Builder clearVersion() { + bitField0_ = (bitField0_ & ~0x00000002); + version_ = 0L; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:VersionVector.Entry) + } + + // @@protoc_insertion_point(class_scope:VersionVector.Entry) + private static final akka.persistence.typed.serialization.Crdts.VersionVector.Entry + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.VersionVector.Entry(); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector.Entry + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public Entry parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new Entry(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int ENTRIES_FIELD_NUMBER = 1; + private java.util.List entries_; + /** repeated .VersionVector.Entry entries = 1; */ + public java.util.List + getEntriesList() { + return entries_; + } + /** repeated .VersionVector.Entry entries = 1; */ + public java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder> + getEntriesOrBuilderList() { + return entries_; + } + /** repeated .VersionVector.Entry entries = 1; */ + public int getEntriesCount() { + return entries_.size(); + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry getEntries(int index) { + return entries_.get(index); + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder + getEntriesOrBuilder(int index) { + return entries_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + for (int i = 0; i < getEntriesCount(); i++) { + if (!getEntries(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(akka.protobufv3.internal.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < entries_.size(); i++) { + output.writeMessage(1, entries_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < entries_.size(); i++) { + size += akka.protobufv3.internal.CodedOutputStream.computeMessageSize(1, entries_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof akka.persistence.typed.serialization.Crdts.VersionVector)) { + return super.equals(obj); + } + akka.persistence.typed.serialization.Crdts.VersionVector other = + (akka.persistence.typed.serialization.Crdts.VersionVector) obj; + + if (!getEntriesList().equals(other.getEntriesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getEntriesCount() > 0) { + hash = (37 * hash) + ENTRIES_FIELD_NUMBER; + hash = (53 * hash) + getEntriesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + java.nio.ByteBuffer data) throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + java.nio.ByteBuffer data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + akka.protobufv3.internal.ByteString data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + akka.protobufv3.internal.ByteString data, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom(byte[] data) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + byte[] data, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseDelimitedFrom( + java.io.InputStream input, akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + akka.protobufv3.internal.CodedInputStream input) throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector parseFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return akka.protobufv3.internal.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + akka.persistence.typed.serialization.Crdts.VersionVector prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code VersionVector} */ + public static final class Builder + extends akka.protobufv3.internal.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:VersionVector) + akka.persistence.typed.serialization.Crdts.VersionVectorOrBuilder { + public static final akka.protobufv3.internal.Descriptors.Descriptor getDescriptor() { + return akka.persistence.typed.serialization.Crdts.internal_static_VersionVector_descriptor; + } + + @java.lang.Override + protected akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.persistence.typed.serialization.Crdts + .internal_static_VersionVector_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.persistence.typed.serialization.Crdts.VersionVector.class, + akka.persistence.typed.serialization.Crdts.VersionVector.Builder.class); + } + + // Construct using akka.persistence.typed.serialization.Crdts.VersionVector.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(akka.protobufv3.internal.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders) { + getEntriesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (entriesBuilder_ == null) { + entries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + entriesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public akka.protobufv3.internal.Descriptors.Descriptor getDescriptorForType() { + return akka.persistence.typed.serialization.Crdts.internal_static_VersionVector_descriptor; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector getDefaultInstanceForType() { + return akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance(); + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector build() { + akka.persistence.typed.serialization.Crdts.VersionVector result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector buildPartial() { + akka.persistence.typed.serialization.Crdts.VersionVector result = + new akka.persistence.typed.serialization.Crdts.VersionVector(this); + int from_bitField0_ = bitField0_; + if (entriesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + entries_ = java.util.Collections.unmodifiableList(entries_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.entries_ = entries_; + } else { + result.entries_ = entriesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(akka.protobufv3.internal.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(akka.protobufv3.internal.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + akka.protobufv3.internal.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(akka.protobufv3.internal.Message other) { + if (other instanceof akka.persistence.typed.serialization.Crdts.VersionVector) { + return mergeFrom((akka.persistence.typed.serialization.Crdts.VersionVector) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.persistence.typed.serialization.Crdts.VersionVector other) { + if (other == akka.persistence.typed.serialization.Crdts.VersionVector.getDefaultInstance()) + return this; + if (entriesBuilder_ == null) { + if (!other.entries_.isEmpty()) { + if (entries_.isEmpty()) { + entries_ = other.entries_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureEntriesIsMutable(); + entries_.addAll(other.entries_); + } + onChanged(); + } + } else { + if (!other.entries_.isEmpty()) { + if (entriesBuilder_.isEmpty()) { + entriesBuilder_.dispose(); + entriesBuilder_ = null; + entries_ = other.entries_; + bitField0_ = (bitField0_ & ~0x00000001); + entriesBuilder_ = + akka.protobufv3.internal.GeneratedMessageV3.alwaysUseFieldBuilders + ? getEntriesFieldBuilder() + : null; + } else { + entriesBuilder_.addAllMessages(other.entries_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + for (int i = 0; i < getEntriesCount(); i++) { + if (!getEntries(i).isInitialized()) { + return false; + } + } + return true; + } + + @java.lang.Override + public Builder mergeFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + akka.persistence.typed.serialization.Crdts.VersionVector parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (akka.protobufv3.internal.InvalidProtocolBufferException e) { + parsedMessage = + (akka.persistence.typed.serialization.Crdts.VersionVector) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List + entries_ = java.util.Collections.emptyList(); + + private void ensureEntriesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + entries_ = + new java.util.ArrayList< + akka.persistence.typed.serialization.Crdts.VersionVector.Entry>(entries_); + bitField0_ |= 0x00000001; + } + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector.Entry, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder, + akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder> + entriesBuilder_; + + /** repeated .VersionVector.Entry entries = 1; */ + public java.util.List + getEntriesList() { + if (entriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(entries_); + } else { + return entriesBuilder_.getMessageList(); + } + } + /** repeated .VersionVector.Entry entries = 1; */ + public int getEntriesCount() { + if (entriesBuilder_ == null) { + return entries_.size(); + } else { + return entriesBuilder_.getCount(); + } + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry getEntries(int index) { + if (entriesBuilder_ == null) { + return entries_.get(index); + } else { + return entriesBuilder_.getMessage(index); + } + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder setEntries( + int index, akka.persistence.typed.serialization.Crdts.VersionVector.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.set(index, value); + onChanged(); + } else { + entriesBuilder_.setMessage(index, value); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder setEntries( + int index, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.set(index, builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder addEntries( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.add(value); + onChanged(); + } else { + entriesBuilder_.addMessage(value); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder addEntries( + int index, akka.persistence.typed.serialization.Crdts.VersionVector.Entry value) { + if (entriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntriesIsMutable(); + entries_.add(index, value); + onChanged(); + } else { + entriesBuilder_.addMessage(index, value); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder addEntries( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder addEntries( + int index, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder builderForValue) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.add(index, builderForValue.build()); + onChanged(); + } else { + entriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder addAllEntries( + java.lang.Iterable< + ? extends akka.persistence.typed.serialization.Crdts.VersionVector.Entry> + values) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + akka.protobufv3.internal.AbstractMessageLite.Builder.addAll(values, entries_); + onChanged(); + } else { + entriesBuilder_.addAllMessages(values); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder clearEntries() { + if (entriesBuilder_ == null) { + entries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + entriesBuilder_.clear(); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public Builder removeEntries(int index) { + if (entriesBuilder_ == null) { + ensureEntriesIsMutable(); + entries_.remove(index); + onChanged(); + } else { + entriesBuilder_.remove(index); + } + return this; + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder + getEntriesBuilder(int index) { + return getEntriesFieldBuilder().getBuilder(index); + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder + getEntriesOrBuilder(int index) { + if (entriesBuilder_ == null) { + return entries_.get(index); + } else { + return entriesBuilder_.getMessageOrBuilder(index); + } + } + /** repeated .VersionVector.Entry entries = 1; */ + public java.util.List< + ? extends akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder> + getEntriesOrBuilderList() { + if (entriesBuilder_ != null) { + return entriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(entries_); + } + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder + addEntriesBuilder() { + return getEntriesFieldBuilder() + .addBuilder( + akka.persistence.typed.serialization.Crdts.VersionVector.Entry + .getDefaultInstance()); + } + /** repeated .VersionVector.Entry entries = 1; */ + public akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder + addEntriesBuilder(int index) { + return getEntriesFieldBuilder() + .addBuilder( + index, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry + .getDefaultInstance()); + } + /** repeated .VersionVector.Entry entries = 1; */ + public java.util.List + getEntriesBuilderList() { + return getEntriesFieldBuilder().getBuilderList(); + } + + private akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector.Entry, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder, + akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder> + getEntriesFieldBuilder() { + if (entriesBuilder_ == null) { + entriesBuilder_ = + new akka.protobufv3.internal.RepeatedFieldBuilderV3< + akka.persistence.typed.serialization.Crdts.VersionVector.Entry, + akka.persistence.typed.serialization.Crdts.VersionVector.Entry.Builder, + akka.persistence.typed.serialization.Crdts.VersionVector.EntryOrBuilder>( + entries_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + entries_ = null; + } + return entriesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final akka.protobufv3.internal.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:VersionVector) + } + + // @@protoc_insertion_point(class_scope:VersionVector) + private static final akka.persistence.typed.serialization.Crdts.VersionVector DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new akka.persistence.typed.serialization.Crdts.VersionVector(); + } + + public static akka.persistence.typed.serialization.Crdts.VersionVector getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + @java.lang.Deprecated + public static final akka.protobufv3.internal.Parser PARSER = + new akka.protobufv3.internal.AbstractParser() { + @java.lang.Override + public VersionVector parsePartialFrom( + akka.protobufv3.internal.CodedInputStream input, + akka.protobufv3.internal.ExtensionRegistryLite extensionRegistry) + throws akka.protobufv3.internal.InvalidProtocolBufferException { + return new VersionVector(input, extensionRegistry); + } + }; + + public static akka.protobufv3.internal.Parser parser() { + return PARSER; + } + + @java.lang.Override + public akka.protobufv3.internal.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public akka.persistence.typed.serialization.Crdts.VersionVector getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_Counter_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_Counter_fieldAccessorTable; + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_CounterUpdate_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_CounterUpdate_fieldAccessorTable; + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_ORSet_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_ORSet_fieldAccessorTable; + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_ORSetDeltaGroup_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_ORSetDeltaGroup_fieldAccessorTable; + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_ORSetDeltaGroup_Entry_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_ORSetDeltaGroup_Entry_fieldAccessorTable; + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_VersionVector_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_VersionVector_fieldAccessorTable; + private static final akka.protobufv3.internal.Descriptors.Descriptor + internal_static_VersionVector_Entry_descriptor; + private static final akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable + internal_static_VersionVector_Entry_fieldAccessorTable; + + public static akka.protobufv3.internal.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static akka.protobufv3.internal.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\013Crdts.proto\032\026ContainerFormats.proto\"\030\n" + + "\007Counter\022\r\n\005value\030\001 \002(\014\"\036\n\rCounterUpdate" + + "\022\r\n\005delta\030\001 \002(\014\"\304\001\n\005ORSet\022\020\n\010originDc\030\001 " + + "\002(\t\022\037\n\007vvector\030\002 \002(\0132\016.VersionVector\022\034\n\004" + + "dots\030\003 \003(\0132\016.VersionVector\022\026\n\016stringElem" + + "ents\030\004 \003(\t\022\027\n\013intElements\030\005 \003(\021B\002\020\001\022\030\n\014l" + + "ongElements\030\006 \003(\022B\002\020\001\022\037\n\rotherElements\030\007" + + " \003(\0132\010.Payload\"\201\001\n\017ORSetDeltaGroup\022\'\n\007en" + + "tries\030\001 \003(\0132\026.ORSetDeltaGroup.Entry\032E\n\005E" + + "ntry\022 \n\toperation\030\001 \002(\0162\r.ORSetDeltaOp\022\032" + + "\n\nunderlying\030\002 \002(\0132\006.ORSet\"]\n\rVersionVec" + + "tor\022%\n\007entries\030\001 \003(\0132\024.VersionVector.Ent" + + "ry\032%\n\005Entry\022\013\n\003key\030\001 \002(\t\022\017\n\007version\030\002 \002(" + + "\003*-\n\014ORSetDeltaOp\022\007\n\003Add\020\000\022\n\n\006Remove\020\001\022\010" + + "\n\004Full\020\002B(\n$akka.persistence.typed.seria" + + "lizationH\001" + }; + descriptor = + akka.protobufv3.internal.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new akka.protobufv3.internal.Descriptors.FileDescriptor[] { + akka.remote.ContainerFormats.getDescriptor(), + }); + internal_static_Counter_descriptor = getDescriptor().getMessageTypes().get(0); + internal_static_Counter_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_Counter_descriptor, + new java.lang.String[] { + "Value", + }); + internal_static_CounterUpdate_descriptor = getDescriptor().getMessageTypes().get(1); + internal_static_CounterUpdate_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_CounterUpdate_descriptor, + new java.lang.String[] { + "Delta", + }); + internal_static_ORSet_descriptor = getDescriptor().getMessageTypes().get(2); + internal_static_ORSet_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_ORSet_descriptor, + new java.lang.String[] { + "OriginDc", + "Vvector", + "Dots", + "StringElements", + "IntElements", + "LongElements", + "OtherElements", + }); + internal_static_ORSetDeltaGroup_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_ORSetDeltaGroup_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_ORSetDeltaGroup_descriptor, + new java.lang.String[] { + "Entries", + }); + internal_static_ORSetDeltaGroup_Entry_descriptor = + internal_static_ORSetDeltaGroup_descriptor.getNestedTypes().get(0); + internal_static_ORSetDeltaGroup_Entry_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_ORSetDeltaGroup_Entry_descriptor, + new java.lang.String[] { + "Operation", "Underlying", + }); + internal_static_VersionVector_descriptor = getDescriptor().getMessageTypes().get(4); + internal_static_VersionVector_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_VersionVector_descriptor, + new java.lang.String[] { + "Entries", + }); + internal_static_VersionVector_Entry_descriptor = + internal_static_VersionVector_descriptor.getNestedTypes().get(0); + internal_static_VersionVector_Entry_fieldAccessorTable = + new akka.protobufv3.internal.GeneratedMessageV3.FieldAccessorTable( + internal_static_VersionVector_Entry_descriptor, + new java.lang.String[] { + "Key", "Version", + }); + akka.remote.ContainerFormats.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/akka-persistence-typed/src/main/protobuf/Crdts.proto b/akka-persistence-typed/src/main/protobuf/Crdts.proto new file mode 100644 index 0000000000..cb95464f1c --- /dev/null +++ b/akka-persistence-typed/src/main/protobuf/Crdts.proto @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017-2020 Lightbend Inc. + */ + +syntax = "proto2"; + +option java_package = "akka.persistence.typed.serialization"; +option optimize_for = SPEED; +import "ContainerFormats.proto"; + +message Counter { + required bytes value = 1; +} + +message CounterUpdate { + required bytes delta = 1; +} + +message ORSet { + required string originDc = 1; + required VersionVector vvector = 2; + repeated VersionVector dots = 3; + repeated string stringElements = 4; + repeated sint32 intElements = 5 [packed=true]; + repeated sint64 longElements = 6 [packed=true]; + repeated Payload otherElements = 7; +} + +message ORSetDeltaGroup { + message Entry { + required ORSetDeltaOp operation = 1; + required ORSet underlying = 2; + } + + repeated Entry entries = 1; +} + +enum ORSetDeltaOp { + Add = 0; + Remove = 1; + Full = 2; +} + +message VersionVector { + message Entry { + required string key = 1; + required int64 version = 2; + } + repeated Entry entries = 1; +} diff --git a/akka-persistence-typed/src/main/resources/reference.conf b/akka-persistence-typed/src/main/resources/reference.conf index 99c897d34e..1d3b90a8ec 100644 --- a/akka-persistence-typed/src/main/resources/reference.conf +++ b/akka-persistence-typed/src/main/resources/reference.conf @@ -1,3 +1,18 @@ +akka.actor { + + serialization-identifiers."akka.persistence.typed.serialization.CrdtSerializer" = 40 + + serializers.replicated-crdts = "akka.persistence.typed.serialization.CrdtSerializer" + + serialization-bindings { + "akka.persistence.typed.crdt.Counter" = replicated-crdts + "akka.persistence.typed.crdt.Counter$Updated" = replicated-crdts + "akka.persistence.typed.internal.VersionVector" = replicated-crdts + "akka.persistence.typed.crdt.ORSet" = replicated-crdts + "akka.persistence.typed.crdt.ORSet$DeltaOp" = replicated-crdts + } +} + akka.persistence.typed { # Persistent actors stash while recovering or persisting events, diff --git a/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/Counter.scala b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/Counter.scala new file mode 100644 index 0000000000..06ea24ccd5 --- /dev/null +++ b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/Counter.scala @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt +import akka.annotation.ApiMayChange + +@ApiMayChange +object Counter { + val empty: Counter = Counter(0) + + final case class Updated(delta: BigInt) { + + /** + * JAVA API + */ + def this(delta: java.math.BigInteger) = this(delta: BigInt) + + /** + * JAVA API + */ + def this(delta: Int) = this(delta: BigInt) + } +} + +@ApiMayChange +final case class Counter(value: BigInt) extends OpCrdt[Counter.Updated] { + + override type T = Counter + + override def applyOperation(event: Counter.Updated): Counter = + copy(value = value + event.delta) +} diff --git a/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/LwwTime.scala b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/LwwTime.scala new file mode 100644 index 0000000000..5e34438e4b --- /dev/null +++ b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/LwwTime.scala @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt +import akka.annotation.ApiMayChange +import akka.persistence.typed.ReplicaId + +/** + * Utility class for comparing timestamp replica + * identifier when implementing last-writer wins. + */ +@ApiMayChange +final case class LwwTime(timestamp: Long, originReplica: ReplicaId) { + + /** + * Create a new `LwwTime` that has a `timestamp` that is + * `max` of the given timestamp and previous timestamp + 1, + * i.e. monotonically increasing. + */ + def increase(t: Long, replicaId: ReplicaId): LwwTime = + LwwTime(math.max(timestamp + 1, t), replicaId) + + /** + * Compare this `LwwTime` with the `other`. + * Greatest timestamp wins. If both timestamps are + * equal the `dc` identifiers are compared and the + * one sorted first in alphanumeric order wins. + */ + def isAfter(other: LwwTime): Boolean = { + if (timestamp > other.timestamp) true + else if (timestamp < other.timestamp) false + else if (other.originReplica.id.compareTo(originReplica.id) > 0) true + else false + } +} diff --git a/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/ORSet.scala b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/ORSet.scala new file mode 100644 index 0000000000..099e9ed358 --- /dev/null +++ b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/ORSet.scala @@ -0,0 +1,503 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt + +import scala.annotation.tailrec +import scala.collection.immutable +import akka.util.HashCode +import akka.annotation.{ ApiMayChange, InternalApi } +import akka.persistence.typed.ReplicaId +import akka.persistence.typed.crdt.ORSet.DeltaOp +import akka.persistence.typed.internal.{ ManyVersionVector, OneVersionVector, VersionVector } + +@ApiMayChange +object ORSet { + def empty[A](originReplica: ReplicaId): ORSet[A] = new ORSet(originReplica.id, Map.empty, VersionVector.empty) + def apply[A](originReplica: ReplicaId): ORSet[A] = empty(originReplica) + + /** + * Java API + */ + def create[A](originReplica: ReplicaId): ORSet[A] = empty(originReplica) + + /** + * Extract the [[ORSet#elements]]. + */ + def unapply[A](s: ORSet[A]): Option[Set[A]] = Some(s.elements) + + /** + * INTERNAL API + */ + @InternalApi private[akka] type Dot = VersionVector + + sealed trait DeltaOp extends Serializable { + def merge(that: DeltaOp): DeltaOp + } + + /** + * INTERNAL API + */ + @InternalApi private[akka] sealed abstract class AtomicDeltaOp[A] extends DeltaOp { + def underlying: ORSet[A] + } + + /** INTERNAL API */ + @InternalApi private[akka] final case class AddDeltaOp[A](underlying: ORSet[A]) extends AtomicDeltaOp[A] { + + override def merge(that: DeltaOp): DeltaOp = that match { + case AddDeltaOp(u) => + // Note that we only merge deltas originating from the same DC + AddDeltaOp( + new ORSet( + underlying.originReplica, + concatElementsMap(u.elementsMap.asInstanceOf[Map[A, Dot]]), + underlying.vvector.merge(u.vvector))) + case _: AtomicDeltaOp[A] => DeltaGroup(Vector(this, that)) + case DeltaGroup(ops) => DeltaGroup(this +: ops) + } + + private def concatElementsMap(thatMap: Map[A, Dot]): Map[A, Dot] = { + if (thatMap.size == 1) { + val head = thatMap.head + underlying.elementsMap.updated(head._1, head._2) + } else + underlying.elementsMap ++ thatMap + } + } + + /** INTERNAL API */ + @InternalApi private[akka] final case class RemoveDeltaOp[A](underlying: ORSet[A]) extends AtomicDeltaOp[A] { + if (underlying.size != 1) + throw new IllegalArgumentException(s"RemoveDeltaOp should contain one removed element, but was $underlying") + + override def merge(that: DeltaOp): DeltaOp = that match { + case _: AtomicDeltaOp[A] => DeltaGroup(Vector(this, that)) // keep it simple for removals + case DeltaGroup(ops) => DeltaGroup(this +: ops) + } + } + + /** INTERNAL API: Used for `clear` but could be used for other cases also */ + @InternalApi private[akka] final case class FullStateDeltaOp[A](underlying: ORSet[A]) extends AtomicDeltaOp[A] { + override def merge(that: DeltaOp): DeltaOp = that match { + case _: AtomicDeltaOp[A] => DeltaGroup(Vector(this, that)) + case DeltaGroup(ops) => DeltaGroup(this +: ops) + } + } + + /** + * INTERNAL API + */ + @InternalApi private[akka] final case class DeltaGroup[A](ops: immutable.IndexedSeq[DeltaOp]) extends DeltaOp { + override def merge(that: DeltaOp): DeltaOp = that match { + case thatAdd: AddDeltaOp[A] => + // merge AddDeltaOp into last AddDeltaOp in the group, if possible + ops.last match { + case thisAdd: AddDeltaOp[A] => DeltaGroup(ops.dropRight(1) :+ thisAdd.merge(thatAdd)) + case _ => DeltaGroup(ops :+ thatAdd) + } + case DeltaGroup(thatOps) => DeltaGroup(ops ++ thatOps) + case _ => DeltaGroup(ops :+ that) + } + + } + + /** + * INTERNAL API + * Subtract the `vvector` from the `dot`. + * What this means is that any (dc, version) pair in + * `dot` that is <= an entry in `vvector` is removed from `dot`. + * Example [{a, 3}, {b, 2}, {d, 14}, {g, 22}] - + * [{a, 4}, {b, 1}, {c, 1}, {d, 14}, {e, 5}, {f, 2}] = + * [{b, 2}, {g, 22}] + */ + @InternalApi private[akka] def subtractDots(dot: Dot, vvector: VersionVector): Dot = { + + @tailrec def dropDots(remaining: List[(String, Long)], acc: List[(String, Long)]): List[(String, Long)] = + remaining match { + case Nil => acc + case (d @ (node, v1)) :: rest => + val v2 = vvector.versionAt(node) + if (v2 >= v1) + // dot is dominated by version vector, drop it + dropDots(rest, acc) + else + dropDots(rest, d :: acc) + } + + if (dot.isEmpty) + VersionVector.empty + else { + dot match { + case OneVersionVector(node, v1) => + // if dot is dominated by version vector, drop it + if (vvector.versionAt(node) >= v1) VersionVector.empty + else dot + + case ManyVersionVector(vs) => + val remaining = vs.toList + val newDots = dropDots(remaining, Nil) + VersionVector(newDots) + } + } + } + + /** + * INTERNAL API + * @see [[ORSet#merge]] + */ + @InternalApi private[akka] def mergeCommonKeys[A]( + commonKeys: Set[A], + lhs: ORSet[A], + rhs: ORSet[A]): Map[A, ORSet.Dot] = + mergeCommonKeys(commonKeys.iterator, lhs, rhs) + + private def mergeCommonKeys[A](commonKeys: Iterator[A], lhs: ORSet[A], rhs: ORSet[A]): Map[A, ORSet.Dot] = { + commonKeys.foldLeft(Map.empty[A, ORSet.Dot]) { + case (acc, k) => + val lhsDots = lhs.elementsMap(k) + val rhsDots = rhs.elementsMap(k) + (lhsDots, rhsDots) match { + case (OneVersionVector(n1, v1), OneVersionVector(n2, v2)) => + if (n1 == n2 && v1 == v2) + // one single common dot + acc.updated(k, lhsDots) + else { + // no common, lhsUniqueDots == lhsDots, rhsUniqueDots == rhsDots + val lhsKeep = ORSet.subtractDots(lhsDots, rhs.vvector) + val rhsKeep = ORSet.subtractDots(rhsDots, lhs.vvector) + val merged = lhsKeep.merge(rhsKeep) + // Perfectly possible that an item in both sets should be dropped + if (merged.isEmpty) acc + else acc.updated(k, merged) + } + case (ManyVersionVector(lhsVs), ManyVersionVector(rhsVs)) => + val commonDots = lhsVs.filter { + case (thisDotNode, v) => rhsVs.get(thisDotNode).exists(_ == v) + } + val commonDotsKeys = commonDots.keys + val lhsUniqueDots = lhsVs -- commonDotsKeys + val rhsUniqueDots = rhsVs -- commonDotsKeys + val lhsKeep = ORSet.subtractDots(VersionVector(lhsUniqueDots), rhs.vvector) + val rhsKeep = ORSet.subtractDots(VersionVector(rhsUniqueDots), lhs.vvector) + val merged = lhsKeep.merge(rhsKeep).merge(VersionVector(commonDots)) + // Perfectly possible that an item in both sets should be dropped + if (merged.isEmpty) acc + else acc.updated(k, merged) + case (ManyVersionVector(lhsVs), OneVersionVector(n2, v2)) => + val commonDots = lhsVs.filter { + case (n1, v1) => v1 == v2 && n1 == n2 + } + val commonDotsKeys = commonDots.keys + val lhsUniqueDots = lhsVs -- commonDotsKeys + val rhsUnique = if (commonDotsKeys.isEmpty) rhsDots else VersionVector.empty + val lhsKeep = ORSet.subtractDots(VersionVector(lhsUniqueDots), rhs.vvector) + val rhsKeep = ORSet.subtractDots(rhsUnique, lhs.vvector) + val merged = lhsKeep.merge(rhsKeep).merge(VersionVector(commonDots)) + // Perfectly possible that an item in both sets should be dropped + if (merged.isEmpty) acc + else acc.updated(k, merged) + case (OneVersionVector(n1, v1), ManyVersionVector(rhsVs)) => + val commonDots = rhsVs.filter { + case (n2, v2) => v1 == v2 && n1 == n2 + } + val commonDotsKeys = commonDots.keys + val lhsUnique = if (commonDotsKeys.isEmpty) lhsDots else VersionVector.empty + val rhsUniqueDots = rhsVs -- commonDotsKeys + val lhsKeep = ORSet.subtractDots(lhsUnique, rhs.vvector) + val rhsKeep = ORSet.subtractDots(VersionVector(rhsUniqueDots), lhs.vvector) + val merged = lhsKeep.merge(rhsKeep).merge(VersionVector(commonDots)) + // Perfectly possible that an item in both sets should be dropped + if (merged.isEmpty) acc + else acc.updated(k, merged) + } + } + } + + /** + * INTERNAL API + * @see [[ORSet#merge]] + */ + @InternalApi private[akka] def mergeDisjointKeys[A]( + keys: Set[A], + elementsMap: Map[A, ORSet.Dot], + vvector: VersionVector, + accumulator: Map[A, ORSet.Dot]): Map[A, ORSet.Dot] = + mergeDisjointKeys(keys.iterator, elementsMap, vvector, accumulator) + + private def mergeDisjointKeys[A]( + keys: Iterator[A], + elementsMap: Map[A, ORSet.Dot], + vvector: VersionVector, + accumulator: Map[A, ORSet.Dot]): Map[A, ORSet.Dot] = { + keys.foldLeft(accumulator) { + case (acc, k) => + val dots = elementsMap(k) + if (vvector > dots || vvector == dots) + acc + else { + // Optimise the set of stored dots to include only those unseen + val newDots = subtractDots(dots, vvector) + acc.updated(k, newDots) + } + } + } +} + +/** + * Implements a 'Observed Remove Set' operation based CRDT, also called a 'OR-Set'. + * Elements can be added and removed any number of times. Concurrent add wins + * over remove. + * + * It is not implemented as in the paper + * A comprehensive study of Convergent and Commutative Replicated Data Types. + * This is more space efficient and doesn't accumulate garbage for removed elements. + * It is described in the paper + * An optimized conflict-free replicated set + * The implementation is inspired by the Riak DT + * riak_dt_orswot. + * + * The ORSet has a version vector that is incremented when an element is added to + * the set. The `DC -> count` pair for that increment is stored against the + * element as its "birth dot". Every time the element is re-added to the set, + * its "birth dot" is updated to that of the `DC -> count` version vector entry + * resulting from the add. When an element is removed, we simply drop it, no tombstones. + * + * When an element exists in replica A and not replica B, is it because A added + * it and B has not yet seen that, or that B removed it and A has not yet seen that? + * In this implementation we compare the `dot` of the present element to the version vector + * in the Set it is absent from. If the element dot is not "seen" by the Set version vector, + * that means the other set has yet to see this add, and the item is in the merged + * Set. If the Set version vector dominates the dot, that means the other Set has removed this + * element already, and the item is not in the merged Set. + * + * This class is immutable, i.e. "modifying" methods return a new instance. + */ +@ApiMayChange +@SerialVersionUID(1L) +final class ORSet[A] private[akka] ( + val originReplica: String, + private[akka] val elementsMap: Map[A, ORSet.Dot], + private[akka] val vvector: VersionVector) + extends OpCrdt[DeltaOp] + with Serializable { + + type T = ORSet[A] + type D = ORSet.DeltaOp + + /** + * Scala API + */ + def elements: Set[A] = elementsMap.keySet + + /** + * Java API + */ + def getElements(): java.util.Set[A] = { + import scala.collection.JavaConverters._ + elements.asJava + } + + def contains(a: A): Boolean = elementsMap.contains(a) + + def isEmpty: Boolean = elementsMap.isEmpty + + def size: Int = elementsMap.size + + /** + * Adds an element to the set + */ + def +(element: A): ORSet.DeltaOp = add(element) + + /** + * Adds an element to the set + */ + def add(element: A): ORSet.DeltaOp = { + val newVvector = vvector + originReplica + val newDot = VersionVector(originReplica, newVvector.versionAt(originReplica)) + ORSet.AddDeltaOp(new ORSet(originReplica, Map(element -> newDot), newDot)) + } + + /** + * Java API: Add several elements to the set. + * `elems` must not be empty. + */ + def addAll(elems: java.util.Set[A]): ORSet.DeltaOp = { + import scala.collection.JavaConverters._ + addAll(elems.asScala.toSet) + } + + /** + * Scala API: Add several elements to the set. + * `elems` must not be empty. + */ + def addAll(elems: Set[A]): ORSet.DeltaOp = { + if (elems.size == 0) throw new IllegalArgumentException("addAll elems must not be empty") + else if (elems.size == 1) add(elems.head) + else { + val (first, rest) = elems.splitAt(1) + val firstOp = add(first.head) + val (mergedOps, _) = rest.foldLeft((firstOp, applyOperation(firstOp))) { + case ((op, state), elem) => + val nextOp = state.add(elem) + val mergedOp = op.merge(nextOp) + (mergedOp, state.applyOperation(nextOp)) + } + mergedOps + } + } + + /** + * Removes an element from the set. + */ + def -(element: A): ORSet.DeltaOp = remove(element) + + /** + * Removes an element from the set. + */ + def remove(element: A): ORSet.DeltaOp = { + val deltaDot = VersionVector(originReplica, vvector.versionAt(originReplica)) + ORSet.RemoveDeltaOp(new ORSet(originReplica, Map(element -> deltaDot), vvector)) + } + + /** + * Java API: Remove several elements from the set. + * `elems` must not be empty. + */ + def removeAll(elems: java.util.Set[A]): ORSet.DeltaOp = { + import scala.collection.JavaConverters._ + removeAll(elems.asScala.toSet) + } + + /** + * Scala API: Remove several elements from the set. + * `elems` must not be empty. + */ + def removeAll(elems: Set[A]): ORSet.DeltaOp = { + if (elems.size == 0) throw new IllegalArgumentException("removeAll elems must not be empty") + else if (elems.size == 1) remove(elems.head) + else { + val (first, rest) = elems.splitAt(1) + val firstOp = remove(first.head) + val (mergedOps, _) = rest.foldLeft((firstOp, applyOperation(firstOp))) { + case ((op, state), elem) => + val nextOp = state.remove(elem) + val mergedOp = op.merge(nextOp) + (mergedOp, state.applyOperation(nextOp)) + } + mergedOps + } + } + + /** + * Removes all elements from the set, but keeps the history. + * This has the same result as using [[#remove]] for each + * element, but it is more efficient. + */ + def clear(): ORSet.DeltaOp = { + val newFullState = new ORSet[A](originReplica, elementsMap = Map.empty, vvector) + ORSet.FullStateDeltaOp(newFullState) + } + + /** + * When element is in this Set but not in that Set: + * Compare the "birth dot" of the present element to the version vector in the Set it is absent from. + * If the element dot is not "seen" by other Set version vector, that means the other set has yet to + * see this add, and the element is to be in the merged Set. + * If the other Set version vector dominates the dot, that means the other Set has removed + * the element already, and the element is not to be in the merged Set. + * + * When element in both this Set and in that Set: + * Some dots may still need to be shed. If this Set has dots that the other Set does not have, + * and the other Set version vector dominates those dots, then we need to drop those dots. + * Keep only common dots, and dots that are not dominated by the other sides version vector + */ + private def merge(that: ORSet[A], addDeltaOp: Boolean): ORSet[A] = { + if (this eq that) this + else { + val commonKeys = + if (this.elementsMap.size < that.elementsMap.size) + this.elementsMap.keysIterator.filter(that.elementsMap.contains) + else + that.elementsMap.keysIterator.filter(this.elementsMap.contains) + val entries00 = ORSet.mergeCommonKeys(commonKeys, this, that) + val entries0 = + if (addDeltaOp) + entries00 ++ this.elementsMap.filter { case (elem, _) => !that.elementsMap.contains(elem) } else { + val thisUniqueKeys = this.elementsMap.keysIterator.filterNot(that.elementsMap.contains) + ORSet.mergeDisjointKeys(thisUniqueKeys, this.elementsMap, that.vvector, entries00) + } + val thatUniqueKeys = that.elementsMap.keysIterator.filterNot(this.elementsMap.contains) + val entries = ORSet.mergeDisjointKeys(thatUniqueKeys, that.elementsMap, this.vvector, entries0) + val mergedVvector = this.vvector.merge(that.vvector) + + new ORSet(originReplica, entries, mergedVvector) + } + } + + override def applyOperation(thatDelta: ORSet.DeltaOp): ORSet[A] = { + thatDelta match { + case d: ORSet.AddDeltaOp[A] => merge(d.underlying, addDeltaOp = true) + case d: ORSet.RemoveDeltaOp[A] => mergeRemoveDelta(d) + case d: ORSet.FullStateDeltaOp[A] => merge(d.underlying, addDeltaOp = false) + case ORSet.DeltaGroup(ops) => + ops.foldLeft(this) { + case (acc, op: ORSet.AddDeltaOp[A]) => acc.merge(op.underlying, addDeltaOp = true) + case (acc, op: ORSet.RemoveDeltaOp[A]) => acc.mergeRemoveDelta(op) + case (acc, op: ORSet.FullStateDeltaOp[A]) => acc.merge(op.underlying, addDeltaOp = false) + case (_, _: ORSet.DeltaGroup[A]) => + throw new IllegalArgumentException("ORSet.DeltaGroup should not be nested") + } + } + } + + private def mergeRemoveDelta(thatDelta: ORSet.RemoveDeltaOp[A]): ORSet[A] = { + val that = thatDelta.underlying + val (elem, thatDot) = that.elementsMap.head + def deleteDots = that.vvector.versionsIterator + def deleteDotsNodes = deleteDots.map { case (dotNode, _) => dotNode } + val newElementsMap = { + val thisDotOption = this.elementsMap.get(elem) + val deleteDotsAreGreater = deleteDots.forall { + case (dotNode, dotV) => + thisDotOption match { + case Some(thisDot) => thisDot.versionAt(dotNode) <= dotV + case None => false + } + } + if (deleteDotsAreGreater) { + thisDotOption match { + case Some(thisDot) => + if (thisDot.versionsIterator.forall { case (thisDotNode, _) => deleteDotsNodes.contains(thisDotNode) }) + elementsMap - elem + else elementsMap + case None => + elementsMap + } + } else + elementsMap + } + + val newVvector = vvector.merge(thatDot) + new ORSet(originReplica, newElementsMap, newVvector) + } + + // this class cannot be a `case class` because we need different `unapply` + + override def toString: String = s"OR$elements" + + override def equals(o: Any): Boolean = o match { + case other: ORSet[_] => + originReplica == other.originReplica && vvector == other.vvector && elementsMap == other.elementsMap + case _ => false + } + + override def hashCode: Int = { + var result = HashCode.SEED + result = HashCode.hash(result, originReplica) + result = HashCode.hash(result, elementsMap) + result = HashCode.hash(result, vvector) + result + } +} diff --git a/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/OpCrdt.scala b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/OpCrdt.scala new file mode 100644 index 0000000000..bcd3b92157 --- /dev/null +++ b/akka-persistence-typed/src/main/scala/akka/persistence/typed/crdt/OpCrdt.scala @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2020 Lightbend Inc. + */ + +package akka.persistence.typed.crdt + +import akka.annotation.{ ApiMayChange, DoNotInherit } + +@ApiMayChange +@DoNotInherit +trait OpCrdt[Operation] { self => + type T <: OpCrdt[Operation] { type T = self.T } + + def applyOperation(op: Operation): T +} diff --git a/akka-persistence-typed/src/main/scala/akka/persistence/typed/scaladsl/ActiveActiveEventSourcing.scala b/akka-persistence-typed/src/main/scala/akka/persistence/typed/scaladsl/ActiveActiveEventSourcing.scala index 6c15fcc5d6..33a4a53e04 100644 --- a/akka-persistence-typed/src/main/scala/akka/persistence/typed/scaladsl/ActiveActiveEventSourcing.scala +++ b/akka-persistence-typed/src/main/scala/akka/persistence/typed/scaladsl/ActiveActiveEventSourcing.scala @@ -8,34 +8,6 @@ import akka.persistence.typed.PersistenceId import akka.persistence.typed.ReplicaId import akka.util.WallClock -/** - * Utility class for comparing timestamp and data center - * identifier when implementing last-writer wins. - */ -final case class LwwTime(timestamp: Long, originDc: ReplicaId) { - - /** - * Create a new `LwwTime` that has a `timestamp` that is - * `max` of the given timestamp and previous timestamp + 1, - * i.e. monotonically increasing. - */ - def increase(t: Long, replicaId: ReplicaId): LwwTime = - LwwTime(math.max(timestamp + 1, t), replicaId) - - /** - * Compare this `LwwTime` with the `other`. - * Greatest timestamp wins. If both timestamps are - * equal the `dc` identifiers are compared and the - * one sorted first in alphanumeric order wins. - */ - def isAfter(other: LwwTime): Boolean = { - if (timestamp > other.timestamp) true - else if (timestamp < other.timestamp) false - else if (other.originDc.id.compareTo(originDc.id) > 0) true - else false - } -} - // FIXME docs trait ActiveActiveContext { diff --git a/akka-persistence-typed/src/main/scala/akka/persistence/typed/serialization/CrdtSerializer.scala b/akka-persistence-typed/src/main/scala/akka/persistence/typed/serialization/CrdtSerializer.scala new file mode 100644 index 0000000000..ab193b6f85 --- /dev/null +++ b/akka-persistence-typed/src/main/scala/akka/persistence/typed/serialization/CrdtSerializer.scala @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2009-2020 Lightbend Inc. + */ + +package akka.persistence.typed.serialization + +import java.io.NotSerializableException +import java.util.{ ArrayList, Collections, Comparator } +import java.{ lang => jl } + +import akka.actor.ExtendedActorSystem +import akka.annotation.InternalApi +import akka.persistence.typed.crdt.{ Counter, ORSet } +import akka.persistence.typed.internal.VersionVector +import akka.protobufv3.internal.ByteString +import akka.remote.ContainerFormats.Payload +import akka.remote.serialization.WrappedPayloadSupport +import akka.serialization.{ BaseSerializer, SerializerWithStringManifest } + +import scala.annotation.tailrec +import scala.collection.JavaConverters._ +import scala.collection.immutable.TreeMap + +object CrdtSerializer { + object Comparator extends Comparator[Payload] { + override def compare(a: Payload, b: Payload): Int = { + val aByteString = a.getEnclosedMessage + val bByteString = b.getEnclosedMessage + val aSize = aByteString.size + val bSize = bByteString.size + if (aSize == bSize) { + val aIter = aByteString.iterator + val bIter = bByteString.iterator + @tailrec def findDiff(): Int = { + if (aIter.hasNext) { + val aByte = aIter.nextByte() + val bByte = bIter.nextByte() + if (aByte < bByte) -1 + else if (aByte > bByte) 1 + else findDiff() + } else 0 + } + findDiff() + } else if (aSize < bSize) -1 + else 1 + } + } +} + +/** + * INTERNAL API + */ +@InternalApi private[akka] final class CrdtSerializer(val system: ExtendedActorSystem) + extends SerializerWithStringManifest + with BaseSerializer { + + private val wrappedSupport = new WrappedPayloadSupport(system) + + private val CrdtCounterManifest = "AA" + private val CrdtCounterUpdatedManifest = "AB" + + private val ORSetManifest = "CA" + private val ORSetAddManifest = "CB" + private val ORSetRemoveManifest = "CC" + private val ORSetFullManifest = "CD" + private val ORSetDeltaGroupManifest = "CE" + + private val VersionVectorManifest = "DA" + + def manifest(o: AnyRef) = o match { + case _: ORSet[_] => ORSetManifest + case _: ORSet.AddDeltaOp[_] => ORSetAddManifest + case _: ORSet.RemoveDeltaOp[_] => ORSetRemoveManifest + case _: ORSet.DeltaGroup[_] => ORSetDeltaGroupManifest + case _: ORSet.FullStateDeltaOp[_] => ORSetFullManifest + + case _: Counter => CrdtCounterManifest + case _: Counter.Updated => CrdtCounterUpdatedManifest + + case _: VersionVector => VersionVectorManifest + case _ => + throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass} in [${getClass.getName}]") + } + + def toBinary(o: AnyRef) = o match { + case m: ORSet[_] => orsetToProto(m).toByteArray + case m: ORSet.AddDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet.RemoveDeltaOp[_] => orsetToProto(m.underlying).toByteArray + case m: ORSet.DeltaGroup[_] => orsetDeltaGroupToProto(m).toByteArray + case m: ORSet.FullStateDeltaOp[_] => orsetToProto(m.underlying).toByteArray + + case m: Counter => counterToProtoByteArray(m) + case m: Counter.Updated => counterUpdatedToProtoBufByteArray(m) + case m: VersionVector => versionVectorToProto(m).toByteArray + case _ => + throw new IllegalArgumentException(s"Can't serialize object of type ${o.getClass}") + } + + def fromBinary(bytes: Array[Byte], manifest: String) = manifest match { + case ORSetManifest => orsetFromBinary(bytes) + case ORSetAddManifest => orsetAddFromBinary(bytes) + case ORSetRemoveManifest => orsetRemoveFromBinary(bytes) + case ORSetFullManifest => orsetFullFromBinary(bytes) + case ORSetDeltaGroupManifest => orsetDeltaGroupFromBinary(bytes) + + case CrdtCounterManifest => counterFromBinary(bytes) + case CrdtCounterUpdatedManifest => counterUpdatedFromBinary(bytes) + + case VersionVectorManifest => versionVectorFromBinary(bytes) + case _ => + throw new NotSerializableException( + s"Unimplemented deserialization of message with manifest [$manifest] in [${getClass.getName}]") + } + + def counterFromBinary(bytes: Array[Byte]): Counter = + Counter(BigInt(Crdts.Counter.parseFrom(bytes).getValue.toByteArray)) + + def counterUpdatedFromBinary(bytes: Array[Byte]): Counter.Updated = + Counter.Updated(BigInt(Crdts.CounterUpdate.parseFrom(bytes).getDelta.toByteArray)) + + def counterToProtoByteArray(counter: Counter): Array[Byte] = + Crdts.Counter.newBuilder().setValue(ByteString.copyFrom(counter.value.toByteArray)).build().toByteArray + + def counterUpdatedToProtoBufByteArray(updated: Counter.Updated): Array[Byte] = + Crdts.CounterUpdate.newBuilder().setDelta(ByteString.copyFrom(updated.delta.toByteArray)).build().toByteArray + + def orsetToProto(orset: ORSet[_]): Crdts.ORSet = + orsetToProtoImpl(orset.asInstanceOf[ORSet[Any]]) + + private def orsetToProtoImpl(orset: ORSet[Any]): Crdts.ORSet = { + val b = Crdts.ORSet.newBuilder().setOriginDc(orset.originReplica).setVvector(versionVectorToProto(orset.vvector)) + // using java collections and sorting for performance (avoid conversions) + val stringElements = new ArrayList[String] + val intElements = new ArrayList[Integer] + val longElements = new ArrayList[jl.Long] + val otherElements = new ArrayList[Payload] + var otherElementsMap = Map.empty[Payload, Any] + orset.elementsMap.keysIterator.foreach { + case s: String => stringElements.add(s) + case i: Int => intElements.add(i) + case l: Long => longElements.add(l) + case other => + val enclosedMsg = wrappedSupport.payloadBuilder(other).build() + otherElements.add(enclosedMsg) + // need the mapping back to the `other` when adding dots + otherElementsMap = otherElementsMap.updated(enclosedMsg, other) + } + + def addDots(elements: ArrayList[_]): Unit = { + // add corresponding dots in same order + val iter = elements.iterator + while (iter.hasNext) { + val element = iter.next() match { + case enclosedMsg: Payload => otherElementsMap(enclosedMsg) + case e => e + } + b.addDots(versionVectorToProto(orset.elementsMap(element))) + } + } + + if (!stringElements.isEmpty) { + Collections.sort(stringElements) + b.addAllStringElements(stringElements) + addDots(stringElements) + } + if (!intElements.isEmpty) { + Collections.sort(intElements) + b.addAllIntElements(intElements) + addDots(intElements) + } + if (!longElements.isEmpty) { + Collections.sort(longElements) + b.addAllLongElements(longElements) + addDots(longElements) + } + if (!otherElements.isEmpty) { + Collections.sort(otherElements, CrdtSerializer.Comparator) + b.addAllOtherElements(otherElements) + addDots(otherElements) + } + + b.build() + } + + def orsetFromBinary(bytes: Array[Byte]): ORSet[Any] = + orsetFromProto(Crdts.ORSet.parseFrom(bytes)) + + private def orsetAddFromBinary(bytes: Array[Byte]): ORSet.AddDeltaOp[Any] = + new ORSet.AddDeltaOp(orsetFromProto(Crdts.ORSet.parseFrom(bytes))) + + private def orsetRemoveFromBinary(bytes: Array[Byte]): ORSet.RemoveDeltaOp[Any] = + new ORSet.RemoveDeltaOp(orsetFromProto(Crdts.ORSet.parseFrom(bytes))) + + private def orsetFullFromBinary(bytes: Array[Byte]): ORSet.FullStateDeltaOp[Any] = + new ORSet.FullStateDeltaOp(orsetFromProto(Crdts.ORSet.parseFrom(bytes))) + + private def orsetDeltaGroupToProto(deltaGroup: ORSet.DeltaGroup[_]): Crdts.ORSetDeltaGroup = { + def createEntry(opType: Crdts.ORSetDeltaOp, u: ORSet[_]) = { + Crdts.ORSetDeltaGroup.Entry.newBuilder().setOperation(opType).setUnderlying(orsetToProto(u)) + } + + val b = Crdts.ORSetDeltaGroup.newBuilder() + deltaGroup.ops.foreach { + case ORSet.AddDeltaOp(u) => + b.addEntries(createEntry(Crdts.ORSetDeltaOp.Add, u)) + case ORSet.RemoveDeltaOp(u) => + b.addEntries(createEntry(Crdts.ORSetDeltaOp.Remove, u)) + case ORSet.FullStateDeltaOp(u) => + b.addEntries(createEntry(Crdts.ORSetDeltaOp.Full, u)) + case ORSet.DeltaGroup(_) => + throw new IllegalArgumentException("ORSet.DeltaGroup should not be nested") + } + b.build() + } + + private def orsetDeltaGroupFromBinary(bytes: Array[Byte]): ORSet.DeltaGroup[Any] = { + val deltaGroup = Crdts.ORSetDeltaGroup.parseFrom(bytes) + val ops: Vector[ORSet.DeltaOp] = + deltaGroup.getEntriesList.asScala.map { entry => + if (entry.getOperation == Crdts.ORSetDeltaOp.Add) + ORSet.AddDeltaOp(orsetFromProto(entry.getUnderlying)) + else if (entry.getOperation == Crdts.ORSetDeltaOp.Remove) + ORSet.RemoveDeltaOp(orsetFromProto(entry.getUnderlying)) + else if (entry.getOperation == Crdts.ORSetDeltaOp.Full) + ORSet.FullStateDeltaOp(orsetFromProto(entry.getUnderlying)) + else + throw new NotSerializableException(s"Unknow ORSet delta operation ${entry.getOperation}") + }.toVector + ORSet.DeltaGroup(ops) + } + + def orsetFromProto(orset: Crdts.ORSet): ORSet[Any] = { + val elements: Iterator[Any] = + (orset.getStringElementsList.iterator.asScala ++ + orset.getIntElementsList.iterator.asScala ++ + orset.getLongElementsList.iterator.asScala ++ + orset.getOtherElementsList.iterator.asScala.map(wrappedSupport.deserializePayload)) + + val dots = orset.getDotsList.asScala.map(versionVectorFromProto).iterator + val elementsMap = elements.zip(dots).toMap + + new ORSet(orset.getOriginDc, elementsMap, vvector = versionVectorFromProto(orset.getVvector)) + } + + def versionVectorToProto(versionVector: VersionVector): Crdts.VersionVector = { + val b = Crdts.VersionVector.newBuilder() + versionVector.versionsIterator.foreach { + case (key, value) => b.addEntries(Crdts.VersionVector.Entry.newBuilder().setKey(key).setVersion(value)) + } + b.build() + } + + def versionVectorFromBinary(bytes: Array[Byte]): VersionVector = + versionVectorFromProto(Crdts.VersionVector.parseFrom(bytes)) + + def versionVectorFromProto(versionVector: Crdts.VersionVector): VersionVector = { + val entries = versionVector.getEntriesList + if (entries.isEmpty) + VersionVector.empty + else if (entries.size == 1) + VersionVector(entries.get(0).getKey, entries.get(0).getVersion) + else { + val versions = TreeMap.empty[String, Long] ++ versionVector.getEntriesList.asScala.map(entry => + entry.getKey -> entry.getVersion) + VersionVector(versions) + } + } + +} diff --git a/build.sbt b/build.sbt index 85977aabed..87c6ce871a 100644 --- a/build.sbt +++ b/build.sbt @@ -461,6 +461,7 @@ lazy val persistenceTyped = akkaModule("akka-persistence-typed") .dependsOn( actorTyped, streamTyped, + remote, persistence % "compile->compile;test->test", persistenceQuery, actorTestkitTyped % "test->test", @@ -470,6 +471,9 @@ lazy val persistenceTyped = akkaModule("akka-persistence-typed") .settings(javacOptions += "-parameters") // for Jackson .settings(Dependencies.persistenceShared) .settings(AutomaticModuleName.settings("akka.persistence.typed")) + .settings(Protobuf.settings) + // To be able to import ContainerFormats.proto + .settings(Protobuf.importPath := Some(baseDirectory.value / ".." / "akka-remote" / "src" / "main" / "protobuf")) .settings(OSGi.persistenceTyped) lazy val clusterTyped = akkaModule("akka-cluster-typed")