@Override public synchronized void setLength(long length) throws IOException { if (fileInfo == null) { fileInfo = new FileInfo(createFile(name)); } try { setLength(fileInfo.open(), length, true); } finally { fileInfo.close(); } }
@Override public ByteBuffer allocateBlock(int blockNum) { int dataBlock = getOrUpdateDataBlockIndex(blockNum, EMPTY_ADDRESS, Mode.ALLOCATE); return blockByteBufferCopy.getByteBuffer(dataBlock); } }
boolean lowBlocks(boolean critical) { int bitsSet = blocksInuse.getBitsSet(); return bitsSet > 0 && (blocks - bitsSet < (critical?criticalCleaningThreshold:cleaningThreshold)) && memoryBufferEntries.firstEntry(false) != null; }
@Test(expected=IOException.class) public void testInvalidRead() throws Exception { MemoryStorageManager msm = new MemoryStorageManager(); EncryptedStorageManager ssm = new EncryptedStorageManager(msm); ssm.initialize(); String tsID = "0"; //$NON-NLS-1$ EncryptedFileStore store = ssm.createFileStore(tsID); store.read(1, new byte[1], 0, 1); }
@Override protected ByteBuffer newBuffer() throws IOException { if (!allocate) { return blockManager.getBlock(++blockNum); } if (blockNum > maxBlocks) { throw exceededMax; } return blockManager.allocateBlock(++blockNum); }
public BlockByteBuffer duplicate() { BlockByteBuffer dup = new BlockByteBuffer(); dup.data = data; dup.buffers = new ByteBuffer[buffers.length]; return dup; }
InodeBlockManager(long gid, long oid, int inode) { this.inode = inode; this.gid = gid; this.oid = oid; this.blockSegment = blocksInuse.getNextSegment(); }
@Override public void unlockForLoad(PhysicalInfo info) { if (info == null) { return; } info.unlockForLoad(); }
@Override protected ByteBuffer nextBuffer() { if (maxBlock == blockIndex) { return null; } return manager.getBlock(blockIndex++); }
public long getDiskWriteCount() { if (fsc != null) { return fsc.getStorageWrites(); } return 0; }
@Override public synchronized void setLength(long length) throws IOException { if (fileInfo == null) { fileInfo = new FileInfo(createFile(name)); } try { setLength(fileInfo.open(), length, true); } finally { fileInfo.close(); } }
@Override public ByteBuffer getBlock(int index) { int dataBlock = getOrUpdateDataBlockIndex(index, EMPTY_ADDRESS, Mode.GET); return blockByteBufferCopy.getByteBuffer(dataBlock); }
boolean lowBlocks(boolean critical) { int bitsSet = blocksInuse.getBitsSet(); return bitsSet > 0 && (blocks - bitsSet < (critical?criticalCleaningThreshold:cleaningThreshold)) && memoryBufferEntries.firstEntry(false) != null; }
@Override public synchronized void setLength(long length) throws IOException { if (fileInfo == null) { fileInfo = new FileInfo(createFile(name)); } try { setLength(fileInfo.open(), length, true); } finally { fileInfo.close(); } }
@Override public ByteBuffer getBlock(int index) { int dataBlock = getOrUpdateDataBlockIndex(index, EMPTY_ADDRESS, Mode.GET); return blockByteBufferCopy.getByteBuffer(dataBlock); }
boolean lowBlocks(boolean critical) { int bitsSet = blocksInuse.getBitsSet(); return bitsSet > 0 && (blocks - bitsSet < (critical?criticalCleaningThreshold:cleaningThreshold)) && memoryBufferEntries.firstEntry(false) != null; }
@Override public ByteBuffer allocateBlock(int blockNum) { int dataBlock = getOrUpdateDataBlockIndex(blockNum, EMPTY_ADDRESS, Mode.ALLOCATE); return blockByteBufferCopy.getByteBuffer(dataBlock); } }
@Override public ByteBuffer getBlock(int index) { int dataBlock = getOrUpdateDataBlockIndex(index, EMPTY_ADDRESS, Mode.GET); return blockByteBufferCopy.getByteBuffer(dataBlock); }
@Override public ByteBuffer allocateBlock(int blockNum) { int dataBlock = getOrUpdateDataBlockIndex(blockNum, EMPTY_ADDRESS, Mode.ALLOCATE); return blockByteBufferCopy.getByteBuffer(dataBlock); } }