private void storeNewFileData(TrieParser trie, final int rootSize, StringBuilder builder, int newPathId, byte[] asBytes, final int bytesLength, int typeId, FileChannel activeFileChannel) throws IOException { long fileSize = activeFileChannel.size(); trie.setValue(asBytes, rootSize, bytesLength, Integer.MAX_VALUE, newPathId); builder.setLength(0); data.getType()[newPathId] = typeId; data.getFcId()[newPathId] = channelHolder.add(activeFileChannel); data.getEtagBytes()[newPathId] = Appendables.appendHexDigits(builder, data.getFcId()[newPathId]).toString().getBytes(); data.getFileSizes()[newPathId] = fileSize; builder.setLength(0); }
private void findAgainFileChannel(int pathId) { /////////////// //we lost our file channel and need to request a new one. ////////////// try { assert( data.getPaths().length > 0); assert( data.getPaths()[pathId].toFile().isFile() ); assert( data.getPaths()[pathId].toFile().exists() ); //logger.info("looking for {}",data.getPaths()[pathId]); activeFileChannel = data.fileSystem.provider().newFileChannel(data.getPaths()[pathId], data.getReadOptions()); data.getFcId()[pathId] = channelHolder.add(activeFileChannel); data.getFileSizes()[pathId] = activeFileChannel.size(); } catch (IOException e) { throw new RuntimeException(e); } }
private void storeNewFileData(TrieParser trie, final int rootSize, StringBuilder builder, Path path, final int newPathId, byte[] asBytes, final int bytesLength, int typeId, FileChannel activeFileChannel) throws IOException { data.getPaths()[newPathId] = path; long fileSize = activeFileChannel.size(); trie.setValue(asBytes, rootSize, bytesLength, Integer.MAX_VALUE, newPathId); builder.setLength(0); data.getType()[newPathId] = typeId; data.getFcId()[newPathId] = channelHolder.add(activeFileChannel); data.getEtagBytes()[newPathId] = Appendables.appendHexDigits(builder, data.getFcId()[newPathId]).toString().getBytes(); data.getFileSizes()[newPathId] = fileSize; builder.setLength(0); }
final long fileSize = data.getFileSizes()[pathId]; if (supportInFlightCopy && /*Only use if the file was written previously*/ oldBlobPosition>0 &&
private void beginSendingFile(int httpRevision, int requestContext, int pathId, int verb, int sequence, Pipe<HTTPRequestSchema> input, Pipe<ServerResponseSchema> output) { try { activePayloadSizeRemaining = data.getFileSizes()[pathId]; byte[] contentType = httpSpec.contentTypes[data.getType()[pathId]].getBytes(); assert(data.getFileSizes()[pathId]<Integer.MAX_VALUE) : "Can not support files larger than 2G at this time."; boolean chunked = false; int headerSize = Pipe.addMsgIdx(output, ServerResponseSchema.MSG_TOCHANNEL_100); //channel, sequence, context, payload contentType, (int)data.getFileSizes()[pathId], chunked, reportServer, writer, 1&(requestContext>>ServerCoordinator.CLOSE_CONNECTION_SHIFT),