X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardDataTreeMetadata.java;h=7db3a228c8023f16f9ab975c26f4c76effe7e44c;hb=583f30d1c7a8199b401c9393745c62fe27b5ced8;hp=8a62a2bae0b217050b7b5e17b75a6767c4e55abe;hpb=6276a65120a674b545ea787a5e1d9311bcdbf2af;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 8a62a2bae0..7db3a228c8 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 @@ -10,24 +10,61 @@ package org.opendaylight.controller.cluster.datastore; import com.google.common.base.Verify; import javax.annotation.Nonnull; import javax.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; abstract class ShardDataTreeMetadata> { + /** + * Apply a recovered metadata snapshot. + * + * @param snapshot Metadata snapshot + */ final void applySnapshot(@Nonnull final 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(); + /** + * 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); + /** + * Return the type of metadata snapshot this object supports. + * + * @return Metadata type + */ abstract @Nonnull Class getSupportedType(); - abstract @Nullable T toStapshot(); + /** + * 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 transactionCommitted(TransactionIdentifier txId); + + abstract void onTransactionAborted(TransactionIdentifier txId); + + abstract void onTransactionCommitted(TransactionIdentifier txId); + + abstract void onTransactionPurged(TransactionIdentifier txId); + + abstract void onHistoryCreated(LocalHistoryIdentifier historyId); + + abstract void onHistoryClosed(LocalHistoryIdentifier historyId); + + abstract void onHistoryPurged(LocalHistoryIdentifier historyId); + }