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=e2c1b27db1406ad0e6d2f3e1b405d1f6db33f464;hb=8232a626b43fdd2f5799da0fbcfb0f02d3c8f4fb;hp=c0c3d6cbb0a584b1523473d2baeb01a12f96e499;hpb=925cb4a228d0fda99c7bfeb432eb25285a223887;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 c0c3d6cbb0..e2c1b27db1 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 @@ -15,24 +15,58 @@ 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); - abstract @Nonnull Class getSupportedType(); + /** + * Return the type of metadata snapshot this object supports. + * + * @return Metadata type + */ + @Nonnull + abstract Class getSupportedType(); - abstract @Nullable T toSnapshot(); + /** + * Take a snapshot of current metadata state. + * + * @return Metadata snapshot, or null if the metadata is empty. + */ + @Nullable + abstract T toSnapshot(); // Lifecycle events + + 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); + }