Commit a6cbe589 authored by chiaming2000's avatar chiaming2000
Browse files

Implemented flush operation for leveldb store.

parent 670fca91
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package kinetic.client;

import java.util.List;

import kinetic.client.advanced.PersistOption;

/**
 * Kinetic Client Application Interface.
 * <p>
@@ -68,14 +70,16 @@ public interface KineticClient extends GenericKineticClient {

    /**
     * The flush operation flushes any outstanding PUTs or DELETEs on the
     * device.
     * device/simulator.
     * <p>
     * Currently only Kinetic drive supports this operation. This command has no
     * effect on the simulator.
     * If the call returns successfully, all PUT/DELETE operations with
     * SYNC/ASYNC PersistOption received by the service prior to this are
     * flushed to the store.
     * 
     * @throws KineticException
     *             if any internal error occurred.
     * 
     * @see PersistOption
     */
    public void flush() throws KineticException;

+0 −2
Original line number Diff line number Diff line
@@ -124,8 +124,6 @@ public class BatchOperationHandler {

    private synchronized void waitForBatchToFinish() {



        long timeout = 0;
        long period = 3000;

+6 −1
Original line number Diff line number Diff line
@@ -27,7 +27,12 @@ public class FlushOpHandler extends CommandHandlerBase implements
    @Override
    public void processRequest(KineticMessage request, KineticMessage response)
            throws ServiceException {
        ;

        try {
            super.engine.getStore().flush();
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

}
+9 −1
Original line number Diff line number Diff line
@@ -239,4 +239,12 @@ public interface Store<K, O, V> {
     * @return a new instance of batch operation object.
     */
    public BatchOperation<K, V> createBatchOperation() throws KVStoreException;

    /**
     * Flush data to store.
     * 
     * @throws KVStoreException
     *             if any internal error occurred.
     */
    public void flush() throws KVStoreException;
}
+5 −0
Original line number Diff line number Diff line
@@ -151,4 +151,9 @@ public class BdbStore implements Store<ByteString, ByteString, KVValue> {
        throw new java.lang.UnsupportedOperationException();
    }

    @Override
    public void flush() throws KVStoreException {
        logger.warning("flush is not implemented for bdb");
    }

}
Loading