use of com.icodici.universa.contract.services.NImmutableEnvironment in project universa by UniversaBlockchain.
the class EnvCache method remove.
public void remove(HashId id) {
;
NImmutableEnvironment env = environemtsByContract.remove(id);
if (env != null) {
long envId = env.getId();
environemtsById.remove(envId);
environmetsExpiration.remove(envId);
}
}
use of com.icodici.universa.contract.services.NImmutableEnvironment in project universa by UniversaBlockchain.
the class Node method getFullEnvironment.
/**
* Get environment and follower contract by environment identifier.
*
* @param environmentId is environment subscription
*
* @return {@link Binder} with environment and follower contract
*/
public Binder getFullEnvironment(long environmentId) {
NImmutableEnvironment ime = getEnvironment(environmentId);
ime.setNameCache(nameCache);
NSmartContract contract = ime.getContract();
contract.setNodeInfoProvider(nodeInfoProvider);
NMutableEnvironment me = ime.getMutable();
if (me == null)
return Binder.EMPTY;
return Binder.of("follower", contract, "environment", me);
}
use of com.icodici.universa.contract.services.NImmutableEnvironment in project universa by UniversaBlockchain.
the class Node method getEnvironment.
private NImmutableEnvironment getEnvironment(NSmartContract item) {
NImmutableEnvironment result = envCache.get(item.getId());
if (result == null && item.getParent() != null) {
result = envCache.get(item.getParent());
}
if (result == null) {
result = ledger.getEnvironment(item);
envCache.put(result);
}
return result;
}
use of com.icodici.universa.contract.services.NImmutableEnvironment in project universa by UniversaBlockchain.
the class TestLocalNetwork method getEnvironment.
@Override
public NImmutableEnvironment getEnvironment(HashId itemId, NodeInfo nodeInfo, Duration maxTimeout) throws InterruptedException {
Node node = nodes.get(nodeInfo);
NImmutableEnvironment env = node.getEnvCache().get(itemId);
if (env != null)
return Boss.load(Boss.pack(env));
return null;
}
Aggregations