Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.storemate.store.backend;
  
  
Abstraction used by com.fasterxml.storemate.store.StorableStore for interacting with the underlying physical database.
 
 public abstract class StoreBackend
 {
     protected final StorableConverter _storableConverter;
 
     /*
     /**********************************************************************
     /* Life-cycle
     /**********************************************************************
      */
 
     protected StoreBackend(StorableConverter storableConverter)
     {
          = storableConverter;
     }
 
     public abstract void start();
     public abstract void stop();
 
     /*
     /**********************************************************************
     /* API, accessors
     /**********************************************************************
      */
 
     public final StorableConverter getStorableConverter() {
         return ;
     }
     
     /*
     /**********************************************************************
     /* API, metadata access
     /**********************************************************************
      */
    
    
Accessor for getting approximate count of entries in the underlying main BDB database
 
     public abstract long getEntryCount();

    
Accessor for getting approximate count of entries accessible via last-modifed index.
 
     public abstract long getIndexedCount();
 
     /*
     /**********************************************************************
     /* API Impl, read
     /**********************************************************************
      */
 
     public abstract boolean hasEntry(StorableKey key);
 
     public abstract Storable findEntry(StorableKey keythrows StoreException;
 
     /*
     /**********************************************************************
     /* API Impl, iteration
     /**********************************************************************
      */

    
Method for scanning potentially all the entries in the store, in the fastest iteration order (usually derived from physical storage ordering).

Note that iteration is not transactional, in that operations may modify entries during iteration process.

Returns:
True if iteration completed succesfully; false if it was terminated
 
     public abstract IterationResult scanEntries(StorableIterationCallback cb)
         throws StoreException;

    
Method for scanning potentially all the entries in the store, ordered by the primary key.

Note that iteration is not transactional, in that operations may modify entries during iteration process.

Parameters:
cb Callback used for actual iteration
Returns:
True if iteration completed successfully; false if it was terminated
        throws StoreException
    {
        return iterateEntriesByKey(cbnull);
    }
    
    
Method for scanning potentially all the entries in the store, ordered by the primary key.

Note that iteration is not transactional, in that operations may modify entries during iteration process.

Parameters:
cb Callback used for actual iteration
firstKey (optional) If not null, key for the first entry to include (inclusive); if null, starts from the very first entry
Returns:
True if iteration completed successfully; false if it was terminated
            StorableKey firstKey)
        throws StoreException;

    
Method for scanning potentially all the entries in the store, ordered by the primary key, starting with entry after specified key

Since:
0.8.8
            StorableKey lastSeen)
        throws StoreException;
    
        throws StoreException
    {
        return iterateEntriesByModifiedTime(cb, 0L);
    }
    
    
Method for scanning potentially all the entries in the store, ordered by the last-modified order (from oldest to newest)

Note that iteration is not transactional, in that operations may modify entries during iteration process.

Parameters:
cb Callback used for actual iteration
firstTimestamp (optional) Key for the first entry to include (inclusive); if null, starts from the very first entry
Returns:
True if iteration completed successfully; false if it was terminated
            long firstTimestamp)
        throws StoreException;
    
    /*
    /**********************************************************************
    /* API Impl, insert/update
    /**********************************************************************
     */
    
    
Method that tries to create specified entry in the database, if (and only if!) no entry exists for given key. If an entry exists, it will be returned and no changes are made.

Returns:
Null if creation succeeded; or existing entry if not
    public abstract Storable createEntry(StorableKey keyStorable storable)
        throws IOExceptionStoreException;

    
Method that inserts given entry in the database, possibly replacing an existing version; also returns the old entry.

Returns:
Existing entry, if any
    public abstract Storable putEntry(StorableKey keyStorable storable)
        throws IOExceptionStoreException;

    
Method that forcibly inserts or ovewrites entry for given key, without trying to read possibly existing version. Should only be used when modifications are made from an atomic operation (to avoid race conditions).
    public abstract void ovewriteEntry(StorableKey keyStorable storable)
        throws IOExceptionStoreException;

    
Method that may insert (if no entry with given key exists) or try to overwrite an entry with given key; but overwrite only happens if given 'checker' object allows overwrite. It should only be called if overwrite is truly conditional; otherwise other methods (like putEntry(com.fasterxml.storemate.shared.StorableKey,com.fasterxml.storemate.store.Storable)} or ovewriteEntry(com.fasterxml.storemate.shared.StorableKey,com.fasterxml.storemate.store.Storable)) are more efficient.

Parameters:
oldEntryRef If not null, existing entry will be returned via this object
Returns:
True if entry was created or updated; false if not (an old entry exists, and checker did not allow overwrite)
Since:
0.9.3
    public abstract boolean upsertEntry(StorableKey keyStorable storable,
            OverwriteChecker checkerAtomicReference<StorableoldEntryRef)
        throws IOExceptionStoreException;
    
    /*
    /**********************************************************************
    /* API Impl, delete
    /**********************************************************************
     */

    
Method called to physically delete entry for given key, if one exists.

Returns:
False if deletion was not done because no such entry was found; true if deletion succeeeded
Throws:
com.fasterxml.storemate.store.StoreException If deletion failed to due to backend-specific problem
java.io.IOException If deletion failed due to underlying I/O problem, exposed by store (not all stores expose them)
    public abstract boolean deleteEntry(StorableKey key)
        throws IOExceptionStoreException;
New to GrepCode? Check out our FAQ X