- java.lang.Object
-
- io.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreator
-
- io.hotmoka.local.InitialResponseBuilder.ResponseCreator
-
- Enclosing class:
- InitialResponseBuilder<Request extends InitialTransactionRequest<Response>,Response extends InitialTransactionResponse>
protected abstract class InitialResponseBuilder.ResponseCreator extends io.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreator
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedResponseCreator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchargeGasForCPU(BigInteger amount)Decreases the available gas by the given amount, for CPU execution.voidchargeGasForRAM(BigInteger amount)Decreases the available gas by the given amount, for RAM execution.voidevent(Object event)Takes note of the given event, emitted during this execution.<T> TwithGas(BigInteger amount, Callable<T> what)Runs a given piece of code with a subset of the available gas.
-
-
-
Constructor Detail
-
ResponseCreator
protected ResponseCreator() throws TransactionRejectedException- Throws:
TransactionRejectedException
-
-
Method Detail
-
chargeGasForCPU
public final void chargeGasForCPU(BigInteger amount)
Description copied from class:io.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreatorDecreases the available gas by the given amount, for CPU execution.- Specified by:
chargeGasForCPUin classio.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreator- Parameters:
amount- the amount of gas to consume
-
chargeGasForRAM
public final void chargeGasForRAM(BigInteger amount)
Description copied from class:io.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreatorDecreases the available gas by the given amount, for RAM execution.- Specified by:
chargeGasForRAMin classio.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreator- Parameters:
amount- the amount of gas to consume
-
event
public final void event(Object event)
Description copied from class:io.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreatorTakes note of the given event, emitted during this execution.- Specified by:
eventin classio.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreator- Parameters:
event- the event
-
withGas
public final <T> T withGas(BigInteger amount, Callable<T> what) throws Exception
Description copied from class:io.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreatorRuns a given piece of code with a subset of the available gas. It first charges the given amount of gas. Then runs the code with the charged gas only. At its end, the remaining gas is added to the available gas to continue the computation.- Specified by:
withGasin classio.hotmoka.local.internal.transactions.AbstractResponseBuilder.ResponseCreator- Parameters:
amount- the amount of gas provided to the codewhat- the code to run- Returns:
- the result of the execution of the code
- Throws:
Exception- if the code runs into this exception
-
-