aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlas Kozat <ulas.kozat@gmail.com>2016-06-02 09:36:48 -0700
committerUlas Kozat <ulas.kozat@gmail.com>2016-06-02 09:36:48 -0700
commitfd9248da568af0825aee8bdf612b605721c2a24b (patch)
tree7da600aff347e62bc24d00884fd90a4d04e9e834
parentd79c943631b2d118983e60a04eb88578157d9632 (diff)
removed pyc files, added label and template subscription options to overwrite and delete existing entries
Change-Id: Ic44e6463bbdd4fc8365099d36c0d9df50b1b2249 Signed-off-by: Ulas Kozat <ulas.kozat@gmail.com>
-rwxr-xr-xDominoClient.py29
-rwxr-xr-xDominoServer.py3
-rwxr-xr-xdocs/userguide/api-documentation.rst2
-rwxr-xr-xdomino-cli.py1
-rw-r--r--lib/dominoCLI/DominoClientCLI.pycbin9096 -> 0 bytes
-rw-r--r--lib/dominoCLI/__init__.pycbin186 -> 0 bytes
-rw-r--r--lib/dominoCLI/constants.pycbin299 -> 0 bytes
-rw-r--r--lib/dominoCLI/ttypes.pycbin5839 -> 0 bytes
-rw-r--r--lib/dominoRPC/Communication.pycbin41494 -> 0 bytes
-rw-r--r--lib/dominoRPC/__init__.pycbin181 -> 0 bytes
-rw-r--r--lib/dominoRPC/constants.py2
-rw-r--r--lib/dominoRPC/constants.pycbin761 -> 0 bytes
-rw-r--r--lib/dominoRPC/ttypes.pycbin42261 -> 0 bytes
-rw-r--r--lib/mapper/__init__.pycbin142 -> 0 bytes
-rw-r--r--lib/mapper/label.pycbin1764 -> 0 bytes
-rw-r--r--lib/partitioner/__init__.pycbin154 -> 0 bytes
-rw-r--r--lib/partitioner/constants.pycbin261 -> 0 bytes
-rw-r--r--lib/partitioner/partitioner.pycbin2745 -> 0 bytes
-rw-r--r--lib/thrift/Thrift.pycbin4970 -> 0 bytes
-rw-r--r--lib/thrift/__init__.pycbin157 -> 0 bytes
-rw-r--r--lib/util/__init__.pycbin158 -> 0 bytes
-rw-r--r--lib/util/miscutil.pycbin345 -> 0 bytes
-rw-r--r--lib/util/netutil.pycbin516 -> 0 bytes
23 files changed, 27 insertions, 10 deletions
diff --git a/DominoClient.py b/DominoClient.py
index c0a3cf1..d324e0d 100755
--- a/DominoClient.py
+++ b/DominoClient.py
@@ -132,7 +132,6 @@ class DominoClientCLIService(threading.Thread):
self.interactive = interactive
def process_input(self, args):
-
try:
if args[0] == 'heartbeat':
self.dominoclient.heartbeat()
@@ -152,16 +151,30 @@ class DominoClientCLIService(threading.Thread):
elif args[0] == 'subscribe':
labels = []
templateTypes = []
- opts, args = getopt.getopt(args[1:],"l:t:",["labels=","ttype="])
+ labelop = APPEND
+ templateop = APPEND
+ opts, args = getopt.getopt(args[1:],"l:t:",["labels=","ttype=","lop=","top="])
for opt, arg in opts:
if opt in ('-l', '--labels'):
labels = labels + arg.split(',')
elif opt in ('-t', '--ttype'):
- templateTypes = templateTypes + arg.split(',')
-
+ templateTypes = templateTypes + arg.split(',')
+ elif opt in ('--lop'):
+ try:
+ labelop = str2enum[arg.upper()]
+ except KeyError as ex:
+ print '\nInvalid label option, pick one of: APPEND, OVERWRITE, DELETE'
+ return
+ elif opt in ('--top'):
+ try:
+ templateop = str2enum[arg.upper()]
+ except KeyError as ex:
+ print '\nInvalid label option, pick one of: APPEND, OVERWRITE, DELETE'
+ return
+
#check if labels or supported templates are nonempty
if labels != [] or templateTypes != []:
- self.dominoclient.subscribe(labels, templateTypes)
+ self.dominoclient.subscribe(labels, templateTypes, labelop, templateop)
elif args[0] == 'register':
self.dominoclient.start()
@@ -316,7 +329,7 @@ class DominoClient:
self.seqno = self.seqno + 1
- def subscribe(self, labels, templateTypes):
+ def subscribe(self, labels, templateTypes, label_op, template_op):
if self.state == 'UNREGISTERED':
self.start()
@@ -325,9 +338,9 @@ class DominoClient:
sub_msg = SubscribeMessage()
sub_msg.domino_udid = self.UDID
sub_msg.seq_no = self.seqno
- sub_msg.template_op = APPEND
+ sub_msg.template_op = template_op
sub_msg.supported_template_types = templateTypes
- sub_msg.label_op = APPEND
+ sub_msg.label_op = label_op
sub_msg.labels = labels
try:
sub_msg_r = self.sender().d_subscribe(sub_msg)
diff --git a/DominoServer.py b/DominoServer.py
index 417144e..39c4632 100755
--- a/DominoServer.py
+++ b/DominoServer.py
@@ -164,13 +164,16 @@ class CommunicationHandler:
if sub_msg.labels != []:
if sub_msg.label_op == APPEND:
+ logging.debug('APPENDING Labels...')
if self.dominoServer.subscribed_labels.has_key(sub_msg.domino_udid):
self.dominoServer.subscribed_labels[sub_msg.domino_udid].update(set(sub_msg.labels))
else:
self.dominoServer.subscribed_labels[sub_msg.domino_udid] = set(sub_msg.labels)
elif sub_msg.label_op == OVERWRITE:
+ logging.debug('OVERWRITING Labels...')
self.dominoServer.subscribed_labels[sub_msg.domino_udid] = set(sub_msg.labels)
elif sub_msg.label_op == DELETE:
+ logging.debug('DELETING Labels...')
self.dominoServer.subscribed_labels[sub_msg.domino_udid].difference_update(set(sub_msg.labels))
logging.debug('Supported Template: %s Supported Labels: %s' , self.dominoServer.subscribed_templateformats[sub_msg.domino_udid] , self.dominoServer.subscribed_labels[sub_msg.domino_udid])
diff --git a/docs/userguide/api-documentation.rst b/docs/userguide/api-documentation.rst
index 2937127..bff6e2b 100755
--- a/docs/userguide/api-documentation.rst
+++ b/docs/userguide/api-documentation.rst
@@ -13,7 +13,7 @@ Using domino-cli Client
=======================
Make sure that domino-cli.py is in +x mode.
-Change directory to where domino-cli.py is located or include file path in the PATH environment variable
+Change directory to where domino-cli.py is located or include file path in the PATH environment variable.
* Registration Command
diff --git a/domino-cli.py b/domino-cli.py
index 8768ea6..3edf22c 100755
--- a/domino-cli.py
+++ b/domino-cli.py
@@ -53,7 +53,6 @@ def main(argv):
CLImsg = CLIMessage()
CLImsg.CLI_input = argv
CLIrespmsg = client.d_CLI(CLImsg)
- print CLIrespmsg.CLI_response
except Thrift.TException, tx:
print '%s' % (tx.message)
diff --git a/lib/dominoCLI/DominoClientCLI.pyc b/lib/dominoCLI/DominoClientCLI.pyc
deleted file mode 100644
index 0c01101..0000000
--- a/lib/dominoCLI/DominoClientCLI.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoCLI/__init__.pyc b/lib/dominoCLI/__init__.pyc
deleted file mode 100644
index dfa3544..0000000
--- a/lib/dominoCLI/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoCLI/constants.pyc b/lib/dominoCLI/constants.pyc
deleted file mode 100644
index 466e728..0000000
--- a/lib/dominoCLI/constants.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoCLI/ttypes.pyc b/lib/dominoCLI/ttypes.pyc
deleted file mode 100644
index 03a5979..0000000
--- a/lib/dominoCLI/ttypes.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoRPC/Communication.pyc b/lib/dominoRPC/Communication.pyc
deleted file mode 100644
index b697bc2..0000000
--- a/lib/dominoRPC/Communication.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoRPC/__init__.pyc b/lib/dominoRPC/__init__.pyc
deleted file mode 100644
index 52cf85c..0000000
--- a/lib/dominoRPC/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoRPC/constants.py b/lib/dominoRPC/constants.py
index 57b7c26..bafaf44 100644
--- a/lib/dominoRPC/constants.py
+++ b/lib/dominoRPC/constants.py
@@ -27,3 +27,5 @@ OVERWRITE = 1
DELETE = 2
THRIFT_RPC_TIMEOUT_MS = 1000
+
+str2enum = {"APPEND":APPEND, "OVERWRITE":OVERWRITE, "DELETE":DELETE}
diff --git a/lib/dominoRPC/constants.pyc b/lib/dominoRPC/constants.pyc
deleted file mode 100644
index 18c888f..0000000
--- a/lib/dominoRPC/constants.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/dominoRPC/ttypes.pyc b/lib/dominoRPC/ttypes.pyc
deleted file mode 100644
index be548d1..0000000
--- a/lib/dominoRPC/ttypes.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/mapper/__init__.pyc b/lib/mapper/__init__.pyc
deleted file mode 100644
index 9fda083..0000000
--- a/lib/mapper/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/mapper/label.pyc b/lib/mapper/label.pyc
deleted file mode 100644
index 2a223fe..0000000
--- a/lib/mapper/label.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/partitioner/__init__.pyc b/lib/partitioner/__init__.pyc
deleted file mode 100644
index f380195..0000000
--- a/lib/partitioner/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/partitioner/constants.pyc b/lib/partitioner/constants.pyc
deleted file mode 100644
index 7d28f20..0000000
--- a/lib/partitioner/constants.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/partitioner/partitioner.pyc b/lib/partitioner/partitioner.pyc
deleted file mode 100644
index 7c04d38..0000000
--- a/lib/partitioner/partitioner.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/thrift/Thrift.pyc b/lib/thrift/Thrift.pyc
deleted file mode 100644
index 941bb77..0000000
--- a/lib/thrift/Thrift.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/thrift/__init__.pyc b/lib/thrift/__init__.pyc
deleted file mode 100644
index 856c5ca..0000000
--- a/lib/thrift/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/util/__init__.pyc b/lib/util/__init__.pyc
deleted file mode 100644
index 9226731..0000000
--- a/lib/util/__init__.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/util/miscutil.pyc b/lib/util/miscutil.pyc
deleted file mode 100644
index ffc4524..0000000
--- a/lib/util/miscutil.pyc
+++ /dev/null
Binary files differ
diff --git a/lib/util/netutil.pyc b/lib/util/netutil.pyc
deleted file mode 100644
index ad3953e..0000000
--- a/lib/util/netutil.pyc
+++ /dev/null
Binary files differ