@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)); } }
mergeCompleteFile(other.getCompleteFile()); if (other.hasDeleteBlock()) { mergeDeleteBlock(other.getDeleteBlock());
|| entry.hasDeleteBlock() || entry.hasBlockInfo()) { return Constants.BLOCK_MASTER_NAME;
mergeCreateStore(other.getCreateStore()); if (other.hasDeleteBlock()) { mergeDeleteBlock(other.getDeleteBlock());
|| entry.hasDeleteBlock() || entry.hasBlockInfo()) { return Constants.BLOCK_MASTER_NAME;
@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)); } }
.equals(other.getCompleteFile()); result = result && (hasDeleteBlock() == other.hasDeleteBlock()); if (hasDeleteBlock()) { result = result && getDeleteBlock() .equals(other.getDeleteBlock());
hash = (53 * hash) + getCompleteFile().hashCode(); if (hasDeleteBlock()) { hash = (37 * hash) + DELETE_BLOCK_FIELD_NUMBER; hash = (53 * hash) + getDeleteBlock().hashCode();