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
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
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
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)
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)
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)
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)
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)
def ping(self, data_msg=""): req = server_pb2.Request(ping=server_pb2.PingRequest(msg=data_msg)) return self.stub.ping(req)