-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from vaslabs/feature/vectorClocks
Server side vector clock support
- Loading branch information
Showing
16 changed files
with
310 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
endpoints/src/main/scala/cardgame/endpoints/schema/vector_clock.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cardgame.endpoints.schema | ||
|
||
import cardgame.endpoints.schema | ||
import cardgame.model.{ClockedAction, ClockedResponse, Event, PlayingGameAction} | ||
import sttp.tapir.SchemaType.SObjectInfo | ||
import sttp.tapir.{Schema, SchemaType, Validator} | ||
|
||
object vector_clock { | ||
import schema.java_types._ | ||
|
||
implicit val actionSchema: Schema[PlayingGameAction] = Schema.derivedSchema[PlayingGameAction] | ||
implicit val eventSchema: Schema[Event] = Schema.derivedSchema[Event] | ||
implicit val mapSchema: Schema[Map[String, Long]] = Schema.schemaForMap | ||
|
||
implicit val clockActionSchema: Schema[ClockedAction] = Schema(SchemaType.SCoproduct( | ||
SObjectInfo("Clocked Action"), List(mapSchema, actionSchema), None | ||
)) | ||
|
||
implicit val clockResponseSchema: Schema[ClockedResponse] = Schema(SchemaType.SCoproduct( | ||
SObjectInfo("Clocked Response"), List(mapSchema, eventSchema), None | ||
)) | ||
|
||
implicit val clockedResponseValidation: Validator[ClockedResponse] = Validator.pass | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.