Skip to content

Commit

Permalink
WIP try adding the version number. Doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Feb 18, 2023
1 parent 6181a2d commit ceed5c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gradle-app.setting

# TLA+ output
bosk-mongo/src/test/tla/states
bosk-mongo/src/test/tla/*.toolbox

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
21 changes: 15 additions & 6 deletions bosk-mongo/src/test/tla/mongo1.tla
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ Bosk_t == [
Bosk(c,q) == [config |-> c, qin |-> q]

Mongo_t == [
state: Bosk_t
state: Bosk_t,
revision: Nat
]
Mongo(s) == [state |-> s]
Mongo(s,rev) == [state |-> s, revision |-> rev]

TypeOK ==
/\ bosks \in [instances -> Bosk_t]
Expand All @@ -40,7 +41,7 @@ UpdatedBosk(b) ==

\* Submit an update to Mongo
Submit(u) ==
/\ mongo' = Mongo(SubmittedBosk(mongo.state, u))
/\ mongo' = Mongo(SubmittedBosk(mongo.state, u), mongo.revision)

Broadcast(u) ==
/\ u /= mongo.state.config \* only broadcast if config has changed
Expand All @@ -58,7 +59,7 @@ BroadcastIfNeeded(u) ==
\* Atomically apply the oldest queued update and also broadcast to all instances
UpdateMongo ==
/\ Len(mongo.state.qin) >= 1
/\ mongo' = Mongo(UpdatedBosk(mongo.state))
/\ mongo' = Mongo(UpdatedBosk(mongo.state), 1 + mongo.revision)
/\ BroadcastIfNeeded(Head(mongo.state.qin))

\* Apply the oldest queued update to the given bosk instance
Expand All @@ -80,11 +81,19 @@ NextOptions ==
\/ UpdateSomeInstance

QLimit == 4
RevLimit == 20

SearchBoundaries == \* Limit our exploration of the state space
QueueBoundaries ==
/\ Len(mongo'.state.qin) <= QLimit
/\ \A i \in instances: Len(bosks'[i].qin) <= QLimit

RevisionBoundaries ==
/\ mongo'.revision <= RevLimit

SearchBoundaries == \* Limit our exploration of the state space
/\ QueueBoundaries
/\ RevisionBoundaries

Next ==
/\ NextOptions
/\ SearchBoundaries
Expand All @@ -96,7 +105,7 @@ InitialBosk ==

Init ==
/\ bosks = [i \in instances |-> InitialBosk]
/\ mongo = Mongo(InitialBosk)
/\ mongo = Mongo(InitialBosk, 1)

\* Invariants

Expand Down

0 comments on commit ceed5c6

Please sign in to comment.