X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FReplicatedLogEntry.java;h=360f6b690376c1c413b1a2f04bc8a7e946400758;hp=f501c4d37f1f864c7a0551c119403d2b76457d1d;hb=HEAD;hpb=0eb621d29daaf08979c356e2148e99c48458e169 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java index f501c4d37f..360f6b6903 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogEntry.java @@ -8,30 +8,60 @@ package org.opendaylight.controller.cluster.raft; -import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; +import org.opendaylight.controller.cluster.raft.messages.Payload; /** - * Represents one entry in the replicated log + * Represents one entry in the replicated log. */ public interface ReplicatedLogEntry { /** - * The data stored in that entry + * Returns the payload/data to be replicated. * - * @return + * @return the payload/data */ Payload getData(); /** - * The term stored in that entry + * Returns the term of the entry. * - * @return + * @return the term */ long getTerm(); /** - * The index of the entry + * Returns the index of the entry. * - * @return + * @return the index */ long getIndex(); + + /** + * Returns the size of the entry in bytes. An approximate number may be good enough. + * + * @return the size of the entry in bytes. + */ + int size(); + + /** + * Return the estimate of serialized size of this entry when passed through serialization. The estimate needs to + * be reasonably accurate and should err on the side of caution and report a slightly-higher size in face of + * uncertainty. + * + * @return An estimate of serialized size. + */ + int serializedSize(); + + /** + * Checks if persistence is pending for this entry. + * + * @return true if persistence is pending, false otherwise. + */ + boolean isPersistencePending(); + + /** + * Sets whether or not persistence is pending for this entry. + * + * @param pending the new setting. + */ + void setPersistencePending(boolean pending); }