From 05b6b26d93be9575c5dad2eadca4e7237f6083ac Mon Sep 17 00:00:00 2001 From: Fausto Spoto Date: Thu, 9 May 2024 13:22:25 +0200 Subject: [PATCH] Simplified the generic types of the stores, store transactions and nodes --- .../java/io/hotmoka/node/disk/internal/DiskNodeImpl.java | 2 +- .../main/java/io/hotmoka/node/disk/internal/DiskStore.java | 2 +- .../main/java/io/hotmoka/node/local/api/CheckableStore.java | 2 +- .../src/main/java/io/hotmoka/node/local/api/LocalNode.java | 2 +- .../src/main/java/io/hotmoka/node/local/api/Store.java | 2 +- .../java/io/hotmoka/node/local/api/StoreTransaction.java | 2 +- .../main/java/io/hotmoka/node/local/AbstractLocalNode.java | 2 +- .../src/main/java/io/hotmoka/node/local/AbstractStore.java | 6 +++--- .../io/hotmoka/node/local/AbstractStoreTransaction.java | 2 +- .../java/io/hotmoka/node/local/AbstractTrieBasedStore.java | 6 +++--- .../node/local/AbstractTrieBasedStoreTransaction.java | 2 +- .../hotmoka/node/local/internal/AbstractLocalNodeImpl.java | 3 +-- .../node/tendermint/internal/TendermintNodeImpl.java | 2 +- .../hotmoka/node/tendermint/internal/TendermintStore.java | 2 +- 14 files changed, 18 insertions(+), 19 deletions(-) diff --git a/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskNodeImpl.java b/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskNodeImpl.java index 798862daa..2e7da8a92 100644 --- a/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskNodeImpl.java +++ b/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskNodeImpl.java @@ -37,7 +37,7 @@ * nor transactions. Updates are stored in files, rather than in an external database. */ @ThreadSafe -public class DiskNodeImpl extends AbstractLocalNode implements DiskNode { +public class DiskNodeImpl extends AbstractLocalNode implements DiskNode { /** * The mempool where transaction requests are stored and eventually executed. diff --git a/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskStore.java b/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskStore.java index 93248412d..f92b970ee 100644 --- a/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskStore.java +++ b/io-hotmoka-node-disk/src/main/java/io/hotmoka/node/disk/internal/DiskStore.java @@ -54,7 +54,7 @@ * while the histories are kept in RAM. */ @Immutable -class DiskStore extends AbstractStore { +class DiskStore extends AbstractStore { /** * The path where the database of the store gets created. diff --git a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/CheckableStore.java b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/CheckableStore.java index a17043bae..07554d76b 100644 --- a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/CheckableStore.java +++ b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/CheckableStore.java @@ -21,7 +21,7 @@ * back and forth in time. Different moments of the store are identifies by state * identifiers, that can be checked out when needed. */ -public interface CheckableStore, N extends LocalNode> extends Store { +public interface CheckableStore> extends Store { /** * Yields a unique identifier for the current state of this store. diff --git a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/LocalNode.java b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/LocalNode.java index 9ef465f47..8fac73823 100644 --- a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/LocalNode.java +++ b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/LocalNode.java @@ -27,6 +27,6 @@ * @param the type of the store of the node */ @ThreadSafe -public interface LocalNode> extends Node { +public interface LocalNode> extends Node { C getLocalConfig() throws NodeException; } \ No newline at end of file diff --git a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/Store.java b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/Store.java index 38283dce8..a231fad6c 100644 --- a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/Store.java +++ b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/Store.java @@ -32,7 +32,7 @@ * be used concurrently for executing more requests. */ @ThreadSafe -public interface Store, N extends LocalNode> extends AutoCloseable { +public interface Store> extends AutoCloseable { /** * Yields the response of the transaction having the given reference. diff --git a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/StoreTransaction.java b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/StoreTransaction.java index c09e71788..40a3a1282 100644 --- a/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/StoreTransaction.java +++ b/io-hotmoka-node-local-api/src/main/java/io/hotmoka/node/local/api/StoreTransaction.java @@ -48,7 +48,7 @@ * its hash is held in the node, if consensus is needed. Stores must be thread-safe, since they can * be used concurrently for executing more requests. */ -public interface StoreTransaction> { +public interface StoreTransaction> { /** * Yields the store from which this transaction begun. diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractLocalNode.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractLocalNode.java index 6d7e9c48a..a2a0e99c7 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractLocalNode.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractLocalNode.java @@ -30,7 +30,7 @@ * @param the type of the store of the node */ @ThreadSafe -public abstract class AbstractLocalNode, C extends LocalNodeConfig, S extends AbstractStore> extends AbstractLocalNodeImpl { +public abstract class AbstractLocalNode, S extends AbstractStore> extends AbstractLocalNodeImpl { /** * Builds a node with a brand new, empty store. diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStore.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStore.java index 764a8c8f0..f42efd539 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStore.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStore.java @@ -33,7 +33,7 @@ import io.hotmoka.node.local.api.StoreTransaction; @Immutable -public abstract class AbstractStore, N extends AbstractLocalNode> implements Store { +public abstract class AbstractStore> implements Store { /** * Cached recent transactions whose requests that have had their signature checked. @@ -92,7 +92,7 @@ protected AbstractStore(ExecutorService executors, ConsensusConfig consensu this.inflation = OptionalLong.empty(); } - protected AbstractStore(AbstractStore toClone) { + protected AbstractStore(AbstractStore toClone) { this.executors = toClone.executors; this.hasher = toClone.hasher; this.checkedSignatures = toClone.checkedSignatures; @@ -104,7 +104,7 @@ protected AbstractStore(AbstractStore toClone) { this.inflation = toClone.inflation; } - protected AbstractStore(AbstractStore toClone, LRUCache checkedSignatures, LRUCache classLoaders, ConsensusConfig consensus, Optional gasPrice, OptionalLong inflation) { + protected AbstractStore(AbstractStore toClone, LRUCache checkedSignatures, LRUCache classLoaders, ConsensusConfig consensus, Optional gasPrice, OptionalLong inflation) { this.executors = toClone.executors; this.hasher = toClone.hasher; this.checkedSignatures = checkedSignatures; //new LRUCache<>(checkedSignatures); diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStoreTransaction.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStoreTransaction.java index d4ef3cfe9..0de07f415 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStoreTransaction.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractStoreTransaction.java @@ -122,7 +122,7 @@ * its hash is held in the node, if consensus is needed. Stores must be thread-safe, since they can * be used concurrently for executing more requests. */ -public abstract class AbstractStoreTransaction> implements StoreTransaction { +public abstract class AbstractStoreTransaction> implements StoreTransaction { private final static Logger LOGGER = Logger.getLogger(AbstractStoreTransaction.class.getName()); private final S store; diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStore.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStore.java index d1c0eb3f4..3c981b18a 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStore.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStore.java @@ -70,7 +70,7 @@ * This class is meant to be subclassed by specifying where errors, requests and histories are kept. */ @Immutable -public abstract class AbstractTrieBasedStore, N extends AbstractLocalNode> extends AbstractStore { +public abstract class AbstractTrieBasedStore> extends AbstractStore { /** * The Xodus environment that holds the store. @@ -202,7 +202,7 @@ protected AbstractTrieBasedStore(ExecutorService executors, ConsensusConfig } } - protected AbstractTrieBasedStore(AbstractTrieBasedStore toClone) { + protected AbstractTrieBasedStore(AbstractTrieBasedStore toClone) { super(toClone); this.env = toClone.env; @@ -218,7 +218,7 @@ protected AbstractTrieBasedStore(AbstractTrieBasedStore toClone) { this.rootOfRequests = toClone.rootOfRequests; } - protected AbstractTrieBasedStore(AbstractTrieBasedStore toClone, LRUCache checkedSignatures, LRUCache classLoaders, ConsensusConfig consensus, Optional gasPrice, OptionalLong inflation, Optional rootOfResponses, Optional rootOfInfo, Optional rootOfErrors, Optional rootOfHistories, Optional rootOfRequests) { + protected AbstractTrieBasedStore(AbstractTrieBasedStore toClone, LRUCache checkedSignatures, LRUCache classLoaders, ConsensusConfig consensus, Optional gasPrice, OptionalLong inflation, Optional rootOfResponses, Optional rootOfInfo, Optional rootOfErrors, Optional rootOfHistories, Optional rootOfRequests) { super(toClone, checkedSignatures, classLoaders, consensus, gasPrice, inflation); this.env = toClone.env; diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStoreTransaction.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStoreTransaction.java index 74d757177..a26bf57d7 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStoreTransaction.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/AbstractTrieBasedStoreTransaction.java @@ -19,7 +19,7 @@ import io.hotmoka.xodus.ExodusException; import io.hotmoka.xodus.env.Transaction; -public abstract class AbstractTrieBasedStoreTransaction> extends AbstractStoreTransaction { +public abstract class AbstractTrieBasedStoreTransaction> extends AbstractStoreTransaction { /** * The Xodus transaction where the updates get recorded. diff --git a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/AbstractLocalNodeImpl.java b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/AbstractLocalNodeImpl.java index 72ddd6221..06c9148ec 100644 --- a/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/AbstractLocalNodeImpl.java +++ b/io-hotmoka-node-local/src/main/java/io/hotmoka/node/local/internal/AbstractLocalNodeImpl.java @@ -80,7 +80,6 @@ import io.hotmoka.node.api.updates.Update; import io.hotmoka.node.api.values.StorageReference; import io.hotmoka.node.api.values.StorageValue; -import io.hotmoka.node.local.AbstractLocalNode; import io.hotmoka.node.local.AbstractStore; import io.hotmoka.node.local.LRUCache; import io.hotmoka.node.local.api.LocalNode; @@ -94,7 +93,7 @@ * @param the type of the store of the node */ @ThreadSafe -public abstract class AbstractLocalNodeImpl, C extends LocalNodeConfig, S extends AbstractStore> extends AbstractAutoCloseableWithLockAndOnCloseHandlers implements LocalNode { +public abstract class AbstractLocalNodeImpl, S extends AbstractStore> extends AbstractAutoCloseableWithLockAndOnCloseHandlers implements LocalNode { /** * The manager of the subscriptions to the events occurring in this node. diff --git a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java index c074661b9..4c3ea830a 100644 --- a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java +++ b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintNodeImpl.java @@ -55,7 +55,7 @@ * its state in a transactional database implemented by the {@link TendermintStore} class. */ @ThreadSafe -public class TendermintNodeImpl extends AbstractLocalNode implements TendermintNode { +public class TendermintNodeImpl extends AbstractLocalNode implements TendermintNode { private final static Logger LOGGER = Logger.getLogger(TendermintNodeImpl.class.getName()); diff --git a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintStore.java b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintStore.java index 28beb1eb3..8bc4bc08f 100644 --- a/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintStore.java +++ b/io-hotmoka-node-tendermint/src/main/java/io/hotmoka/node/tendermint/internal/TendermintStore.java @@ -42,7 +42,7 @@ * Tendermint, since it keeps such information inside its blocks. */ @Immutable -public class TendermintStore extends AbstractTrieBasedStore { +public class TendermintStore extends AbstractTrieBasedStore { /** * The hasher used to merge the hashes of the many tries.