Advanced Features

Advanced vRAM features

To use advanced multi index features include #define USE_ADVANCED_IPFS at the top of the contract file while following the steps below. If you have already deployed a contract that does not use advanced features, do not add this line, as it is not backwards compatible. With this addition, the primary key may be uint32, uint64, uint128, and checksum256.

Example implementation:

TABLE bigentry {
  checksum256 id;
  uint64_t sometestnumber;
  checksum256 primary_key()const {return id;}
};

typedef dapp::advanced_multi_index<"test2"_n, bigentry, checksum256> testindex_big_t;

Another feature of the advanced multi index is warmuprow and cleanuprow actions. The warmuprow action allows for faster warmups for IPFS actions. The warmup process is where data is fetched and loaded into RAM to be used. Previously each RAM entry touched would require 3 separate warmup actions, now this can be done within 1 action. The cleanuprow action removes all the data entries created by the warmuprow in the case that a rollback is required.

Additionally, vram tables from other contracts can now be read with the addition of the warmupcode action. This is done the same way as a regular multi_index table by specifying a code other than _self. For example, by replacing:

my_table_struct mytable(_self,_self.value);

with

my_table_struct mytable(othercntr,othercntr.value);

This does require that the table struct and table name of the remote contract to be known, just as in regular multi_index. Remote tables can only be read, they cannot be modified. Remote table owners do not have to be staked to the same DSP as your contract.

These same conditions apply for reading vram tables from contracts on other chains. This is achieved with the warmupchain and cleanchain actions. Similar to reading from other contracts, this may be done using some additional parameters:

my_table_struct mytable(othercntr,othercntr.value, 1024, 64, false, false, 0, chain);

Where chain is the name of the side chain as specified in the LiquidX chain model file. In the case of reading from the EOSIO mainnet, specify chain as β€˜mainnet’.

Last updated