mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Added time update log entry type. (#6886)
CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
4b703e19e7
commit
899fedcc2e
@ -79,7 +79,7 @@ message DamlSubmissionBatch {
|
||||
// A log entry for a committed DAML submission.
|
||||
// Produced by [[KeyValueCommitting]] from the `DamlSubmission` message.
|
||||
// Each entry can be converted into a participant state `Update` event
|
||||
// with [[KeyValueConsumption]].
|
||||
// with [[KeyValueConsumption]], except for a time update entry.
|
||||
//
|
||||
// Please read comments in [[com.daml.ledger.participant.state.v1.package]]
|
||||
// and [[com.daml.ledger.participant.state.kvutils.package]] for background
|
||||
@ -116,6 +116,9 @@ message DamlLogEntry {
|
||||
|
||||
// A rejection of a pre-executed submission because of out-of-time-bounds.
|
||||
DamlOutOfTimeBoundsEntry out_of_time_bounds_entry = 10;
|
||||
|
||||
// A log entry whose purpose is to transmit a current record time for pre-executed submissions.
|
||||
google.protobuf.Empty time_update_entry = 101;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,6 +185,9 @@ object KeyValueConsumption {
|
||||
case DamlLogEntry.PayloadCase.OUT_OF_TIME_BOUNDS_ENTRY =>
|
||||
outOfTimeBoundsEntryToUpdate(recordTime, entry.getOutOfTimeBoundsEntry).toList
|
||||
|
||||
case DamlLogEntry.PayloadCase.TIME_UPDATE_ENTRY =>
|
||||
List.empty
|
||||
|
||||
case DamlLogEntry.PayloadCase.PAYLOAD_NOT_SET =>
|
||||
throw Err.InternalError("logEntryToUpdate: PAYLOAD_NOT_SET!")
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class ConflictDetection(val damlMetrics: Metrics) {
|
||||
case PARTY_ALLOCATION_ENTRY | PACKAGE_UPLOAD_ENTRY | CONFIGURATION_ENTRY |
|
||||
TRANSACTION_REJECTION_ENTRY | CONFIGURATION_REJECTION_ENTRY |
|
||||
PACKAGE_UPLOAD_REJECTION_ENTRY | PARTY_ALLOCATION_REJECTION_ENTRY |
|
||||
OUT_OF_TIME_BOUNDS_ENTRY =>
|
||||
OUT_OF_TIME_BOUNDS_ENTRY | TIME_UPDATE_ENTRY =>
|
||||
logger.trace(s"Dropping conflicting submission (${logEntry.getPayloadCase})")
|
||||
metrics.dropped.inc()
|
||||
None
|
||||
|
@ -16,6 +16,7 @@ import com.daml.ledger.participant.state.kvutils.KeyValueConsumption.{
|
||||
import com.daml.ledger.participant.state.kvutils.api.LedgerReader
|
||||
import com.daml.ledger.participant.state.v1.{Configuration, RejectionReason, Update}
|
||||
import com.daml.lf.data.Time.Timestamp
|
||||
import com.google.protobuf.Empty
|
||||
import org.scalatest.prop.TableDrivenPropertyChecks._
|
||||
import org.scalatest.prop.TableFor4
|
||||
import org.scalatest.prop.Tables.Table
|
||||
@ -55,6 +56,14 @@ class KeyValueConsumptionSpec extends WordSpec with Matchers {
|
||||
|
||||
actual.recordTime shouldBe Timestamp.assertFromInstant(Instant.ofEpochSecond(100))
|
||||
}
|
||||
|
||||
"not generate an update from a time update entry" in {
|
||||
val timeUpdateEntry = DamlLogEntry.newBuilder
|
||||
.setRecordTime(Conversions.buildTimestamp(aRecordTime))
|
||||
.setTimeUpdateEntry(Empty.getDefaultInstance)
|
||||
.build
|
||||
logEntryToUpdate(aLogEntryId, timeUpdateEntry, recordTimeForUpdate = None) shouldBe Nil
|
||||
}
|
||||
}
|
||||
|
||||
private def verifyNoUpdateIsGenerated(actual: Option[Update]): Unit = {
|
||||
@ -297,6 +306,8 @@ class KeyValueConsumptionSpec extends WordSpec with Matchers {
|
||||
DamlPartyAllocationRejectionEntry.getDefaultInstance)
|
||||
case OUT_OF_TIME_BOUNDS_ENTRY =>
|
||||
builder.setOutOfTimeBoundsEntry(DamlOutOfTimeBoundsEntry.getDefaultInstance)
|
||||
case TIME_UPDATE_ENTRY =>
|
||||
builder.setTimeUpdateEntry(Empty.getDefaultInstance)
|
||||
case PAYLOAD_NOT_SET =>
|
||||
()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user