Search in sources :

Example 6 with VirtualInternalRecordSerializer

use of com.swirlds.jasperdb.VirtualInternalRecordSerializer in project hedera-services by hashgraph.

the class VirtualMapFactory method newVirtualizedStorage.

public VirtualMap<ContractKey, ContractValue> newVirtualizedStorage() {
    final var storageKeySerializer = new ContractKeySerializer();
    final VirtualLeafRecordSerializer<ContractKey, ContractValue> storageLeafRecordSerializer = new VirtualLeafRecordSerializer<>(CURRENT_SERIALIZATION_VERSION, DigestType.SHA_384, CURRENT_SERIALIZATION_VERSION, storageKeySerializer.getSerializedSize(), new ContractKeySupplier(), CURRENT_SERIALIZATION_VERSION, ContractValue.SERIALIZED_SIZE, new ContractValueSupplier(), true);
    final JasperDbBuilder<ContractKey, ContractValue> dsBuilder = jdbBuilderFactory.newJdbBuilder();
    dsBuilder.virtualLeafRecordSerializer(storageLeafRecordSerializer).virtualInternalRecordSerializer(new VirtualInternalRecordSerializer()).keySerializer(storageKeySerializer).maxNumOfKeys(MAX_STORAGE_ENTRIES).preferDiskBasedIndexes(false).internalHashesRamToDiskThreshold(MAX_IN_MEMORY_INTERNAL_HASHES);
    return new VirtualMap<>(STORAGE_VM_NAME, dsBuilder);
}
Also used : VirtualInternalRecordSerializer(com.swirlds.jasperdb.VirtualInternalRecordSerializer) VirtualLeafRecordSerializer(com.swirlds.jasperdb.VirtualLeafRecordSerializer) VirtualMap(com.swirlds.virtualmap.VirtualMap)

Aggregations

VirtualInternalRecordSerializer (com.swirlds.jasperdb.VirtualInternalRecordSerializer)6 VirtualLeafRecordSerializer (com.swirlds.jasperdb.VirtualLeafRecordSerializer)6 ContractKey (com.hedera.services.state.virtual.ContractKey)4 ContractKeySerializer (com.hedera.services.state.virtual.ContractKeySerializer)4 ContractKeySupplier (com.hedera.services.state.virtual.ContractKeySupplier)4 ContractValue (com.hedera.services.state.virtual.ContractValue)4 ContractValueSupplier (com.hedera.services.state.virtual.ContractValueSupplier)4 JasperDbBuilder (com.swirlds.jasperdb.JasperDbBuilder)4 Path (java.nio.file.Path)4 DigestType (com.swirlds.common.crypto.DigestType)3 VirtualDataSourceJasperDB (com.swirlds.jasperdb.VirtualDataSourceJasperDB)3 DataFileCommon (com.swirlds.jasperdb.files.DataFileCommon)3 VirtualInternalRecord (com.swirlds.virtualmap.datasource.VirtualInternalRecord)3 VirtualLeafRecord (com.swirlds.virtualmap.datasource.VirtualLeafRecord)3 IOException (java.io.IOException)3 Files (java.nio.file.Files)3 LongStream (java.util.stream.LongStream)3 Stream (java.util.stream.Stream)3 VirtualMap (com.swirlds.virtualmap.VirtualMap)2 Random (java.util.Random)2