add start action

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
This commit is contained in:
Yilin Chen
2019-10-21 17:36:20 +08:00
parent 33e2a83627
commit 5e02db1bfb
2 changed files with 30 additions and 14 deletions

View File

@@ -65,22 +65,39 @@ Pos == {x \in Nat : x > 0}
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Start(c) ==
/\ client_state[c] = "init"
/\ next_ts' = next_ts + 1
/\ \E ks \in SUBSET KEY:
\E primary \in ks:
client_key' =
[client_key EXCEPT
![c] = [primary |-> primary,
secondary |-> ks \ {primary},
pessimistic |-> ks,
pending |-> ks]
]
/\ client_state' = [client_state EXCEPT ![c] = "working"]
/\ client_ts' = [client_ts EXCEPT ![c].start_ts = next_ts']
/\ UNCHANGED <<key_vars, msg>>
Init == Init ==
/\ next_ts = 1 /\ next_ts = 1
/\ client_state = [c \in CLIENT |-> "init"] /\ client_state = [c \in CLIENT |-> "init"]
/\ client_ts = [c \in CLIENT |-> [start_ts |-> 0, /\ client_ts = [c \in CLIENT |-> [start_ts |-> 0,
for_update_ts |-> 0, for_update_ts |-> 0,
commit_ts |-> 0] commit_ts |-> 0]]
]
/\ client_key = [c \in CLIENT |-> {}] /\ client_key = [c \in CLIENT |-> {}]
/\ key_lock = [k \in KEY |-> {}] /\ key_lock = [k \in KEY |-> {}]
/\ key_data = [k \in KEY |-> {}] /\ key_data = [k \in KEY |-> {}]
/\ key_write = [k \in KEY |-> {}] /\ key_write = [k \in KEY |-> {}]
/\ key_last_read_ts = [k \in KEY |-> 0] /\ key_last_read_ts = [k \in KEY |-> 0]
/\ msg = {} /\ msg = {}
Next == ClientOp(c) ==
UNCHANGED <<client_vars, key_vars, vars>> \/ Start(c)
Next == \E c \in CLIENT : ClientOp(c)
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@@ -97,14 +114,13 @@ ClientTsTypeInv ==
[CLIENT -> [start_ts : Nat, for_update_ts: Nat, commit_ts : Nat]] [CLIENT -> [start_ts : Nat, for_update_ts: Nat, commit_ts : Nat]]
ClientKeyTypeInv == ClientKeyTypeInv ==
client_key \in [ \A c \in CLIENT:
CLIENT -> {{}} \union [ \/ client_state[c] = "init"
primary: KEY, \/ client_key[c] \in [primary: KEY,
secondary: SUBSET KEY, secondary: SUBSET KEY,
pessimistic: SUBSET KEY, pessimistic: SUBSET KEY,
pending : SUBSET KEY pending : SUBSET KEY
] ]
]
KeyDataTypeInv == KeyDataTypeInv ==
key_data \in [KEY -> SUBSET [ts: Pos]] key_data \in [KEY -> SUBSET [ts: Pos]]

View File

@@ -5,7 +5,7 @@
<stringAttribute key="distributedNetworkInterface" value="192.168.220.40"/> <stringAttribute key="distributedNetworkInterface" value="192.168.220.40"/>
<intAttribute key="distributedNodesCount" value="1"/> <intAttribute key="distributedNodesCount" value="1"/>
<stringAttribute key="distributedTLC" value="off"/> <stringAttribute key="distributedTLC" value="off"/>
<intAttribute key="fpIndex" value="80"/> <intAttribute key="fpIndex" value="37"/>
<intAttribute key="maxHeapSize" value="25"/> <intAttribute key="maxHeapSize" value="25"/>
<stringAttribute key="modelBehaviorInit" value="Init"/> <stringAttribute key="modelBehaviorInit" value="Init"/>
<stringAttribute key="modelBehaviorNext" value="Next"/> <stringAttribute key="modelBehaviorNext" value="Next"/>