Пример #1
0
 def create_streaming_request_for_local_put(self, data):
     req = server_pb2.Request(
         fromSender=self.host,
         putRequest=server_pb2.PutRequest(
             metaData=server_pb2.MetaData(uuid=''),
             datFragment=server_pb2.DatFragment(data=str(data).encode(
                 encoding='utf_8'))))
     yield req
Пример #2
0
 def create_streaming_request(self,putData):
     req = server_pb2.Request(
         fromSender='some put sender',
         toReceiver='some put receiver',
     putRequest=server_pb2.PutRequest(
       metaData=server_pb2.MetaData(uuid='14829'),
       datFragment=server_pb2.DatFragment(data= str(putData).encode(encoding='utf_8'))
     ))
     yield req
Пример #3
0
 def create_streaming_request(self, file):
     for x in chunktest.process(None, request=False, name=file):
         req = server_pb2.Request(
             fromSender=self.host,
             putRequest=server_pb2.PutRequest(
                 metaData=server_pb2.MetaData(uuid=''),
                 datFragment=server_pb2.DatFragment(
                     data=str("".join(x)).encode(encoding='utf_8'))))
         yield req
Пример #4
0
 def GetFromLocalCluster(self, from_timestamp, to_timestamp):
     req = server_pb2.Request(fromSender=self.host,
                              getRequest=server_pb2.GetRequest(
                                  metaData=server_pb2.MetaData(uuid=''),
                                  queryParams=server_pb2.QueryParams(
                                      from_utc=from_timestamp,
                                      to_utc=to_timestamp)))
     for stream in self.stub.GetFromLocalCluster(req):
         yield (stream)
Пример #5
0
 def ping(self,data_msg):
     print ("Insid ping")
     req = server_pb2.Request(
         fromSender='some put sender',
         toReceiver='some put receiver',
     ping=server_pb2.PingRequest(
       msg = data_msg
     ))
     print(req)
     return self.stub.ping(req)
Пример #6
0
 def getHandler(self, from_timestamp, to_timestamp):
     req = server_pb2.Request(
         fromSender='prof',
         toReceiver='some put receiver',
     getRequest=server_pb2.GetRequest(
       metaData=server_pb2.MetaData(uuid='14829'),
       queryParams=server_pb2.QueryParams(from_utc=from_timestamp,to_utc=to_timestamp))
     )
     for stream in self.stub.getHandler(req):
         yield(stream)
Пример #7
0
 def GetFromLocalCluster(self, from_timestamp, to_timestamp):
     req = server_pb2.Request(
         fromSender='some put sender',
         toReceiver='some put receiver',
     getRequest=server_pb2.GetRequest(
       metaData=server_pb2.MetaData(uuid='14829'),
       queryParams=server_pb2.QueryParams(from_utc=from_timestamp,to_utc=to_timestamp))
     )
     print("Client GetFromLocalCluster",req)
     for stream in self.stub.GetFromLocalCluster(req):
         yield(stream)
Пример #8
0
 def getHandler(self, from_timestamp, to_timestamp):
     #cache_key = str(from_timestamp).replace(" ","") + str(to_timestamp).replace(" ","")
     #if 10>11:
     #print("in cache"+cache_key)
     #value = mc.get(cache_key)
     #yield value.datFragment
     #else:
     req = server_pb2.Request(fromSender=self.host,
                              getRequest=server_pb2.GetRequest(
                                  metaData=server_pb2.MetaData(uuid=''),
                                  queryParams=server_pb2.QueryParams(
                                      from_utc=from_timestamp,
                                      to_utc=to_timestamp)))
     for stream in self.stub.getHandler(req):
         #mc.set(cache_key,stream)
         yield (stream)
Пример #9
0
 def ping(self, data_msg=""):
     req = server_pb2.Request(ping=server_pb2.PingRequest(msg=data_msg))
     return self.stub.ping(req)