mirror of
https://github.com/corda/corda.git
synced 2024-12-28 00:38:55 +00:00
CORDA-973 Turn on compression for checkpoints and tx storage (#490)
This commit is contained in:
parent
e4d2155671
commit
00c171cd61
@ -52,7 +52,7 @@ class KotlinUtilsTest {
|
|||||||
expectedEx.expect(KryoException::class.java)
|
expectedEx.expect(KryoException::class.java)
|
||||||
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")
|
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")
|
||||||
val original = NonCapturingTransientProperty()
|
val original = NonCapturingTransientProperty()
|
||||||
original.serialize(context = KRYO_CHECKPOINT_CONTEXT).deserialize()
|
original.serialize(context = KRYO_CHECKPOINT_CONTEXT.withEncoding(null)).deserialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -79,7 +79,7 @@ class KotlinUtilsTest {
|
|||||||
expectedEx.expect(KryoException::class.java)
|
expectedEx.expect(KryoException::class.java)
|
||||||
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")
|
expectedEx.expectMessage("is not annotated or on the whitelist, so cannot be used in serialization")
|
||||||
val original = CapturingTransientProperty("Hello")
|
val original = CapturingTransientProperty("Hello")
|
||||||
original.serialize(context = KRYO_CHECKPOINT_CONTEXT).deserialize()
|
original.serialize(context = KRYO_CHECKPOINT_CONTEXT.withEncoding(null)).deserialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NullTransientProperty {
|
private class NullTransientProperty {
|
||||||
|
@ -6,6 +6,7 @@ import net.corda.core.serialization.EncodingWhitelist
|
|||||||
import net.corda.core.serialization.SerializationContext
|
import net.corda.core.serialization.SerializationContext
|
||||||
import net.corda.core.serialization.SerializationDefaults
|
import net.corda.core.serialization.SerializationDefaults
|
||||||
import net.corda.core.serialization.SerializationEncoding
|
import net.corda.core.serialization.SerializationEncoding
|
||||||
|
import net.corda.nodeapi.internal.serialization.CordaSerializationEncoding.SNAPPY
|
||||||
import net.corda.nodeapi.internal.serialization.amqp.amqpMagic
|
import net.corda.nodeapi.internal.serialization.amqp.amqpMagic
|
||||||
import net.corda.nodeapi.internal.serialization.kryo.kryoMagic
|
import net.corda.nodeapi.internal.serialization.kryo.kryoMagic
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ val KRYO_CHECKPOINT_CONTEXT = SerializationContextImpl(kryoMagic,
|
|||||||
emptyMap(),
|
emptyMap(),
|
||||||
true,
|
true,
|
||||||
SerializationContext.UseCase.Checkpoint,
|
SerializationContext.UseCase.Checkpoint,
|
||||||
null,
|
SNAPPY,
|
||||||
AlwaysAcceptEncodingWhitelist)
|
AlwaysAcceptEncodingWhitelist)
|
||||||
val AMQP_P2P_CONTEXT = SerializationContextImpl(amqpMagic,
|
val AMQP_P2P_CONTEXT = SerializationContextImpl(amqpMagic,
|
||||||
SerializationDefaults.javaClass.classLoader,
|
SerializationDefaults.javaClass.classLoader,
|
||||||
|
@ -18,6 +18,7 @@ import net.corda.node.utilities.WeightBasedAppendOnlyPersistentMap
|
|||||||
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
import net.corda.nodeapi.internal.persistence.NODE_DATABASE_PREFIX
|
||||||
import net.corda.nodeapi.internal.persistence.bufferUntilDatabaseCommit
|
import net.corda.nodeapi.internal.persistence.bufferUntilDatabaseCommit
|
||||||
import net.corda.nodeapi.internal.persistence.wrapWithDatabaseTransaction
|
import net.corda.nodeapi.internal.persistence.wrapWithDatabaseTransaction
|
||||||
|
import net.corda.nodeapi.internal.serialization.CordaSerializationEncoding.SNAPPY
|
||||||
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
import org.apache.commons.lang.ArrayUtils.EMPTY_BYTE_ARRAY
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.subjects.PublishSubject
|
import rx.subjects.PublishSubject
|
||||||
@ -57,7 +58,7 @@ class DBTransactionStorage(cacheSizeBytes: Long) : WritableTransactionStorage, S
|
|||||||
DBTransaction().apply {
|
DBTransaction().apply {
|
||||||
txId = key.toString()
|
txId = key.toString()
|
||||||
transaction = value.toSignedTx().
|
transaction = value.toSignedTx().
|
||||||
serialize(context = SerializationDefaults.STORAGE_CONTEXT).bytes
|
serialize(context = SerializationDefaults.STORAGE_CONTEXT.withEncoding(SNAPPY)).bytes
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
persistentEntityClass = DBTransaction::class.java,
|
persistentEntityClass = DBTransaction::class.java,
|
||||||
|
Loading…
Reference in New Issue
Block a user