Skip to content

Commit

Permalink
Add ServerSeq into ChangeInfo (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
7hong13 authored Jun 5, 2024
1 parent 080f2cc commit 586a003
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions yorkie/src/main/kotlin/dev/yorkie/api/ChangeConverter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ internal fun PBChangeID.toChangeID(): ChangeID {
clientSeq.toUInt(),
lamport,
actorId.toActorID(),
serverSeq,
)
}

Expand All @@ -57,6 +58,7 @@ internal fun ChangeID.toPBChangeID(): PBChangeID {
clientSeq = changeID.clientSeq.toInt()
lamport = changeID.lamport
actorId = changeID.actor.toByteString()
serverSeq = changeID.serverSeq
}
}

Expand Down
4 changes: 3 additions & 1 deletion yorkie/src/main/kotlin/dev/yorkie/document/Document.kt
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public class Document(
}

private fun Change.toChangeInfo(operationInfos: List<OperationInfo>) =
Event.ChangeInfo(message.orEmpty(), operationInfos, id.actor)
Event.ChangeInfo(message.orEmpty(), operationInfos, id.actor, id.clientSeq, id.serverSeq)

public fun toJson(): String {
return root.toJson()
Expand Down Expand Up @@ -574,6 +574,8 @@ public class Document(
public val message: String,
public val operations: List<OperationInfo>,
public val actorID: ActorID,
public val clientSeq: UInt,
public val serverSeq: Long,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal data class ChangeID(
val clientSeq: UInt,
val lamport: Long,
val actor: ActorID,
val serverSeq: Long = 0,
) {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ internal data class CrdtTree(
val parentNode = tree.findFloorNode(parentID)
val leftNode = tree.findFloorNode(leftSiblingID)
require(parentNode != null && leftNode != null) {
"cannot find node at $this"
"cannot find node of CrdtTreePos($parentID, $leftSiblingID)"
}

/**
Expand Down

0 comments on commit 586a003

Please sign in to comment.