@Override public void setBlockSize(int x) { validateBlockSize(x); this.blockSize = x; }
@Override public InputStream getInputStream(String blobId) throws IOException { //Marking would handled by next call to store.readBlob return new BlobStoreInputStream(this, blobId, 0); }
@Override public void setUp() throws Exception { store = new MemoryBlobStore(); store.setBlockSize(128); ((MemoryBlobStore) store).setBlockSizeMin(48); }
public static void main(String... args) throws Exception { FileBlobStore store = new FileBlobStore("target/temp"); String id = addFiles(store, "~/temp/ds"); extractFiles(store, id, "target/test"); }
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { long numDeleted = delegate.countDeleteChunks(chunkIds, maxLastModifiedTime); numChunks -= numDeleted; return numDeleted; }
@Override public String writeBlob(InputStream in) throws IOException { writeCount++; return super.writeBlob(in); } }
@Override public String getReferenceFromIdentifier(DataIdentifier identifier) { return super.getReferenceFromIdentifier(identifier); } }
/** * Returns the reference key of this data store. Synchronized to * control concurrent access to the cached {@link #referenceKey} value. * * @return reference key */ private synchronized byte[] getReferenceKey() { if (referenceKey == null) { referenceKey = getOrCreateReferenceKey(); } return referenceKey; }
@Override public int read() throws IOException { if (oneByteBuff == null) { oneByteBuff = new byte[1]; } int len = read(oneByteBuff, 0, 1); if (len < 0) { return len; } return oneByteBuff[0] & 0xff; }
/**------------------------ SharedDataStore methods -----------------------------------------**/ @Override public void addMetadataRecord(InputStream stream, String name) throws DataStoreException { backend.addMetadataRecord(stream, name); }
protected void setupCollector(BlobStatsCollector statsCollector) { if (store instanceof AbstractBlobStore){ ((AbstractBlobStore) store).setStatsCollector(statsCollector); } }
@Override public InputStream getInputStream(String blobId) throws IOException { //Marking would handled by next call to store.readBlob return new BlobStoreInputStream(this, blobId, 0); }
/** * Returns the reference key of this data store. Synchronized to * control concurrent access to the cached {@link #referenceKey} value. * * @return reference key */ private synchronized byte[] getReferenceKey() { if (referenceKey == null) { referenceKey = getOrCreateReferenceKey(); } return referenceKey; }
@Override public int read() throws IOException { if (oneByteBuff == null) { oneByteBuff = new byte[1]; } int len = read(oneByteBuff, 0, 1); if (len < 0) { return len; } return oneByteBuff[0] & 0xff; }
@Override public InputStream getInputStream(String blobId) throws IOException { //Marking would handled by next call to store.readBlob return new BlobStoreInputStream(this, blobId, 0); }
/** * Returns the reference key of this data store. Synchronized to * control concurrent access to the cached {@link #referenceKey} value. * * @return reference key */ private synchronized byte[] getReferenceKey() { if (referenceKey == null) { referenceKey = getOrCreateReferenceKey(); } return referenceKey; }
@Override public int read() throws IOException { if (oneByteBuff == null) { oneByteBuff = new byte[1]; } int len = read(oneByteBuff, 0, 1); if (len < 0) { return len; } return oneByteBuff[0] & 0xff; }