Exemplo n.º 1
0
 def delete(self, fname):
     resp = rpc.call_sync(
         conn=self._conn,
         method="delete",
         fname=fname
     )
     self._check_error(resp)
Exemplo n.º 2
0
 def close(self, fname):
     resp = rpc.call_sync(
         conn=self._conn,
         method="close",
         fname=fname
     )
     self._check_error(resp)
Exemplo n.º 3
0
 def delete_chunk(self, chunkid):
     resp = rpc.call_sync(
         self._conn,
         "delete_chunk",
         chunkid=chunkid
     )
     self._check_error(resp)
Exemplo n.º 4
0
 def request_new_chunk(self, fname):
     resp = rpc.call_sync(
         conn=self._conn,
         method="request_new_chunk",
         fname=fname
     )
     self._check_error(resp)
     return ChunkInfo.from_hash(resp)
Exemplo n.º 5
0
 def open(self, fname):
     resp = rpc.call_sync(
         conn=self._conn,
         method="open",
         fname=fname
     )
     self._check_error(resp)
     return FileInfo.from_hash(resp)
Exemplo n.º 6
0
 def write_chunk(self, chunkid, data):
     resp =  rpc.call_sync(
         self._conn,
         "write_chunk",
         chunkid=chunkid,
         data=data,
     )
     self._check_error(resp)
Exemplo n.º 7
0
 def read_chunk(self, chunkid,
                start_offset=-1,
                end_offset=-1):
     resp = rpc.call_sync(
         self._conn,
         "read_chunk",
         chunkid=chunkid,
         start_offset=start_offset,
         end_offset=end_offset
     )
     self._check_error(resp)
     return resp["chunk"]
Exemplo n.º 8
0
 def ping(self):
     resp = rpc.call_sync(self._conn, "ping")
     assert(resp["status"] == "OK")
Exemplo n.º 9
0
 def addr(self):
     resp = rpc.call_sync(self._conn, "get_client_port")
     port = int(resp["port"])
     host = self._conn.getpeername()[0]
     return (host, port)