Ejemplo n.º 1
0
def run():
    # NOTE(gRPC Python Team): .close() is possible on a channel and should be
    # used in circumstances in which the with statement does not fit the needs
    # of the code.
    channel = grpc.insecure_channel('localhost:50051')
    stub = account_pb2_grpc.GreeterStub(channel)
    response = stub.SayHello(account_pb2.HelloRequest(name='you',pronoun='x'))
    print("Greeter client received: " + response.message)
    response = stub.SayHelloAgain(account_pb2.HelloRequest(name='you',pronoun='x'))
    print("Greeter client received: " + response.message)
Ejemplo n.º 2
0
 def unlink(self, path):
     channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
     stub = account_pb2_grpc.GreeterStub(channel)
     full_path = self._full_path(path)
     request = "os.unlink('" + full_path + "')"
     response = stub.RunTerminalCommand(account_pb2.HelloRequest(name=request))
     return response.message
Ejemplo n.º 3
0
 def mkdir(self, path, mode):
     full_path = self._full_path(path)
     channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = "os.mkdir('" + full_path + "', " + str(mode) + ")"
     response = stub.RunTerminalCommand(account_pb2.HelloRequest(name=request))
     return response.message
Ejemplo n.º 4
0
 def open(self, path, flags):
     full_path = self._full_path(path)
     channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = ("os.open('" + full_path + "', %d)" % flags)
     response = stub.RunTerminalCommand2(account_pb2.HelloRequest(name=request))
     return response.message2
Ejemplo n.º 5
0
 def access(self, path, mode):
     full_path = self._full_path(path)
     channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = "os.access('" + full_path + "', " + str(mode) + ")"
     response = stub.RunTerminalCommand(account_pb2.HelloRequest(name=request))
     if not (response.message == "True"):
         raise FuseOSError(errno.EACCES)
Ejemplo n.º 6
0
def run(path):
    channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
    stub = account_pb2_grpc.GreeterStub(channel)
    response = stub.SayHello(account_pb2.HelloRequest(name=path))
    print("Greeter client received: " + response.message)
    mountpoint = "/home/student/Documents/fuse/"
    formatPath = path.replace(' ', '\ ')
    FUSE(Passthrough(path), mountpoint, nothreads=True, foreground=True)
Ejemplo n.º 7
0
 def create(self, path, mode, fi=None):
     full_path = self._full_path(path)
     channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
     stub = account_pb2_grpc.GreeterStub(channel)
     arguments = (os.O_WRONLY | os.O_CREAT, int(mode))
     request = ("os.open('" + full_path + "', %d, %d)" % arguments)
     response = stub.RunTerminalCommand(account_pb2.HelloRequest(name=request))
     return response.message
Ejemplo n.º 8
0
 def symlink(self, name, target):
     return os.symlink(name, self._full_path(target))
     channel = grpc.insecure_channel(ip, options=(('grpc.enable_http_proxy', 0),))
     stub = account_pb2_grpc.GreeterStub(channel)
     full_path = self._full_path(name)
     request = "os.symlink('" + target + "', " + full_path + ")"
     response = stub.RunTerminalCommand(account_pb2.HelloRequest(name=request))
     return response.message
Ejemplo n.º 9
0
 def write(self, path, buf, offset, fh):
     channel = grpc.insecure_channel(ip,
                                     options=(('grpc.enable_http_proxy',
                                               0), ))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = "myfuse.write('" + path + "', " + str(buf) + ", " + str(
         offset) + ", " + str(fh) + ")"
     response = stub.RunTerminalCommand(account_pb2.HelloRequest(request))
Ejemplo n.º 10
0
 def release(self, path, fh):
     channel = grpc.insecure_channel(ip,
                                     options=(('grpc.enable_http_proxy',
                                               0), ))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = "os.close(" + str(fh) + ")"
     response = stub.RunTerminalCommand2(
         account_pb2.HelloRequest(name=request))
     return response.message2
Ejemplo n.º 11
0
 def fsync(self, path, fdatasync, fh):
     return self.flush(path, fh)
     channel = grpc.insecure_channel(ip,
                                     options=(('grpc.enable_http_proxy',
                                               0), ))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = "os.flush(" + path + ", " + str(fh) + ")"
     response = stub.RunTerminalCommand2(
         account_pb2.HelloRequest(name=request))
     return response.message2
Ejemplo n.º 12
0
 def read(self, path, length, offset, fh):
     channel = grpc.insecure_channel(ip,
                                     options=(('grpc.enable_http_proxy',
                                               0), ))
     stub = account_pb2_grpc.GreeterStub(channel)
     request = (fh, offset, length)
     response = stub.RunTerminalCommand(
         account_pb2.HelloRequest(fh=request[0],
                                  offset=request[1],
                                  length=request[2]))
     return response.message