-
Notifications
You must be signed in to change notification settings - Fork 4
/
store
executable file
·73 lines (67 loc) · 1.07 KB
/
store
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
#!/usr/bin/env bash
. config.inc.sh
. internal_utils.inc.sh
#PUT_NEW_OBJECT()
#DISTRIBUTE_FILES ()
#SEND_FILE_TO_NODE()
#GET_FILE_LIST_FROM_NODE()
#GET_OBJECT_CONTENTS()
#DELETE_OBJECT_ACROSS_NODES()
#ERROR()
USAGE() {
cat <<EOF
Usage: store help
init
put
list
get <object ref>
delete <object ref>
EOF
}
if [ -z "$1" ]; then
USAGE
else
subcommand="$1"
shift
case "$subcommand" in
"help")
USAGE
;;
"put")
if [ -z "$1" ]; then
PUT_NEW_OBJECT
else
USAGE
fi
;;
"get")
while [ -n "$1" ]; do
GET_OBJECT_CONTENTS "$1"
shift
done
;;
"list")
if [ -z "$1" ]; then
GET_LIST_OF_ALL_OBJECTS
else
USAGE
fi
;;
"delete")
while [ -n "$1" ]; do
DELETE_OBJECT_ACROSS_NODES "$1"
shift
done
;;
"init")
if [ -z "$1" ]; then
INIT
else
USAGE
fi
;;
*)
ERROR "invalid subcommand"
;;
esac
fi