private void checkTopic(TopicId topicId, int generation) { Preconditions.checkArgument(this.topicMetadata.getTopicId().equals(topicId), "Not allowed to use table with a " + "different topic id. Table's topic Id: {}. Specified topic id: {}", this.topicMetadata.getTopicId(), topicId); Preconditions.checkArgument(this.topicMetadata.getGeneration() == generation, "Not allowed to use table with " + "a different generation id. Table's generation: {}. Specified generation: {}", this.topicMetadata.getGeneration(), generation); }
private void checkTopic(TopicId topicId, int generation) { Preconditions.checkArgument(this.topicMetadata.getTopicId().equals(topicId), "Not allowed to use table with a " + "different topic id. Table's topic Id: {}. Specified topic id: {}", this.topicMetadata.getTopicId(), topicId); Preconditions.checkArgument(this.topicMetadata.getGeneration() == generation, "Not allowed to use table with " + "a different generation id. Table's generation: {}. Specified generation: {}", this.topicMetadata.getGeneration(), generation); }
@Override protected RawPayloadTableEntry computeNext() { if (!entries.hasNext()) { return endOfData(); } Entry entry = entries.next(); if (topicId == null || (!topicId.equals(entry.getTopicId())) || (generation != entry.getGeneration())) { topicId = entry.getTopicId(); generation = entry.getGeneration(); topic = MessagingUtils.toDataKeyPrefix(topicId, entry.getGeneration()); rowKey = new byte[topic.length + (2 * Bytes.SIZEOF_LONG) + Bytes.SIZEOF_SHORT]; } Bytes.putBytes(rowKey, 0, topic, 0, topic.length); Bytes.putLong(rowKey, topic.length, entry.getTransactionWritePointer()); Bytes.putLong(rowKey, topic.length + Bytes.SIZEOF_LONG, entry.getPayloadWriteTimestamp()); Bytes.putShort(rowKey, topic.length + (2 * Bytes.SIZEOF_LONG), entry.getPayloadSequenceId()); return tableEntry.set(rowKey, entry.getPayload()); } }
@Override protected RawPayloadTableEntry computeNext() { if (!entries.hasNext()) { return endOfData(); } Entry entry = entries.next(); if (topicId == null || (!topicId.equals(entry.getTopicId())) || (generation != entry.getGeneration())) { topicId = entry.getTopicId(); generation = entry.getGeneration(); topic = MessagingUtils.toDataKeyPrefix(topicId, entry.getGeneration()); rowKey = new byte[topic.length + (2 * Bytes.SIZEOF_LONG) + Bytes.SIZEOF_SHORT]; } Bytes.putBytes(rowKey, 0, topic, 0, topic.length); Bytes.putLong(rowKey, topic.length, entry.getTransactionWritePointer()); Bytes.putLong(rowKey, topic.length + Bytes.SIZEOF_LONG, entry.getPayloadWriteTimestamp()); Bytes.putShort(rowKey, topic.length + (2 * Bytes.SIZEOF_LONG), entry.getPayloadSequenceId()); return tableEntry.set(rowKey, entry.getPayload()); } }
@Override protected RawMessageTableEntry computeNext() { if (!entries.hasNext()) { return endOfData(); } Entry entry = entries.next(); // Create new byte arrays only when the topicId is different. Else, reuse the byte arrays. if (topicId == null || (!topicId.equals(entry.getTopicId())) || (generation != entry.getGeneration())) { topicId = entry.getTopicId(); generation = entry.getGeneration(); topic = MessagingUtils.toDataKeyPrefix(topicId, entry.getGeneration()); rowKey = new byte[topic.length + Bytes.SIZEOF_LONG + Bytes.SIZEOF_SHORT]; } Bytes.putBytes(rowKey, 0, topic, 0, topic.length); Bytes.putLong(rowKey, topic.length, entry.getPublishTimestamp()); Bytes.putShort(rowKey, topic.length + Bytes.SIZEOF_LONG, entry.getSequenceId()); byte[] txPtr = null; if (entry.isTransactional()) { txPtr = Bytes.toBytes(entry.getTransactionWritePointer()); } return tableEntry.set(rowKey, txPtr, entry.getPayload()); } }
@Override protected RawMessageTableEntry computeNext() { if (!entries.hasNext()) { return endOfData(); } Entry entry = entries.next(); // Create new byte arrays only when the topicId is different. Else, reuse the byte arrays. if (topicId == null || (!topicId.equals(entry.getTopicId())) || (generation != entry.getGeneration())) { topicId = entry.getTopicId(); generation = entry.getGeneration(); topic = MessagingUtils.toDataKeyPrefix(topicId, entry.getGeneration()); rowKey = new byte[topic.length + Bytes.SIZEOF_LONG + Bytes.SIZEOF_SHORT]; } Bytes.putBytes(rowKey, 0, topic, 0, topic.length); Bytes.putLong(rowKey, topic.length, entry.getPublishTimestamp()); Bytes.putShort(rowKey, topic.length + Bytes.SIZEOF_LONG, entry.getSequenceId()); byte[] txPtr = null; if (entry.isTransactional()) { txPtr = Bytes.toBytes(entry.getTransactionWritePointer()); } return tableEntry.set(rowKey, txPtr, entry.getPayload()); } }