mirror of
https://github.com/corda/corda.git
synced 2025-02-01 16:58:27 +00:00
Minor: a serialisation related fix and an additional explainer comment in SerializedBytes
This commit is contained in:
parent
42cd9a14cb
commit
c52f1e096f
@ -68,6 +68,7 @@ val THREAD_LOCAL_KRYO = ThreadLocal.withInitial { createKryo() }
|
||||
* to get the original object back.
|
||||
*/
|
||||
class SerializedBytes<T : Any>(bits: ByteArray) : OpaqueBytes(bits) {
|
||||
// It's OK to use lazy here because SerializedBytes is configured to use the ImmutableClassSerializer.
|
||||
val hash: SecureHash by lazy { bits.sha256() }
|
||||
|
||||
fun writeToFile(path: Path) = Files.write(path, bits)
|
||||
|
@ -65,8 +65,13 @@ class ProgressTracker(vararg steps: Step) {
|
||||
override val label: String get() = currentLabel
|
||||
}
|
||||
|
||||
object UNSTARTED : Step("Unstarted")
|
||||
object DONE : Step("Done")
|
||||
// Sentinel objects. Overrides equals() to survive process restarts and serialization.
|
||||
object UNSTARTED : Step("Unstarted") {
|
||||
override fun equals(other: Any?) = other is UNSTARTED
|
||||
}
|
||||
object DONE : Step("Done") {
|
||||
override fun equals(other: Any?) = other is DONE
|
||||
}
|
||||
|
||||
/** The steps in this tracker, same as the steps passed to the constructor but with UNSTARTED and DONE inserted. */
|
||||
val steps = arrayOf(UNSTARTED, *steps, DONE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user