output.writeMessage(4, getBlockInfo());
.computeMessageSize(4, getBlockInfo());
@Override public void processJournalEntry(JournalEntry entry) throws IOException { // TODO(gene): A better way to process entries besides a huge switch? if (entry.hasBlockContainerIdGenerator()) { mJournaledNextContainerId = (entry.getBlockContainerIdGenerator()).getNextContainerId(); mBlockContainerIdGenerator.setNextContainerId((mJournaledNextContainerId)); } else if (entry.hasDeleteBlock()) { mBlockStore.removeBlock(entry.getDeleteBlock().getBlockId()); } else if (entry.hasBlockInfo()) { BlockInfoEntry blockInfoEntry = entry.getBlockInfo(); long length = blockInfoEntry.getLength(); Optional<BlockMeta> block = mBlockStore.getBlock(blockInfoEntry.getBlockId()); if (block.isPresent()) { long oldLen = block.get().getLength(); if (oldLen != Constants.UNKNOWN_SIZE) { LOG.warn("Attempting to update block length ({}) to a different length ({}).", oldLen, length); return; } } mBlockStore.putBlock(blockInfoEntry.getBlockId(), BlockMeta.newBuilder().setLength(blockInfoEntry.getLength()).build()); } else { throw new IOException(ExceptionMessage.UNEXPECTED_JOURNAL_ENTRY.getMessage(entry)); } }
mergeBlockInfo(other.getBlockInfo());
@Override public void processJournalEntry(JournalEntry entry) throws IOException { // TODO(gene): A better way to process entries besides a huge switch? if (entry.hasBlockContainerIdGenerator()) { mJournaledNextContainerId = (entry.getBlockContainerIdGenerator()).getNextContainerId(); mBlockContainerIdGenerator.setNextContainerId((mJournaledNextContainerId)); } else if (entry.hasDeleteBlock()) { mBlocks.remove(entry.getDeleteBlock().getBlockId()); } else if (entry.hasBlockInfo()) { BlockInfoEntry blockInfoEntry = entry.getBlockInfo(); if (mBlocks.containsKey(blockInfoEntry.getBlockId())) { // Update the existing block info. MasterBlockInfo blockInfo = mBlocks.get(blockInfoEntry.getBlockId()); blockInfo.updateLength(blockInfoEntry.getLength()); } else { mBlocks.put(blockInfoEntry.getBlockId(), new MasterBlockInfo(blockInfoEntry.getBlockId(), blockInfoEntry.getLength())); } } else { throw new IOException(ExceptionMessage.UNEXPECTED_JOURNAL_ENTRY.getMessage(entry)); } }
result = result && getBlockInfo() .equals(other.getBlockInfo());
hash = (53 * hash) + getBlockInfo().hashCode();
mergeBlockInfo(other.getBlockInfo());