+ @VisibleForTesting
+ class RecoveryShardDataTreeTransactionFactory implements ShardDataTreeTransactionFactory {
+
+ @Override
+ public ReadOnlyShardDataTreeTransaction newReadOnlyTransaction(String txId, String chainId) {
+ return new ReadOnlyShardDataTreeTransaction(txId,
+ new PruningShardDataTreeSnapshot(dataTree.takeSnapshot(), validNamespaces));
+ }
+
+ @Override
+ public ReadWriteShardDataTreeTransaction newReadWriteTransaction(String txId, String chainId) {
+ return new ReadWriteShardDataTreeTransaction(ShardDataTree.this, txId,
+ new PruningShardDataTreeSnapshot(dataTree.takeSnapshot(), validNamespaces).newModification());
+ }
+ }
+
+ @VisibleForTesting
+ class RegularShardDataTreeTransactionFactory implements ShardDataTreeTransactionFactory {
+
+ @Override
+ public ReadOnlyShardDataTreeTransaction newReadOnlyTransaction(String txId, String chainId) {
+ return new ReadOnlyShardDataTreeTransaction(txId, dataTree.takeSnapshot());
+
+ }
+
+ @Override
+ public ReadWriteShardDataTreeTransaction newReadWriteTransaction(String txId, String chainId) {
+ return new ReadWriteShardDataTreeTransaction(ShardDataTree.this, txId, dataTree.takeSnapshot()
+ .newModification());
+ }
+ }