Class NullLedgerOffloader
- java.lang.Object
-
- org.apache.bookkeeper.mledger.impl.NullLedgerOffloader
-
- All Implemented Interfaces:
LedgerOffloader
public class NullLedgerOffloader extends java.lang.Object implements LedgerOffloader
Null implementation that throws an error on any invokation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.mledger.LedgerOffloader
LedgerOffloader.OffloadHandle, LedgerOffloader.OffloadResult
-
-
Field Summary
Fields Modifier and Type Field Description static NullLedgerOffloaderINSTANCE-
Fields inherited from interface org.apache.bookkeeper.mledger.LedgerOffloader
METADATA_SOFTWARE_GITSHA_KEY, METADATA_SOFTWARE_VERSION_KEY
-
-
Constructor Summary
Constructors Constructor Description NullLedgerOffloader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the resources if necessaryjava.util.concurrent.CompletableFuture<java.lang.Void>deleteOffloaded(long ledgerId, java.util.UUID uid, java.util.Map<java.lang.String,java.lang.String> offloadDriverMetadata)Delete a ledger from long term storage.java.lang.StringgetOffloadDriverName()Get offload driver name.org.apache.pulsar.common.policies.data.OffloadPoliciesImplgetOffloadPolicies()Get offload policies of this LedgerOffloaderjava.util.concurrent.CompletableFuture<java.lang.Void>offload(org.apache.bookkeeper.client.api.ReadHandle ledger, java.util.UUID uid, java.util.Map<java.lang.String,java.lang.String> extraMetadata)Offload the passed in ledger to longterm storage.java.util.concurrent.CompletableFuture<org.apache.bookkeeper.client.api.ReadHandle>readOffloaded(long ledgerId, java.util.UUID uid, java.util.Map<java.lang.String,java.lang.String> offloadDriverMetadata)Create a ReadHandle which can be used to read a ledger back from longterm storage.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.mledger.LedgerOffloader
deleteOffloaded, getOffloadDriverMetadata, readOffloaded, streamingOffload
-
-
-
-
Field Detail
-
INSTANCE
public static NullLedgerOffloader INSTANCE
-
-
Method Detail
-
getOffloadDriverName
public java.lang.String getOffloadDriverName()
Description copied from interface:LedgerOffloaderGet offload driver name.- Specified by:
getOffloadDriverNamein interfaceLedgerOffloader- Returns:
- offload driver name.
-
offload
public java.util.concurrent.CompletableFuture<java.lang.Void> offload(org.apache.bookkeeper.client.api.ReadHandle ledger, java.util.UUID uid, java.util.Map<java.lang.String,java.lang.String> extraMetadata)Description copied from interface:LedgerOffloaderOffload the passed in ledger to longterm storage. Metadata passed in is for inspection purposes only and should be stored alongside the ledger data. When the returned future completes, the ledger has been persisted to the longterm storage, so it is safe to delete the original copy in bookkeeper. The uid is used to identify an attempt to offload. The implementation should use this to deterministically generate a unique name for the offloaded object. This uid will be stored in the managed ledger metadata before attempting the call to offload(). If a subsequent or concurrent call to offload() finds a uid in the metadata, it will attempt to cleanup this attempt with a call to #deleteOffloaded(ReadHandle,UUID). Once the offload attempt completes, the managed ledger will update its metadata again, to record the completion, ensuring that subsequent calls will not attempt to offload the same ledger again.- Specified by:
offloadin interfaceLedgerOffloader- Parameters:
ledger- the ledger to offloaduid- unique id to identity this offload attemptextraMetadata- metadata to be stored with the offloaded ledger for informational purposes- Returns:
- a future, which when completed, denotes that the offload has been successful.
-
readOffloaded
public java.util.concurrent.CompletableFuture<org.apache.bookkeeper.client.api.ReadHandle> readOffloaded(long ledgerId, java.util.UUID uid, java.util.Map<java.lang.String,java.lang.String> offloadDriverMetadata)Description copied from interface:LedgerOffloaderCreate a ReadHandle which can be used to read a ledger back from longterm storage. The passed uid, will be match the uid of a previous successful call to #offload(ReadHandle,UUID,Map).- Specified by:
readOffloadedin interfaceLedgerOffloader- Parameters:
ledgerId- the ID of the ledger to load from longterm storageuid- unique ID for previous successful offload attemptoffloadDriverMetadata- offload driver metadata- Returns:
- a future, which when completed, returns a ReadHandle
-
deleteOffloaded
public java.util.concurrent.CompletableFuture<java.lang.Void> deleteOffloaded(long ledgerId, java.util.UUID uid, java.util.Map<java.lang.String,java.lang.String> offloadDriverMetadata)Description copied from interface:LedgerOffloaderDelete a ledger from long term storage. The passed uid, will be match the uid of a previous call to #offload(ReadHandle,UUID,Map), which may or may not have been successful.- Specified by:
deleteOffloadedin interfaceLedgerOffloader- Parameters:
ledgerId- the ID of the ledger to delete from longterm storageuid- unique ID for previous offload attemptoffloadDriverMetadata- offload driver metadata- Returns:
- a future, which when completed, signifies that the ledger has been deleted
-
getOffloadPolicies
public org.apache.pulsar.common.policies.data.OffloadPoliciesImpl getOffloadPolicies()
Description copied from interface:LedgerOffloaderGet offload policies of this LedgerOffloader- Specified by:
getOffloadPoliciesin interfaceLedgerOffloader- Returns:
- offload policies
-
close
public void close()
Description copied from interface:LedgerOffloaderClose the resources if necessary- Specified by:
closein interfaceLedgerOffloader
-
-