@Override public void visitTemplateOpen(String name, long id) { needsClose = true; int msgIdx = Pipe.takeMsgIdx(expectedInput); activeCursor = msgIdx; if (id != expectedFrom.fieldIdScript[msgIdx]) { throw new AssertionError("expected message id: "+expectedFrom.fieldIdScript[msgIdx]+" was given "+id); } }
/** * skip over the next fragment and position for reading after that fragment * * @param pipe Pipe source */ public static <S extends MessageSchema<S>> void skipNextFragment(Pipe<S> pipe) { skipNextFragment(pipe, Pipe.takeMsgIdx(pipe)); }
/** * skip over the next fragment and position for reading after that fragment * * @param pipe Pipe source */ public static <S extends MessageSchema<S>> void skipNextFragment(Pipe<S> pipe) { skipNextFragment(pipe, Pipe.takeMsgIdx(pipe)); }
private void closeTransform(DataOutputBlobWriter<RawDataSchema> outputStream) { //finished writing the converted bytes closeEncoder(workingPipeB, outputStream); //release the input template Pipe.releaseReadLock(workingPipeA); Pipe.takeMsgIdx(workingPipeB); }
private boolean beginNewRead() { int msgIdx = Pipe.takeMsgIdx(pipe); if (RawDataSchema.MSG_CHUNKEDSTREAM_1 == msgIdx) { totalBytesRead = totalBytesRead+inputStreamFlyweight.openLowLevelAPIField(); hasOpenRead = true; return true; } else { shutdown("EOF Message detected."); } return false; }
private void closeTransform(DataOutputBlobWriter<RawDataSchema> outputStream) { //finished writing the converted bytes closeEncoder(workingPipeB, outputStream); //release the input template Pipe.releaseReadLock(workingPipeA); Pipe.takeMsgIdx(workingPipeB); }
private boolean beginNewRead() { int msgIdx = Pipe.takeMsgIdx(pipe); if (RawDataSchema.MSG_CHUNKEDSTREAM_1 == msgIdx) { totalBytesRead = totalBytesRead+inputStreamFlyweight.openLowLevelAPIField(); hasOpenRead = true; return true; } else { shutdown("EOF Message detected."); } return false; }
private void detectShutdownInProgress() { if (Pipe.peekMsg(primaryIn, -1)) { //shutdown in progress so give up waiting Pipe.takeMsgIdx(primaryIn); Pipe.confirmLowLevelRead(primaryIn, Pipe.EOF_SIZE); Pipe.releaseReadLock(primaryIn); shutdownInProgress = true; } }
public static <S extends MessageSchema<S>> int readI(Pipe<S> pipe) { int msgIdx = Pipe.takeMsgIdx(pipe); assert(3==Pipe.from(pipe).fragDataSize[msgIdx]) : "This constant does not this fragment size"; int value = Pipe.takeInt(pipe); Pipe.confirmLowLevelRead(pipe, 3); Pipe.releaseReadLock(pipe); return value; }
public static <S extends MessageSchema<S>> int readI(Pipe<S> pipe) { int msgIdx = Pipe.takeMsgIdx(pipe); assert(3==Pipe.from(pipe).fragDataSize[msgIdx]) : "This constant does not this fragment size"; int value = Pipe.takeInt(pipe); Pipe.confirmLowLevelRead(pipe, 3); Pipe.releaseReadLock(pipe); return value; }
public static <S extends MessageSchema<S>> long readL(Pipe<S> pipe) { int msgIdx = Pipe.takeMsgIdx(pipe); assert(3==Pipe.from(pipe).fragDataSize[msgIdx]) : "This constant does not this fragment size"; long value = Pipe.takeLong(pipe); Pipe.confirmLowLevelRead(pipe, 3); Pipe.releaseReadLock(pipe); return value; }
public static <S extends MessageSchema<S>> long readL(Pipe<S> pipe) { int msgIdx = Pipe.takeMsgIdx(pipe); assert(3==Pipe.from(pipe).fragDataSize[msgIdx]) : "This constant does not this fragment size"; long value = Pipe.takeLong(pipe); Pipe.confirmLowLevelRead(pipe, 3); Pipe.releaseReadLock(pipe); return value; }
private int sendNewContent(byte[] targetData, int targetOffset, int targetLength) { int msgId = Pipe.takeMsgIdx(pipe); if (msgId>=0) { //exit EOF logic int meta = Pipe.takeByteArrayMetaData((Pipe<?>) pipe);//side effect, this moves the pointer and must happen before we call for length int sourceLength = Pipe.takeByteArrayLength((Pipe<?>) pipe); return beginNewContent(targetData, targetOffset, targetLength, meta, sourceLength); } else { // Pipe.confirmLowLevelRead(ring, recordSize);//wrong size? Pipe.releaseReadLock(pipe); //TOOD: bad idea needs more elegant solution. // closed = true; return -1; } }
public static void appendNextFieldToReader(LittleEndianDataInputBlobReader reader, Pipe<RawDataSchema> targetPipe) { while (Pipe.hasContentToRead(targetPipe) && Pipe.peekInt(targetPipe) >=0) { Pipe.takeMsgIdx(targetPipe); accumLowLevelAPIField(reader); Pipe.readNextWithoutReleasingReadLock(targetPipe); Pipe.confirmLowLevelRead(targetPipe, Pipe.sizeOf(targetPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); } }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }
private void extractBytes() { Pipe.takeMsgIdx(pipe); int meta = Pipe.takeByteArrayMetaData(pipe); length = Pipe.takeByteArrayLength(pipe); backing = Pipe.byteBackingArray(meta, pipe); mask = Pipe.blobMask(pipe); position = Pipe.bytePosition(meta, pipe, length); Pipe.confirmLowLevelWrite(pipe); Pipe.publishWrites(pipe); }
public static long blobQuery(TrieParserReader reader, TrieParser trie) { Pipe.outputStream(reader.workingPipe).closeLowLevelField(); Pipe.publishWrites(reader.workingPipe); Pipe.confirmLowLevelWrite(reader.workingPipe, Pipe.sizeOf(reader.workingPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); /// Pipe.takeMsgIdx(reader.workingPipe); long result = TrieParserReader.query(reader,trie,reader.workingPipe,-1); Pipe.confirmLowLevelRead(reader.workingPipe, Pipe.sizeOf(reader.workingPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); Pipe.releaseReadLock(reader.workingPipe); return result; }
public static long blobQuery(TrieParserReader reader, TrieParser trie) { Pipe.outputStream(reader.workingPipe).closeLowLevelField(); Pipe.publishWrites(reader.workingPipe); Pipe.confirmLowLevelWrite(reader.workingPipe, Pipe.sizeOf(reader.workingPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); /// Pipe.takeMsgIdx(reader.workingPipe); long result = TrieParserReader.query(reader,trie,reader.workingPipe,-1); Pipe.confirmLowLevelRead(reader.workingPipe, Pipe.sizeOf(reader.workingPipe, RawDataSchema.MSG_CHUNKEDSTREAM_1)); Pipe.releaseReadLock(reader.workingPipe); return result; }