-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.da
78 lines (66 loc) · 2.26 KB
/
main.da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import sys, time
from master import Master
from client import GFSClient
from ProcessMonitor import ProcessMonitor
config(channel is fifo, clock is lamport)
def main():
processMon = new(ProcessMonitor)
setup(processMon, ())
start(processMon)
output('PMON started')
master1 = new(Master)
setup(master1, ())
start(master1)
client1 = new(GFSClient)
setup(client1, (master1,processMon))
start(client1)
client2 = new(GFSClient)
setup(client2, (master1,processMon))
start(client2)
client3 = new(GFSClient)
setup(client3, (master1,processMon))
start(client3)
client4 = new(GFSClient)
setup(client4, (master1,processMon))
start(client4)
client5 = new(GFSClient)
setup(client5, (master1,processMon))
start(client5)
s1 = 'Hi testing 12'
s2 = 'Hi testing 456'
fileName = 'abc.txt'
send(('CREATE_MSG', fileName), to=client1)
await(some(received(('CREATED', fileName2)), has=fileName == fileName2))
send(('WRITE_MSG', fileName, s1), to=client1)
await(some(received(('WRITTEN', fileName2)),has=fileName == fileName2))
s2 = 'Append1232'
send(('RECORD_APPEND_MSG', 'abc.txt', s2), to=client1)
s2 = 'Append2'
send(('RECORD_APPEND_MSG', 'abc.txt', s2), to=client2)
'''
s2 = 'Append3'
send(('RECORD_APPEND_MSG', 'abc.txt', s2), to=client3)
s2 = 'Appending 1111'
send(('RECORD_APPEND_MSG', 'abc.txt', s2), to=client4)
time.sleep(2)
send(('CREATE_SNAPSHOT', 'abc.txt'), to = client1)
s2 = 'Appending 555'
#send(('RECORD_APPEND_MSG', 'abc.txt', s2), to=client5)
'''
send(('CREATE_SNAPSHOT', 'abc.txt'), to = client3)
time.sleep(2)
c =logical_clock()
send(('READ_MSG',c, 'abc.txt'), to=client1)
await(some(received(('READ_FILE_DONE',dataRead,fileName2, c2)),
has=fileName == fileName2 and c2>c))
output('THIS IS THE DATA READ!!!!!',dataRead)
'''
c=logical_clock()
send(('KILL_CHUNKSERVER',c), to=client2)
await(some(received(('KILL',chunkServer,c2)),
has=c2>c))
time.sleep(3)
'''
#send(('PRINT_MONITOR', ), to=processMon)
send(('DELETE','abc.txt'), to = client1)
await(received(('DONE',)))