public class ObjectStoreUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ObjectStoreUtils.DeletionRecord |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BATCH_SIZE_TO_SUBMIT |
Constructor and Description |
---|
ObjectStoreUtils() |
Modifier and Type | Method and Description |
---|---|
static Set<String> |
backupObjectListNames(ObjectStoreUtilsContext ctx,
String clusterId)
Gets the names of all the backup object lists from the object store
|
static void |
deleteVersionedObjectsAsync(ObjectStoreUtilsContext ctx,
List<TierObjectStore.KeyAndVersion> keys,
ThreadPoolExecutor executor)
Delete versioned blobs asynchronously.
|
static void |
deleteVersions(ObjectStoreUtilsContext ctx,
List<TierObjectStore.KeyAndVersion> objectsToDelete,
ThreadPoolExecutor executor,
RetryPolicy retryPolicy)
Calls object store client to delete versioned objects and retries when a retryable exception is thrown
|
static ByteBuffer |
fetchRecoverSnapshot(ObjectStoreUtilsContext ctx,
TierPartitionForceRestore forceRestoreEvent,
RetryPolicy retryPolicy) |
static TierObjectStoreResponse |
getObject(ObjectStoreUtilsContext ctx,
TierObjectStore.ObjectStoreMetadata metadata,
TierObjectStore.FileType fileType,
RetryPolicy retryPolicy)
Calls the object storage client to get the specified object.
|
static boolean |
isEncryptionKeyStateInvalid(Exception e) |
static Map<String,List<VersionInformation>> |
listObject(ObjectStoreUtilsContext ctx,
String keyPrefix,
Boolean getVersionInfo,
RetryPolicy retryPolicy)
Calls object store client to list the blobs under a given key prefix.
|
static void |
putBuffer(ObjectStoreUtilsContext ctx,
TierObjectStore.ObjectStoreMetadata objectMetadata,
ByteBuffer buf,
TierObjectStore.FileType fileType,
RetryPolicy retryPolicy)
Calls the object store client to put a buffer to the object store bucket.
|
static Map<String,List<VersionInformation>> |
verifyObjectNotLive(ObjectStoreUtilsContext ctx,
TopicIdPartition topicIdPartition,
UUID objectId,
RetryPolicy retryPolicy)
Verifies that the blobs uploaded under a given segment UUID are not live at the object store.
|
public static final int DEFAULT_BATCH_SIZE_TO_SUBMIT
public static Map<String,List<VersionInformation>> verifyObjectNotLive(ObjectStoreUtilsContext ctx, TopicIdPartition topicIdPartition, UUID objectId, RetryPolicy retryPolicy) throws InterruptedException
ctx
- object store utils contexttopicIdPartition
- TopicIdPartition to which the blob belongedobjectId
- UUID for the segment in concernretryPolicy
- specifies retry configurations to be used, if retry is requiredInterruptedException
public static Set<String> backupObjectListNames(ObjectStoreUtilsContext ctx, String clusterId) throws InterruptedException
ctx
- object store utils contextclusterId
- id for the cluster, used to form the key path for object listsInterruptedException
public static Map<String,List<VersionInformation>> listObject(ObjectStoreUtilsContext ctx, String keyPrefix, Boolean getVersionInfo, RetryPolicy retryPolicy) throws InterruptedException
ctx
- object store utils contextkeyPrefix
- prefix for the key to be listedgetVersionInfo
- boolean to indicate if version information is to be fetched as wellretryPolicy
- specifies retry configurations to be used, if retry is requiredInterruptedException
public static void putBuffer(ObjectStoreUtilsContext ctx, TierObjectStore.ObjectStoreMetadata objectMetadata, ByteBuffer buf, TierObjectStore.FileType fileType, RetryPolicy retryPolicy) throws InterruptedException
ctx
- object store utils contextobjectMetadata
- object metadatabuf
- buffer to uploadfileType
- file typeretryPolicy
- specifies retry configurations to be used, if retry is requiredInterruptedException
public static boolean isEncryptionKeyStateInvalid(Exception e)
public static TierObjectStoreResponse getObject(ObjectStoreUtilsContext ctx, TierObjectStore.ObjectStoreMetadata metadata, TierObjectStore.FileType fileType, RetryPolicy retryPolicy) throws InterruptedException
ctx
- object store utils contextmetadata
- tier object store metadata for the object to fetchfileType
- filetype of the objectretryPolicy
- specifies retry configurations to be used, if retry is requiredInterruptedException
public static void deleteVersionedObjectsAsync(ObjectStoreUtilsContext ctx, List<TierObjectStore.KeyAndVersion> keys, ThreadPoolExecutor executor) throws TierObjectStoreBatchOperationException, InterruptedException
ctx
- context object to access object store clientkeys
- list of keys identifying blobs to be deletedexecutor
- thread pool used for async operationTierObjectStoreBatchOperationException
- containing a mapping for the blobs whose deletion attempt failed due to some
reason other than BlobNotFound errors. Real exception is wrapped in a TierObjectStoreRetriableException or a
TierObjectStoreFatalExceptionInterruptedException
public static void deleteVersions(ObjectStoreUtilsContext ctx, List<TierObjectStore.KeyAndVersion> objectsToDelete, ThreadPoolExecutor executor, RetryPolicy retryPolicy) throws InterruptedException
ctx
- object store utils contextobjectsToDelete
- list of objects to be deleted, identified by object key and version ids.retryPolicy
- specifies retry configurations to be used, if retry is requiredInterruptedException
public static ByteBuffer fetchRecoverSnapshot(ObjectStoreUtilsContext ctx, TierPartitionForceRestore forceRestoreEvent, RetryPolicy retryPolicy) throws InterruptedException
InterruptedException