org.apache.jackrabbit.mk.blobs
Class FileBlobStore

java.lang.Object
  extended by org.apache.jackrabbit.mk.blobs.AbstractBlobStore
      extended by org.apache.jackrabbit.mk.blobs.FileBlobStore
All Implemented Interfaces:
BlobStore, Cache.Backend<AbstractBlobStore.BlockId,AbstractBlobStore.Data>

public class FileBlobStore
extends AbstractBlobStore

A file blob store.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.jackrabbit.mk.blobs.AbstractBlobStore
AbstractBlobStore.BlockId, AbstractBlobStore.Data
 
Field Summary
 
Fields inherited from class org.apache.jackrabbit.mk.blobs.AbstractBlobStore
BLOCK_SIZE_LIMIT, HASH_ALGORITHM, inUse, TYPE_DATA, TYPE_HASH, TYPE_HASH_COMPRESSED
 
Constructor Summary
FileBlobStore(String dir)
           
 
Method Summary
protected  boolean isMarkEnabled()
           
protected  void mark(AbstractBlobStore.BlockId id)
           
protected  byte[] readBlockFromBackend(AbstractBlobStore.BlockId id)
          Load the block from the storage backend.
 void startMark()
           
protected  void storeBlock(byte[] digest, int level, byte[] data)
           
 int sweep()
           
 String writeBlob(String tempFilePath)
          Write a blob from a temporary file.
 
Methods inherited from class org.apache.jackrabbit.mk.blobs.AbstractBlobStore
clearCache, clearInUse, getBlobLength, getBlockSize, getBlockSizeMin, load, mark, markInUse, readBlob, setBlockSize, setBlockSizeMin, usesBlobId, writeBlob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileBlobStore

public FileBlobStore(String dir)
              throws IOException
Throws:
IOException
Method Detail

writeBlob

public String writeBlob(String tempFilePath)
                 throws Exception
Description copied from class: AbstractBlobStore
Write a blob from a temporary file. The temporary file is removed afterwards. A file based blob stores might simply rename the file, so that no additional writes are necessary.

Overrides:
writeBlob in class AbstractBlobStore
Parameters:
tempFilePath - the temporary file
Returns:
the blob id
Throws:
Exception

storeBlock

protected void storeBlock(byte[] digest,
                          int level,
                          byte[] data)
                   throws IOException
Specified by:
storeBlock in class AbstractBlobStore
Throws:
IOException

readBlockFromBackend

protected byte[] readBlockFromBackend(AbstractBlobStore.BlockId id)
                               throws IOException
Description copied from class: AbstractBlobStore
Load the block from the storage backend. Returns null if the block was not found.

Specified by:
readBlockFromBackend in class AbstractBlobStore
Parameters:
id - the block id
Returns:
the block data, or null
Throws:
IOException

startMark

public void startMark()
               throws Exception
Specified by:
startMark in class AbstractBlobStore
Throws:
Exception

isMarkEnabled

protected boolean isMarkEnabled()
Specified by:
isMarkEnabled in class AbstractBlobStore

mark

protected void mark(AbstractBlobStore.BlockId id)
             throws IOException
Specified by:
mark in class AbstractBlobStore
Throws:
IOException

sweep

public int sweep()
          throws IOException
Specified by:
sweep in class AbstractBlobStore
Throws:
IOException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.