X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardDataTreeMetadata.java;h=76719f94f839f13f127dc3ed180fa6c4fffdf733;hb=99f80f27bee37bb23e345420bf14bb7bb4793c28;hp=d10a44d7ab34a8ef375d553ff05f0b6a41d2b678;hpb=4bbbd57c8f96e864d4353c1bdbce0dc068a6a57b;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMetadata.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMetadata.java index d10a44d7ab..76719f94f8 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMetadata.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMetadata.java @@ -8,29 +8,66 @@ package org.opendaylight.controller.cluster.datastore; import com.google.common.base.Verify; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.persisted.ShardDataTreeSnapshotMetadata; +import org.opendaylight.controller.cluster.datastore.utils.ImmutableUnsignedLongSet; abstract class ShardDataTreeMetadata> { - final void applySnapshot(@Nonnull final ShardDataTreeSnapshotMetadata snapshot) { + /** + * Apply a recovered metadata snapshot. + * + * @param snapshot Metadata snapshot + */ + final void applySnapshot(final @NonNull ShardDataTreeSnapshotMetadata snapshot) { Verify.verify(getSupportedType().isInstance(snapshot), "Snapshot %s misrouted to handler of %s", snapshot, getSupportedType()); doApplySnapshot(getSupportedType().cast(snapshot)); } + /** + * Reset metadata to empty state. + */ abstract void reset(); - abstract void doApplySnapshot(@Nonnull T snapshot); + /** + * Apply a recovered metadata snapshot. This is not a public entrypoint, just an interface between the base class + * and its subclasses. + * + * @param snapshot Metadata snapshot + */ + abstract void doApplySnapshot(@NonNull T snapshot); - abstract @Nonnull Class getSupportedType(); + /** + * Return the type of metadata snapshot this object supports. + * + * @return Metadata type + */ + abstract @NonNull Class getSupportedType(); + /** + * Take a snapshot of current metadata state. + * + * @return Metadata snapshot, or null if the metadata is empty. + */ abstract @Nullable T toSnapshot(); // Lifecycle events + + abstract void onTransactionAborted(TransactionIdentifier txId); + abstract void onTransactionCommitted(TransactionIdentifier txId); + + abstract void onTransactionPurged(TransactionIdentifier txId); + + abstract void onTransactionsSkipped(LocalHistoryIdentifier historyId, ImmutableUnsignedLongSet txIds); + + abstract void onHistoryCreated(LocalHistoryIdentifier historyId); + abstract void onHistoryClosed(LocalHistoryIdentifier historyId); + abstract void onHistoryPurged(LocalHistoryIdentifier historyId); + }