@Override public DaRPCNameNodeFuture<RpcVoid> setFile(FileInfo fileInfo, boolean close) throws IOException { if (CrailConstants.DEBUG){ LOG.debug("RPC: setFile, id " + fileInfo.getFd() + ", close " + close); } RpcRequestMessage.SetFileReq setFileReq = new RpcRequestMessage.SetFileReq(fileInfo, close); DaRPCNameNodeRequest request = new DaRPCNameNodeRequest(setFileReq); request.setCommand(RpcProtocol.CMD_SET_FILE); RpcResponseMessage.VoidRes voidRes = new RpcResponseMessage.VoidRes(); DaRPCNameNodeResponse response = new DaRPCNameNodeResponse(voidRes); DaRPCFuture<DaRPCNameNodeRequest, DaRPCNameNodeResponse> future = issueRPC(request, response); DaRPCNameNodeFuture<RpcVoid> nameNodeFuture = new DaRPCNameNodeFuture<RpcVoid>(future, voidRes); return nameNodeFuture; }
break; case RpcProtocol.REQ_SET_FILE: setFileReq.update(buffer); break; case RpcProtocol.REQ_REMOVE_FILE:
break; case RpcProtocol.REQ_SET_FILE: written += setFileReq.write(buffer); break; case RpcProtocol.REQ_REMOVE_FILE:
break; case RpcProtocol.REQ_SET_FILE: message += setFileReq.toString(); break; case RpcProtocol.REQ_REMOVE_FILE:
break; case RpcProtocol.REQ_SET_FILE: written += setFileReq.write(buffer); break; case RpcProtocol.REQ_REMOVE_FILE:
break; case RpcProtocol.REQ_SET_FILE: written += setFileReq.write(buffer); break; case RpcProtocol.REQ_REMOVE_FILE:
break; case RpcProtocol.CMD_SET_FILE: record.setFile().getFileInfo().setToken(tokens.get(record.setFile().getFileInfo().getFd())); error = service.setFile(record.setFile(), response.getVoid(), response); break;
break; case RpcProtocol.REQ_SET_FILE: setFileReq.update(buffer); break; case RpcProtocol.REQ_REMOVE_FILE:
break; case RpcProtocol.REQ_SET_FILE: setFileReq.update(buffer); break; case RpcProtocol.REQ_REMOVE_FILE:
@Override public short setFile(RpcRequestMessage.SetFileReq request, RpcResponseMessage.VoidRes response, RpcNameNodeState errorState) throws Exception { //check protocol if (!RpcProtocol.verifyProtocol(RpcProtocol.CMD_SET_FILE, request, response)){ return RpcErrors.ERR_PROTOCOL_MISMATCH; } //get params FileInfo fileInfo = request.getFileInfo(); boolean close = request.isClose(); //rpc AbstractNode storedFile = fileTable.get(fileInfo.getFd()); if (storedFile == null){ return RpcErrors.ERR_FILE_NOT_OPEN; } if (storedFile.getToken() > 0 && storedFile.getToken() == fileInfo.getToken()){ storedFile.setCapacity(fileInfo.getCapacity()); } if (close){ storedFile.resetToken(); } if (CrailConstants.DEBUG){ LOG.info("setFile: " + fileInfo.toString() + ", close " + close); } return RpcErrors.ERR_OK; }
public TcpNameNodeRequest() { this.cmd = 0; this.type = 0; this.createFileReq = new RpcRequestMessage.CreateFileReq(); this.fileReq = new RpcRequestMessage.GetFileReq(); this.setFileReq = new RpcRequestMessage.SetFileReq(); this.removeReq = new RpcRequestMessage.RemoveFileReq(); this.renameFileReq = new RpcRequestMessage.RenameFileReq(); this.getBlockReq = new RpcRequestMessage.GetBlockReq(); this.getLocationReq = new RpcRequestMessage.GetLocationReq(); this.setBlockReq = new RpcRequestMessage.SetBlockReq(); this.dumpNameNodeReq = new RpcRequestMessage.DumpNameNodeReq(); this.pingNameNodeReq = new RpcRequestMessage.PingNameNodeReq(); this.getDataNodeReq = new RpcRequestMessage.GetDataNodeReq(); }
public DaRPCNameNodeRequest() { this.cmd = 0; this.type = 0; this.createFileReq = new RpcRequestMessage.CreateFileReq(); this.fileReq = new RpcRequestMessage.GetFileReq(); this.setFileReq = new RpcRequestMessage.SetFileReq(); this.removeReq = new RpcRequestMessage.RemoveFileReq(); this.renameFileReq = new RpcRequestMessage.RenameFileReq(); this.getBlockReq = new RpcRequestMessage.GetBlockReq(); this.getLocationReq = new RpcRequestMessage.GetLocationReq(); this.setBlockReq = new RpcRequestMessage.SetBlockReq(); this.dumpNameNodeReq = new RpcRequestMessage.DumpNameNodeReq(); this.pingNameNodeReq = new RpcRequestMessage.PingNameNodeReq(); this.getDataNodeReq = new RpcRequestMessage.GetDataNodeReq(); }
public LogRecord() { this.cmd = 0; this.type = 0; this.createFileReq = new RpcRequestMessage.CreateFileReq(); this.fileReq = new RpcRequestMessage.GetFileReq(); this.setFileReq = new RpcRequestMessage.SetFileReq(); this.removeReq = new RpcRequestMessage.RemoveFileReq(); this.renameFileReq = new RpcRequestMessage.RenameFileReq(); this.getBlockReq = new RpcRequestMessage.GetBlockReq(); this.getLocationReq = new RpcRequestMessage.GetLocationReq(); this.setBlockReq = new RpcRequestMessage.SetBlockReq(); this.dumpNameNodeReq = new RpcRequestMessage.DumpNameNodeReq(); this.pingNameNodeReq = new RpcRequestMessage.PingNameNodeReq(); this.getDataNodeReq = new RpcRequestMessage.GetDataNodeReq(); }
public LogRecord(RpcRequestMessage.SetFileReq message) { this.type = message.getType(); this.setFileReq = message; }
public DaRPCNameNodeRequest(RpcRequestMessage.SetFileReq message) { this.type = message.getType(); this.setFileReq = message; }
public TcpNameNodeRequest(RpcRequestMessage.SetFileReq message) { this.type = message.getType(); this.setFileReq = message; }
public RpcFuture<RpcVoid> setFile(FileInfo fileInfo, boolean b) throws IOException { RpcRequestMessage.SetFileReq req = new RpcRequestMessage.SetFileReq(fileInfo, b); RpcResponseMessage.VoidRes resp = new RpcResponseMessage.VoidRes(); TcpNameNodeRequest request = new TcpNameNodeRequest(req); TcpNameNodeResponse response = new TcpNameNodeResponse(resp); request.setCommand(RpcProtocol.CMD_SET_FILE); NaRPCFuture<TcpNameNodeRequest, TcpNameNodeResponse> future = endpoint.issueRequest(request, response); return new TcpFuture<RpcVoid>(future, resp); }