- java.lang.Object
-
- com.github.akurilov.commons.concurrent.AsyncRunnableBase
-
- com.emc.mongoose.base.concurrent.DaemonBase
-
- com.emc.mongoose.base.storage.driver.StorageDriverBase<I,O>
-
- All Implemented Interfaces:
Daemon,StorageDriver<I,O>,com.github.akurilov.commons.concurrent.AsyncRunnable,com.github.akurilov.commons.io.Output<O>,java.lang.AutoCloseable,java.rmi.Remote,java.util.function.Consumer<O>
public abstract class StorageDriverBase<I extends Item,O extends Operation<I>> extends DaemonBase implements StorageDriver<I,O>
Created by kurila on 11.07.16.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentMap<Credential,java.lang.String>authTokensprotected intconcurrencyLimitprotected Credentialcredentialprotected intioWorkerCountprotected java.lang.Stringnamespaceprotected java.util.concurrent.ConcurrentMap<java.lang.String,Credential>pathToCredMapprotected java.util.function.Function<Credential,java.lang.String>requestAuthTokenFuncprotected java.util.function.Function<java.lang.String,java.lang.String>requestNewPathFuncprotected java.lang.StringstepIdprotected booleanverifyFlag-
Fields inherited from interface com.emc.mongoose.base.storage.driver.StorageDriver
BUFF_SIZE_MAX, BUFF_SIZE_MIN
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStorageDriverBase(java.lang.String stepId, DataInput itemDataInput, com.github.akurilov.confuse.Config storageConfig, boolean verifyFlag)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intconcurrencyLimit()protected voiddoClose()com.github.akurilov.commons.io.Input<O>getInput()protected booleanhandleCompleted(O op)voidoperationResultOutput(com.github.akurilov.commons.io.Output<O> opResultOut)protected booleanprepare(O op)protected abstract java.lang.StringrequestNewAuthToken(Credential credential)protected abstract java.lang.StringrequestNewPath(java.lang.String path)java.lang.StringtoString()-
Methods inherited from class com.emc.mongoose.base.concurrent.DaemonBase
close, closeAll
-
Methods inherited from class com.github.akurilov.commons.concurrent.AsyncRunnableBase
await, await, doShutdown, doStart, doStop, isClosed, isInitial, isShutdown, isStarted, isStopped, shutdown, start, state, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.akurilov.commons.concurrent.AsyncRunnable
await, await, isClosed, isInitial, isShutdown, isStarted, isStopped, shutdown, start, state
-
Methods inherited from interface com.emc.mongoose.base.storage.driver.StorageDriver
activeOpCount, adjustIoBuffers, close, completedOpCount, isIdle, list, put, put, put, scheduledOpCount, stop
-
-
-
-
Field Detail
-
stepId
protected final java.lang.String stepId
-
concurrencyLimit
protected final int concurrencyLimit
-
ioWorkerCount
protected final int ioWorkerCount
-
namespace
protected final java.lang.String namespace
-
credential
protected final Credential credential
-
verifyFlag
protected final boolean verifyFlag
-
pathToCredMap
protected final java.util.concurrent.ConcurrentMap<java.lang.String,Credential> pathToCredMap
-
requestNewPathFunc
protected java.util.function.Function<java.lang.String,java.lang.String> requestNewPathFunc
-
authTokens
protected final java.util.concurrent.ConcurrentMap<Credential,java.lang.String> authTokens
-
requestAuthTokenFunc
protected java.util.function.Function<Credential,java.lang.String> requestAuthTokenFunc
-
-
Constructor Detail
-
StorageDriverBase
protected StorageDriverBase(java.lang.String stepId, DataInput itemDataInput, com.github.akurilov.confuse.Config storageConfig, boolean verifyFlag) throws IllegalConfigurationException- Throws:
IllegalConfigurationException
-
-
Method Detail
-
operationResultOutput
public final void operationResultOutput(com.github.akurilov.commons.io.Output<O> opResultOut)
- Specified by:
operationResultOutputin interfaceStorageDriver<I extends Item,O extends Operation<I>>
-
requestNewPath
protected abstract java.lang.String requestNewPath(java.lang.String path)
-
requestNewAuthToken
protected abstract java.lang.String requestNewAuthToken(Credential credential)
-
prepare
protected boolean prepare(O op)
-
handleCompleted
protected boolean handleCompleted(O op)
-
concurrencyLimit
public final int concurrencyLimit()
- Specified by:
concurrencyLimitin interfaceStorageDriver<I extends Item,O extends Operation<I>>- Returns:
- 0 if the concurrency is not limited
-
getInput
public com.github.akurilov.commons.io.Input<O> getInput()
-
doClose
protected void doClose() throws java.io.IOException, java.lang.IllegalStateException- Overrides:
doClosein classcom.github.akurilov.commons.concurrent.AsyncRunnableBase- Throws:
java.io.IOExceptionjava.lang.IllegalStateException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-