private static void prepWriteFragmentSpecificProcessing(Pipe pipe, final int cursorPosition, FieldReferenceOffsetManager from) { if (FieldReferenceOffsetManager.isTemplateStart(from, cursorPosition)) { prepWriteMessageStart(pipe, cursorPosition, from); } else { //this fragment does not start a new message but its start position must be recorded for usage later pipe.ringWalker.activeWriteFragmentStack[from.fragDepth[cursorPosition]]=Pipe.workingHeadPosition(pipe); } }
private static void prepWriteFragmentSpecificProcessing(Pipe pipe, final int cursorPosition, FieldReferenceOffsetManager from) { if (FieldReferenceOffsetManager.isTemplateStart(from, cursorPosition)) { prepWriteMessageStart(pipe, cursorPosition, from); } else { //this fragment does not start a new message but its start position must be recorded for usage later pipe.ringWalker.activeWriteFragmentStack[from.fragDepth[cursorPosition]]=Pipe.workingHeadPosition(pipe); } }
private static void prepWriteFragmentSpecificProcessing(Pipe pipe, final int cursorPosition, FieldReferenceOffsetManager from) { if (FieldReferenceOffsetManager.isTemplateStart(from, cursorPosition)) { prepWriteMessageStart(pipe, cursorPosition, from); } else { //this fragment does not start a new message but its start position must be recorded for usage later pipe.ringWalker.activeWriteFragmentStack[from.fragDepth[cursorPosition]]=Pipe.workingHeadPosition(pipe); } }
@Override protected void processCaller(int cursor) throws IOException { FieldReferenceOffsetManager from = MessageSchema.from(schema); appendCaseMsgIdConstant(bodyTarget.append(tab).append(tab).append("case "), cursor, schema).append(":\n"); if ( FieldReferenceOffsetManager.isTemplateStart(from, cursor) ) { beginMessage(bodyTarget, cursor); } bodyTarget.append(tab).append(tab).append(tab); appendBusinessMethodName(cursor).append("();\n"); //Pipe.confirmLowLevelWrite(input, 8); int fragmentSizeLiteral = from.fragDataSize[cursor]; if (buildFullStageWritingToPipe()) { appendStaticCall(bodyTarget.append(tab).append(tab).append(tab), pipeClass, "confirmLowLevelWrite").append(pipeVarName).append(", "); Appendables.appendValue(bodyTarget, fragmentSizeLiteral); bodyTarget.append("/* fragment "); Appendables.appendValue(bodyTarget, cursor).append(" size "); Appendables.appendValue(bodyTarget, from.fragScriptSize[cursor]); bodyTarget.append("*/);\n"); } bodyTarget.append(tab).append(tab).append("break;\n"); }
@Override protected void processCaller(int cursor) throws IOException { FieldReferenceOffsetManager from = MessageSchema.from(schema); appendCaseMsgIdConstant(bodyTarget.append(tab).append(tab).append("case "), cursor, schema).append(":\n"); if ( FieldReferenceOffsetManager.isTemplateStart(from, cursor) ) { beginMessage(bodyTarget, cursor); } bodyTarget.append(tab).append(tab).append(tab); appendBusinessMethodName(cursor).append("();\n"); //Pipe.confirmLowLevelWrite(input, 8); int fragmentSizeLiteral = from.fragDataSize[cursor]; if (buildFullStageWritingToPipe()) { appendStaticCall(bodyTarget.append(tab).append(tab).append(tab), pipeClass, "confirmLowLevelWrite").append(pipeVarName).append(", "); Appendables.appendValue(bodyTarget, fragmentSizeLiteral); bodyTarget.append("/* fragment "); Appendables.appendValue(bodyTarget, cursor).append(" size "); Appendables.appendValue(bodyTarget, from.fragScriptSize[cursor]); bodyTarget.append("*/);\n"); } bodyTarget.append(tab).append(tab).append("break;\n"); }
@Override protected void processCaller(int cursor) throws IOException { FieldReferenceOffsetManager from = MessageSchema.from(schema); appendCaseMsgIdConstant(bodyTarget.append(tab).append(tab).append("case "), cursor, schema).append(":\n"); if ( FieldReferenceOffsetManager.isTemplateStart(from, cursor) ) { beginMessage(bodyTarget, cursor); } bodyTarget.append(tab).append(tab).append(tab); appendBusinessMethodName(cursor).append("();\n"); //Pipe.confirmLowLevelWrite(input, 8); int fragmentSizeLiteral = from.fragDataSize[cursor]; if (buildFullStageWritingToPipe()) { appendStaticCall(bodyTarget.append(tab).append(tab).append(tab), pipeClass, "confirmLowLevelWrite").append(pipeVarName).append(", "); Appendables.appendValue(bodyTarget, fragmentSizeLiteral); bodyTarget.append("/* fragment "); Appendables.appendValue(bodyTarget, cursor).append(" size "); Appendables.appendValue(bodyTarget, from.fragScriptSize[cursor]); bodyTarget.append("*/);\n"); } bodyTarget.append(tab).append(tab).append("break;\n"); }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
public static <S extends MessageSchema<S>> boolean tryReadFragment(Pipe<S> pipe) { assert( (!PipeReader.hasContentToRead(pipe)) || PipeMonitor.monitor(pipe, pipe.ringWalker.nextWorkingTail, Pipe.bytesReadBase(pipe) ) ); assert(pipe.usingHighLevelAPI); assert(Pipe.singleThreadPerPipeRead(pipe.id)); assert(null!=pipe.ringWalker) : "NullPointer, double check that pipe was passed into super constructor of stage."; if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(StackStateWalker.isSeqStackEmpty(pipe.ringWalker)) : "Error the seqStack should be empty"; return StackStateWalker.prepReadMessage(pipe, pipe.ringWalker); } else { return StackStateWalker.prepReadFragment(pipe, pipe.ringWalker); } }
/** * Reads next message without allowing ReadLock to be overwritten * @param pipe pipe where this message is found */ public static boolean readNextWithoutReleasingReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int bytesConsumed = collectConsumedCountOfBytes(pipe); if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; //moves us forward so we can read the next fragment/message Pipe.markBytesReadBase(pipe); PendingReleaseData.appendPendingReadRelease(pipe.pendingReleases, pipe.ringWalker.nextWorkingTail, Pipe.getWorkingBlobTailPosition(pipe), bytesConsumed); return true; } else { return false; } }
/** * Reads next message without allowing ReadLock to be overwritten * @param pipe pipe where this message is found */ public static boolean readNextWithoutReleasingReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int bytesConsumed = collectConsumedCountOfBytes(pipe); if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; //moves us forward so we can read the next fragment/message Pipe.markBytesReadBase(pipe); PendingReleaseData.appendPendingReadRelease(pipe.pendingReleases, pipe.ringWalker.nextWorkingTail, Pipe.getWorkingBlobTailPosition(pipe), bytesConsumed); return true; } else { return false; } }
/** * Reads next message without allowing ReadLock to be overwritten * @param pipe pipe where this message is found */ public static boolean readNextWithoutReleasingReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int bytesConsumed = collectConsumedCountOfBytes(pipe); if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; //moves us forward so we can read the next fragment/message Pipe.markBytesReadBase(pipe); PendingReleaseData.appendPendingReadRelease(pipe.pendingReleases, pipe.ringWalker.nextWorkingTail, Pipe.getWorkingBlobTailPosition(pipe), bytesConsumed); return true; } else { return false; } }
/** * Release the record which has been most recently read. * The act of releasing a record/message allows it to now be written over. * @param pipe The pipe where this message is found. * @return The total number of variable length field bytes consumed by this now released message. */ public static int releaseReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int consumed = collectConsumedCountOfBytes(pipe); //ensure we only call for new templates. if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; Pipe.markBytesReadBase(pipe); //moves us forward so we can read the next fragment/message Pipe.releaseBatchedReads(pipe, Pipe.getWorkingBlobTailPosition(pipe), pipe.ringWalker.nextWorkingTail); } else { Pipe.decBatchRelease(pipe);//sequence fragments must cause this number to move } //ensure that the working value does not fall behind the new published tail position. //this allows peek by direct offset to be supported when needed Pipe.setWorkingTailPosition(pipe, Pipe.tailPosition(pipe)); return consumed; }
/** * Release the record which has been most recently read. * The act of releasing a record/message allows it to now be written over. * @param pipe The pipe where this message is found. * @return The total number of variable length field bytes consumed by this now released message. */ public static int releaseReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int consumed = collectConsumedCountOfBytes(pipe); //ensure we only call for new templates. if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; Pipe.markBytesReadBase(pipe); //moves us forward so we can read the next fragment/message Pipe.releaseBatchedReads(pipe, Pipe.getWorkingBlobTailPosition(pipe), pipe.ringWalker.nextWorkingTail); } else { Pipe.decBatchRelease(pipe);//sequence fragments must cause this number to move } //ensure that the working value does not fall behind the new published tail position. //this allows peek by direct offset to be supported when needed Pipe.setWorkingTailPosition(pipe, Pipe.tailPosition(pipe)); return consumed; }
/** * Release the record which has been most recently read. * The act of releasing a record/message allows it to now be written over. * @param pipe The pipe where this message is found. * @return The total number of variable length field bytes consumed by this now released message. */ public static int releaseReadLock(Pipe pipe) { assert(Pipe.singleThreadPerPipeRead(pipe.id)); int consumed = collectConsumedCountOfBytes(pipe); //ensure we only call for new templates. if (FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipe), pipe.ringWalker.nextCursor)) { assert(Pipe.isReplaying(pipe) || pipe.ringWalker.nextWorkingTail!=Pipe.getWorkingTailPosition(pipe)) : "Only call release once per message"; Pipe.markBytesReadBase(pipe); //moves us forward so we can read the next fragment/message Pipe.releaseBatchedReads(pipe, Pipe.getWorkingBlobTailPosition(pipe), pipe.ringWalker.nextWorkingTail); } else { Pipe.decBatchRelease(pipe);//sequence fragments must cause this number to move } //ensure that the working value does not fall behind the new published tail position. //this allows peek by direct offset to be supported when needed Pipe.setWorkingTailPosition(pipe, Pipe.tailPosition(pipe)); return consumed; }
processCalleeOpen(cursor); boolean isMessageStart = FieldReferenceOffsetManager.isTemplateStart(from, cursor);
processCalleeOpen(cursor); boolean isMessageStart = FieldReferenceOffsetManager.isTemplateStart(from, cursor);
processCalleeOpen(cursor); boolean isMessageStart = FieldReferenceOffsetManager.isTemplateStart(from, cursor);
while (copied && !FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipeIn), pipeIn.ringWalker.nextCursor)) {
while (copied && !FieldReferenceOffsetManager.isTemplateStart(Pipe.from(pipeIn), pipeIn.ringWalker.nextCursor)) {