ImmutableEnvironment
public interface MutableEnvironment extends ImmutableEnvironment
NContract
instance, where it can change its server state.
It implemets KV store for the server-state. It is created automatically first time set(String, Object)
is
called and must commit any changes to the ledger when the new contract state is being approved. Before this the
ledger state must not be altered.
The RC problem should be repelled by saving the state of the "approved" contract only. To do this. the nodes must extend voting by adding state's CRC2-384 hash to the voting ID and copy the state of the approved contract as need
Modifier and Type | Method | Description |
---|---|---|
@NonNull ContractSubscription |
createChainSubscription(@NonNull HashId origin,
@NonNull java.time.ZonedDateTime expiresAt) |
Create follower subscription to the chain of contracts
|
@NonNull ContractStorage |
createContractStorage(byte[] packedTransaction,
@NonNull java.time.ZonedDateTime expiresAt) |
Create storage for a packed contract.
|
@NonNull ContractSubscription |
createContractSubscription(@NonNull HashId id,
@NonNull java.time.ZonedDateTime expiresAt) |
Create subscription to a packed contract.
|
@NonNull NameRecord |
createNameRecord(@NonNull UnsName unsName,
@NonNull java.time.ZonedDateTime expiresAt) |
|
@NonNull NameRecordEntry |
createNameRecordEntry(@NonNull UnsRecord unsRecord) |
|
void |
destroyNameRecord(NameRecord nameRecord) |
Remove UNS name from the ledger
|
void |
destroyNameRecordEntry(NameRecordEntry nameRecordEntry) |
Remove UNS name record entry from the ledger
|
void |
destroyStorage(ContractStorage contractStorage) |
Remove stored contract from the ledger
|
void |
destroySubscription(ContractSubscription subscription) |
Remove subscription from the ledger
|
void |
rollback() |
Reset the KV store to the initial state
|
<T> T |
set(java.lang.String key,
T value) |
Writes a key to the KV store.
|
void |
setNameRecordExpiresAt(NameRecord nameRecord,
java.time.ZonedDateTime expiresAt) |
Set expiration time for storing UNS name
|
void |
setStorageExpiresAt(ContractStorage storage,
java.time.ZonedDateTime expiresAt) |
Set expiration time for contract storage
|
void |
setSubscriptionExpiresAt(ContractSubscription subscription,
java.time.ZonedDateTime expiresAt) |
Set expiration time for subscription
|
get, getContract, getFollowerService, getFollowerService, instanceCreatedAt, nameRecordEntries, nameRecords, storages, subscriptions, tryAllocate
<T> T set(java.lang.String key, T value)
T
- key
- value
- void rollback()
@NonNull ContractSubscription createChainSubscription(@NonNull HashId origin, @NonNull java.time.ZonedDateTime expiresAt)
origin
- of contracts chainexpiresAt
- is time to expiration subscription@NonNull ContractSubscription createContractSubscription(@NonNull HashId id, @NonNull java.time.ZonedDateTime expiresAt)
id
- is contract identifierexpiresAt
- is time to expiration subscription@NonNull ContractStorage createContractStorage(byte[] packedTransaction, @NonNull java.time.ZonedDateTime expiresAt)
packedTransaction
- is a packed TransactionPack
with contractexpiresAt
- is time to expiration subscription@NonNull NameRecord createNameRecord(@NonNull UnsName unsName, @NonNull java.time.ZonedDateTime expiresAt)
@NonNull NameRecordEntry createNameRecordEntry(@NonNull UnsRecord unsRecord)
void setSubscriptionExpiresAt(ContractSubscription subscription, java.time.ZonedDateTime expiresAt)
subscription
- expiresAt
- is time to expiration subscriptionvoid setStorageExpiresAt(ContractStorage storage, java.time.ZonedDateTime expiresAt)
storage
- is contract storageexpiresAt
- is time to expiration contract storagevoid destroySubscription(ContractSubscription subscription)
subscription
- void destroyStorage(ContractStorage contractStorage)
contractStorage
- is contract storagevoid setNameRecordExpiresAt(NameRecord nameRecord, java.time.ZonedDateTime expiresAt)
nameRecord
- is UNS name recordexpiresAt
- is time to expiration UNS namevoid destroyNameRecord(NameRecord nameRecord)
nameRecord
- is UNS name recordvoid destroyNameRecordEntry(NameRecordEntry nameRecordEntry)
nameRecordEntry
- is UNS name record entry