-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple_README
66 lines (31 loc) · 1.62 KB
/
Simple_README
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
There is the minimal version
WARNING, we are working without a supervisor so any erroneous inout or command might crash the server and we may have to restart from the beginning.
input:
c(mydb_serv).
STARTING the server.
mydb_serv:start().
Create an entry in the database ():
mydb_serv:write(YourKey,YourValue). (example: mydb_serv:write(1,"Hello") )
Read a value in the database ():
mydb_serv:read(YourKey). (example: mydb_serv:read(1) )
Update a value in the database ():
mydb_serv:update(YourKey,YourValue) (example: mydb_serv:update(1,"World") )
Delete a value in the database ():
mydb_serv:delete(YourKey). (example: mydb_serv:delete(1) )
Clear the database:
mydb_serv:clear().
%NB we can still start it from the supervisor but a shell crash will kill the supervisor and our db:
STARTING the supervisor ( will start also start our db ).
mydb_sup:start_link().
Create an entry in the database ():
mydb_serv:write(YourKey,YourValue). (example: mydb_serv:write(1,"Hello") )
Read a value in the database ():
mydb_serv:read(YourKey). (example: mydb_serv:read(1) )
Update a value in the database ():
mydb_serv:update(YourKey,YourValue) (example: mydb_serv:update(1,"World") )
Delete a value in the database ():
mydb_serv:delete(YourKey). (example: mydb_serv:delete(1) )
Clear the database:
mydb_serv:clear().
NEW ADDITION: crash the database:
exit(whereis(mydb_serv),kill). (everything will work as there was nothing, you can try it with the version without supervisor to see the difference)