Package org.apache.hadoop.ozone.om
Class KeyManagerImpl
java.lang.Object
org.apache.hadoop.ozone.om.KeyManagerImpl
- All Implemented Interfaces:
OzoneManagerFS,IOzoneAcl,KeyManager
Implementation of keyManager.
-
Constructor Summary
ConstructorsConstructorDescriptionKeyManagerImpl(OzoneManager om, ScmClient scmClient, org.apache.hadoop.hdds.conf.OzoneConfiguration conf, OMPerformanceMetrics metrics) KeyManagerImpl(OzoneManager om, ScmClient scmClient, org.apache.hadoop.ozone.om.OMMetadataManager metadataManager, org.apache.hadoop.hdds.conf.OzoneConfiguration conf, org.apache.hadoop.hdds.security.token.OzoneBlockTokenSecretManager secretManager, org.apache.hadoop.crypto.key.KeyProviderCryptoExtension kmsProvider, OMPerformanceMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckAccess(org.apache.hadoop.ozone.security.acl.OzoneObj ozObject, org.apache.hadoop.ozone.security.acl.RequestContext context) Check access for given ozoneObject.List<org.apache.hadoop.ozone.OzoneAcl> getAcl(org.apache.hadoop.ozone.security.acl.OzoneObj obj) Returns list of ACLs for given Ozone object.Returns the instance of CompactionService.org.apache.hadoop.hdds.utils.db.TableIterator<String, ? extends org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>> getDeletedDirEntries(String volume, String bucket) Returns an iterator for pending deleted directories for volume and bucket.List<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, List<org.apache.hadoop.ozone.om.helpers.OmKeyInfo>>> getDeletedKeyEntries(String volume, String bucket, String startKey, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo>, Boolean, IOException> filter, int size) Returns a list deleted entries from the deletedTable.Returns the instance of Deleting Service.Returns the instance of Directory Deleting Service.List<org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ExpiredMultipartUploadsBucket> getExpiredMultipartUploads(Duration expireThreshold, int maxParts) Returns the MPU infos of up tocountwhose age is greater than or equal toexpireThreshold.org.apache.hadoop.ozone.om.ExpiredOpenKeysgetExpiredOpenKeys(Duration expireThreshold, int count, org.apache.hadoop.ozone.om.helpers.BucketLayout bucketLayout, Duration leaseThreshold) Returns the names of up tocountopen keys whose age is greater than or equal toexpireThreshold.org.apache.hadoop.ozone.om.helpers.OzoneFileStatusgetFileStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args) OzoneFS api to get file status for an entry.org.apache.hadoop.ozone.om.helpers.OzoneFileStatusgetFileStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, String clientAddress) OzoneFS api to get file status for an entry.org.apache.hadoop.ozone.om.helpers.OmKeyInfogetKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, ResolvedBucket bucket, String clientAddress) Return info of an existing key to client side to access to data on datanodes.org.apache.hadoop.ozone.om.OMMetadataManagerReturns the metadataManager.org.apache.hadoop.hdds.utils.BackgroundServiceReturns the instance of Multipart Upload Cleanup Service.getObjectTagging(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, ResolvedBucket bucket) Look up an existing key from the OM table and retrieve the tags from the key info.org.apache.hadoop.hdds.utils.BackgroundServiceReturns the instance of Open Key Cleanup Service.getPendingDeletionKeys(String volume, String bucket, String startKey, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, Boolean, IOException> filter, int count) Retrieves the keys that are pending deletion in a specified bucket and volume.getPendingDeletionKeys(org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, Boolean, IOException> filter, int count) Retrieves pending deletion keys that match a given filter function.getPendingDeletionSubDirs(long volumeId, long bucketId, org.apache.hadoop.ozone.om.helpers.OmKeyInfo parentInfo, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, Boolean, IOException> filter, int remainingNum) Returns all sub directories under the given parent directory.getPendingDeletionSubFiles(long volumeId, long bucketId, org.apache.hadoop.ozone.om.helpers.OmKeyInfo parentInfo, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, Boolean, IOException> filter, int remainingNum) Returns all sub files under the given parent directory.org.apache.ratis.util.function.CheckedFunction<KeyManager, org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo, IOException> getPreviousSnapshotOzoneDirInfo(long volumeId, org.apache.hadoop.ozone.om.helpers.OmBucketInfo bucketInfo, org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo keyInfo) Returns the previous snapshot's ozone directorInfo corresponding for the object.org.apache.ratis.util.function.CheckedFunction<KeyManager, org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo, IOException> getPreviousSnapshotOzoneDirInfo(long volumeId, org.apache.hadoop.ozone.om.helpers.OmBucketInfo bucketInfo, org.apache.hadoop.ozone.om.helpers.OmKeyInfo keyInfo) Returns the previous snapshot's ozone directoryInfo corresponding for the object.org.apache.ratis.util.function.CheckedFunction<KeyManager, org.apache.hadoop.ozone.om.helpers.OmKeyInfo, IOException> getPreviousSnapshotOzoneKeyInfo(long volumeId, org.apache.hadoop.ozone.om.helpers.OmBucketInfo bucketInfo, org.apache.hadoop.ozone.om.helpers.OmKeyInfo keyInfo) Returns the previous snapshot's ozone keyInfo corresponding for the object.getRenamesKeyEntries(String volume, String bucket, String startKey, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, String>, Boolean, IOException> filter, int size) Returns a list rename entries from the snapshotRenamedTable.Get the SnapshotDefragService instance.Returns the instance of Snapshot Deleting service.Returns the instance of Snapshot SST Filtering service.booleanisBucketFSOptimized(String volName, String buckName) booleanbooleanorg.apache.hadoop.ozone.om.helpers.ListKeysResultReturns a list of keys represented byOmKeyInfoin the given bucket.org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListlistMultipartUploads(String volumeName, String bucketName, String prefix, String keyMarker, String uploadIdMarker, int maxUploads, boolean withPagination) org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListPartslistParts(String volumeName, String bucketName, String keyName, String uploadID, int partNumberMarker, int maxParts) Returns list of parts of a multipart upload key.List<org.apache.hadoop.ozone.om.helpers.OzoneFileStatus> listStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, boolean recursive, String startKey, long numEntries) List the status for a file or a directory and its contents.List<org.apache.hadoop.ozone.om.helpers.OzoneFileStatus> listStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, boolean recursive, String startKey, long numEntries, String clientAddress) List the status for a file or a directory and its contents.List<org.apache.hadoop.ozone.om.helpers.OzoneFileStatus> listStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, boolean recursive, String startKey, long numEntries, String clientAddress, boolean allowPartialPrefixes) List the status for a file or a directory and its contents.org.apache.hadoop.ozone.om.helpers.OmKeyInfolookupFile(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, String clientAddress) OzoneFS api to lookup for a file.org.apache.hadoop.ozone.om.helpers.OmKeyInfolookupKey(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, ResolvedBucket bucket, String clientAddress) Look up an existing key.voidrefresh(org.apache.hadoop.ozone.om.helpers.OmKeyInfo key) Refresh the key block location information by get latest info from SCM.protected voidrefreshPipeline(List<org.apache.hadoop.ozone.om.helpers.OmKeyInfo> keyList) Refresh pipeline info in OM by asking SCM.refreshPipeline(Set<Long> containerIDs) Refresh pipeline info in OM by asking SCM.protected voidrefreshPipelineFromCache(org.apache.hadoop.ozone.om.helpers.OmKeyInfo keyInfo, boolean forceRefresh) List<? extends org.apache.hadoop.hdds.protocol.DatanodeDetails> sortDatanodes(List<? extends org.apache.hadoop.hdds.protocol.DatanodeDetails> nodes, String clientMachine) voidstart(org.apache.hadoop.hdds.conf.OzoneConfiguration configuration) Start key manager.voidstartSnapshotDefragService(org.apache.hadoop.hdds.conf.OzoneConfiguration conf) Start the snapshot defrag service if interval is not set to disabled value.voidstartSnapshotSstFilteringService(org.apache.hadoop.hdds.conf.OzoneConfiguration conf) Start the snapshot SST filtering service if interval is not set to disabled value.voidstop()Stop key manager.voidStop the snapshot defrag service if it is running.voidStop the snapshot SST filtering service if it is running.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.ozone.om.KeyManager
getDeletedDirEntries, getDeletedDirEntries
-
Constructor Details
-
KeyManagerImpl
public KeyManagerImpl(OzoneManager om, ScmClient scmClient, org.apache.hadoop.hdds.conf.OzoneConfiguration conf, OMPerformanceMetrics metrics) -
KeyManagerImpl
public KeyManagerImpl(OzoneManager om, ScmClient scmClient, org.apache.hadoop.ozone.om.OMMetadataManager metadataManager, org.apache.hadoop.hdds.conf.OzoneConfiguration conf, org.apache.hadoop.hdds.security.token.OzoneBlockTokenSecretManager secretManager, org.apache.hadoop.crypto.key.KeyProviderCryptoExtension kmsProvider, OMPerformanceMetrics metrics)
-
-
Method Details
-
start
public void start(org.apache.hadoop.hdds.conf.OzoneConfiguration configuration) Description copied from interface:KeyManagerStart key manager.- Specified by:
startin interfaceKeyManager- Parameters:
configuration-
-
startSnapshotSstFilteringService
public void startSnapshotSstFilteringService(org.apache.hadoop.hdds.conf.OzoneConfiguration conf) Start the snapshot SST filtering service if interval is not set to disabled value.- Parameters:
conf-
-
stopSnapshotSstFilteringService
public void stopSnapshotSstFilteringService()Stop the snapshot SST filtering service if it is running. -
startSnapshotDefragService
public void startSnapshotDefragService(org.apache.hadoop.hdds.conf.OzoneConfiguration conf) Start the snapshot defrag service if interval is not set to disabled value.- Parameters:
conf-
-
stopSnapshotDefragService
public void stopSnapshotDefragService()Stop the snapshot defrag service if it is running. -
stop
public void stop()Description copied from interface:KeyManagerStop key manager.- Specified by:
stopin interfaceKeyManager
-
getSnapshotDefragService
Get the SnapshotDefragService instance.- Specified by:
getSnapshotDefragServicein interfaceKeyManager- Returns:
- SnapshotDefragService instance, or null if not initialized
-
lookupKey
public org.apache.hadoop.ozone.om.helpers.OmKeyInfo lookupKey(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, ResolvedBucket bucket, String clientAddress) throws IOException Description copied from interface:KeyManagerLook up an existing key. Return the info of the key to client side, which DistributedStorageHandler will use to access the data on datanode.- Specified by:
lookupKeyin interfaceKeyManager- Parameters:
args- the args of the key provided by client.clientAddress- a hint to key manager, order the datanode in returned pipeline by distance between client and datanode.- Returns:
- a OmKeyInfo instance client uses to talk to container.
- Throws:
IOException
-
refreshPipeline
protected void refreshPipeline(List<org.apache.hadoop.ozone.om.helpers.OmKeyInfo> keyList) throws IOException Refresh pipeline info in OM by asking SCM.- Parameters:
keyList- a list of OmKeyInfo- Throws:
IOException
-
refreshPipeline
protected Map<Long,org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline> refreshPipeline(Set<Long> containerIDs) throws IOException Refresh pipeline info in OM by asking SCM.- Parameters:
containerIDs- a set of containerIDs- Throws:
IOException
-
listKeys
public org.apache.hadoop.ozone.om.helpers.ListKeysResult listKeys(String volumeName, String bucketName, String startKey, String keyPrefix, int maxKeys) throws IOException Description copied from interface:KeyManagerReturns a list of keys represented byOmKeyInfoin the given bucket.- Specified by:
listKeysin interfaceKeyManager- Parameters:
volumeName- the name of the volume.bucketName- the name of the bucket.startKey- the start key name, only the keys whose name is after this value will be included in the result. This key is excluded from the result.keyPrefix- key name prefix, only the keys whose name has this prefix will be included in the result.maxKeys- the maximum number of keys to return. It ensures the size of the result will not exceed this limit.- Returns:
- a list of keys.
- Throws:
IOException
-
getPendingDeletionKeys
public PendingKeysDeletion getPendingDeletionKeys(org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, throws IOExceptionBoolean, IOException> filter, int count) Description copied from interface:KeyManagerRetrieves pending deletion keys that match a given filter function.- Specified by:
getPendingDeletionKeysin interfaceKeyManager- Parameters:
filter- a functional interface specifying the filter condition to apply to the keys. It takes a KeyValue pair containing a string key and an OmKeyInfo object, and returns a boolean value indicating whether the key meets the filter criteria.count- the maximum number of keys to retrieve.- Returns:
- a PendingKeysDeletion object containing the keys that satisfy the filter criteria, up to the specified count.
- Throws:
IOException- if an I/O error occurs while fetching the keys.
-
getPendingDeletionKeys
public PendingKeysDeletion getPendingDeletionKeys(String volume, String bucket, String startKey, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, throws IOExceptionBoolean, IOException> filter, int count) Description copied from interface:KeyManagerRetrieves the keys that are pending deletion in a specified bucket and volume.- Specified by:
getPendingDeletionKeysin interfaceKeyManager- Parameters:
volume- the name of the volume that contains the bucket.bucket- the name of the bucket within the volume where keys are located.startKey- the key from which to start retrieving pending deletions.filter- a filter function to determine which keys should be included in the pending deletion list.count- the maximum number of keys to retrieve that are pending deletion.- Returns:
- a PendingKeysDeletion object containing the list of keys pending deletion based on the specified parameters.
- Throws:
IOException- if an I/O error occurs during the operation.
-
getRenamesKeyEntries
public List<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String,String>> getRenamesKeyEntries(String volume, String bucket, String startKey, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, String>, throws IOExceptionBoolean, IOException> filter, int size) Description copied from interface:KeyManagerReturns a list rename entries from the snapshotRenamedTable.- Specified by:
getRenamesKeyEntriesin interfaceKeyManager- Parameters:
filter- filter to apply on the entries.size- max number of keys to return.- Returns:
- a Pair of list of
Table.KeyValuerepresenting the keys in the underlying metadataManager. - Throws:
IOException
-
getPreviousSnapshotOzoneDirInfo
public org.apache.ratis.util.function.CheckedFunction<KeyManager,org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo, getPreviousSnapshotOzoneDirInfoIOException> (long volumeId, org.apache.hadoop.ozone.om.helpers.OmBucketInfo bucketInfo, org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo keyInfo) throws IOException Description copied from interface:KeyManagerReturns the previous snapshot's ozone directorInfo corresponding for the object.- Specified by:
getPreviousSnapshotOzoneDirInfoin interfaceKeyManager- Throws:
IOException
-
getPreviousSnapshotOzoneDirInfo
public org.apache.ratis.util.function.CheckedFunction<KeyManager,org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo, getPreviousSnapshotOzoneDirInfoIOException> (long volumeId, org.apache.hadoop.ozone.om.helpers.OmBucketInfo bucketInfo, org.apache.hadoop.ozone.om.helpers.OmKeyInfo keyInfo) throws IOException Description copied from interface:KeyManagerReturns the previous snapshot's ozone directoryInfo corresponding for the object.- Specified by:
getPreviousSnapshotOzoneDirInfoin interfaceKeyManager- Throws:
IOException
-
getPreviousSnapshotOzoneKeyInfo
public org.apache.ratis.util.function.CheckedFunction<KeyManager,org.apache.hadoop.ozone.om.helpers.OmKeyInfo, getPreviousSnapshotOzoneKeyInfoIOException> (long volumeId, org.apache.hadoop.ozone.om.helpers.OmBucketInfo bucketInfo, org.apache.hadoop.ozone.om.helpers.OmKeyInfo keyInfo) throws IOException Description copied from interface:KeyManagerReturns the previous snapshot's ozone keyInfo corresponding for the object.- Specified by:
getPreviousSnapshotOzoneKeyInfoin interfaceKeyManager- Throws:
IOException
-
getDeletedKeyEntries
public List<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String,List<org.apache.hadoop.ozone.om.helpers.OmKeyInfo>>> getDeletedKeyEntries(String volume, String bucket, String startKey, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo>, throws IOExceptionBoolean, IOException> filter, int size) Description copied from interface:KeyManagerReturns a list deleted entries from the deletedTable.- Specified by:
getDeletedKeyEntriesin interfaceKeyManager- Parameters:
filter- filter to apply on the entries.size- max number of keys to return.- Returns:
- a Pair of list of
Table.KeyValuerepresenting the keys in the underlying metadataManager. - Throws:
IOException
-
getExpiredOpenKeys
public org.apache.hadoop.ozone.om.ExpiredOpenKeys getExpiredOpenKeys(Duration expireThreshold, int count, org.apache.hadoop.ozone.om.helpers.BucketLayout bucketLayout, Duration leaseThreshold) throws IOException Description copied from interface:KeyManagerReturns the names of up tocountopen keys whose age is greater than or equal toexpireThreshold.- Specified by:
getExpiredOpenKeysin interfaceKeyManager- Parameters:
expireThreshold- The threshold of open key expiration age.count- The maximum number of expired open keys to return.bucketLayout- The type of open keys to get (e.g. DEFAULT or FSO).leaseThreshold- The threshold of hsync key.- Returns:
- the expired open keys.
- Throws:
IOException
-
getExpiredMultipartUploads
public List<org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ExpiredMultipartUploadsBucket> getExpiredMultipartUploads(Duration expireThreshold, int maxParts) throws IOException Description copied from interface:KeyManagerReturns the MPU infos of up tocountwhose age is greater than or equal toexpireThreshold.- Specified by:
getExpiredMultipartUploadsin interfaceKeyManager- Parameters:
expireThreshold- The threshold of expired multipart uploads to return.maxParts- The threshold of number of MPU parts to return. This is a soft limit, which means if the last MPU has parts that exceed this limit, it will be included in the returned expired MPUs. This is to handle situation where MPU that has more parts than maxParts never get deleted.- Returns:
- a
Listof the expiredOzoneManagerProtocolProtos.ExpiredMultipartUploadsBucket, the expired multipart uploads, grouped by volume and bucket. - Throws:
IOException
-
getObjectTagging
public Map<String,String> getObjectTagging(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, ResolvedBucket bucket) throws IOException Description copied from interface:KeyManagerLook up an existing key from the OM table and retrieve the tags from the key info.- Specified by:
getObjectTaggingin interfaceKeyManager- Parameters:
args- the args of the key provided by client.bucket- the resolved parent bucket of the key.- Returns:
- Map of the tag set associated with the key.
- Throws:
IOException
-
getMetadataManager
public org.apache.hadoop.ozone.om.OMMetadataManager getMetadataManager()Description copied from interface:KeyManagerReturns the metadataManager.- Specified by:
getMetadataManagerin interfaceKeyManager- Returns:
- OMMetadataManager.
-
getDeletingService
Description copied from interface:KeyManagerReturns the instance of Deleting Service.- Specified by:
getDeletingServicein interfaceKeyManager- Returns:
- Background service.
-
getDirDeletingService
Description copied from interface:KeyManagerReturns the instance of Directory Deleting Service.- Specified by:
getDirDeletingServicein interfaceKeyManager- Returns:
- Background service.
-
getOpenKeyCleanupService
public org.apache.hadoop.hdds.utils.BackgroundService getOpenKeyCleanupService()Description copied from interface:KeyManagerReturns the instance of Open Key Cleanup Service.- Specified by:
getOpenKeyCleanupServicein interfaceKeyManager- Returns:
- Background service.
-
getMultipartUploadCleanupService
public org.apache.hadoop.hdds.utils.BackgroundService getMultipartUploadCleanupService()Description copied from interface:KeyManagerReturns the instance of Multipart Upload Cleanup Service.- Specified by:
getMultipartUploadCleanupServicein interfaceKeyManager- Returns:
- Background service.
-
getSnapshotSstFilteringService
Description copied from interface:KeyManagerReturns the instance of Snapshot SST Filtering service.- Specified by:
getSnapshotSstFilteringServicein interfaceKeyManager- Returns:
- Background service.
-
getSnapshotDeletingService
Description copied from interface:KeyManagerReturns the instance of Snapshot Deleting service.- Specified by:
getSnapshotDeletingServicein interfaceKeyManager- Returns:
- Background service.
-
getCompactionService
Description copied from interface:KeyManagerReturns the instance of CompactionService.- Specified by:
getCompactionServicein interfaceKeyManager- Returns:
- BackgroundService
-
isSstFilteringSvcEnabled
public boolean isSstFilteringSvcEnabled() -
isDefragSvcEnabled
public boolean isDefragSvcEnabled() -
listMultipartUploads
public org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList listMultipartUploads(String volumeName, String bucketName, String prefix, String keyMarker, String uploadIdMarker, int maxUploads, boolean withPagination) throws org.apache.hadoop.ozone.om.exceptions.OMException - Specified by:
listMultipartUploadsin interfaceKeyManager- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException
-
listParts
public org.apache.hadoop.ozone.om.helpers.OmMultipartUploadListParts listParts(String volumeName, String bucketName, String keyName, String uploadID, int partNumberMarker, int maxParts) throws IOException Description copied from interface:KeyManagerReturns list of parts of a multipart upload key.- Specified by:
listPartsin interfaceKeyManager- Parameters:
volumeName-bucketName-keyName-uploadID-partNumberMarker-maxParts-- Returns:
- OmMultipartUploadListParts
- Throws:
IOException
-
getAcl
public List<org.apache.hadoop.ozone.OzoneAcl> getAcl(org.apache.hadoop.ozone.security.acl.OzoneObj obj) throws IOException Description copied from interface:IOzoneAclReturns list of ACLs for given Ozone object.- Specified by:
getAclin interfaceIOzoneAcl- Parameters:
obj- Ozone object.- Throws:
IOException- if there is error.
-
checkAccess
public boolean checkAccess(org.apache.hadoop.ozone.security.acl.OzoneObj ozObject, org.apache.hadoop.ozone.security.acl.RequestContext context) throws org.apache.hadoop.ozone.om.exceptions.OMException Check access for given ozoneObject.- Specified by:
checkAccessin interfaceIOzoneAcl- Parameters:
ozObject- object for which access needs to be checked.context- Context object encapsulating all user related information.- Returns:
- true if user has access else false.
- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException
-
getFileStatus
public org.apache.hadoop.ozone.om.helpers.OzoneFileStatus getFileStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args) throws IOException OzoneFS api to get file status for an entry.- Specified by:
getFileStatusin interfaceOzoneManagerFS- Parameters:
args- Key args- Returns:
- file status.
- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException- if file does not exist if bucket does not exist if volume does not existIOException- if there is error in the db invalid arguments
-
getFileStatus
public org.apache.hadoop.ozone.om.helpers.OzoneFileStatus getFileStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, String clientAddress) throws IOException OzoneFS api to get file status for an entry.- Specified by:
getFileStatusin interfaceOzoneManagerFS- Parameters:
args- Key argsclientAddress- a hint to key manager, order the datanode in returned pipeline by distance between client and datanode.- Returns:
- file status.
- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException- if file does not exist if bucket does not exist if volume does not existIOException- if there is error in the db invalid arguments
-
lookupFile
public org.apache.hadoop.ozone.om.helpers.OmKeyInfo lookupFile(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, String clientAddress) throws IOException OzoneFS api to lookup for a file.- Specified by:
lookupFilein interfaceOzoneManagerFS- Parameters:
args- Key argsclientAddress- a hint to key manager, order the datanode in returned pipeline by distance between client and datanode.- Returns:
- a OmKeyInfo instance client uses to talk to container.
- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException- if given key is not found or it is not a file if bucket does not existIOException- if there is error in the db invalid arguments
-
refresh
Refresh the key block location information by get latest info from SCM.- Specified by:
refreshin interfaceKeyManager- Parameters:
key-- Throws:
IOException
-
listStatus
public List<org.apache.hadoop.ozone.om.helpers.OzoneFileStatus> listStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, boolean recursive, String startKey, long numEntries) throws IOException List the status for a file or a directory and its contents.- Specified by:
listStatusin interfaceOzoneManagerFS- Parameters:
args- Key argsrecursive- For a directory if true all the descendants of a particular directory are listedstartKey- Key from which listing needs to start. If startKey exists its status is included in the final list.numEntries- Number of entries to list from the start key- Returns:
- list of file status
- Throws:
IOException- if file or bucket or volume does not exist
-
listStatus
public List<org.apache.hadoop.ozone.om.helpers.OzoneFileStatus> listStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, boolean recursive, String startKey, long numEntries, String clientAddress) throws IOException Description copied from interface:OzoneManagerFSList the status for a file or a directory and its contents.- Specified by:
listStatusin interfaceOzoneManagerFS- Parameters:
args- the args of the key provided by client.recursive- For a directory if true all the descendants of a particular directory are listedstartKey- Key from which listing needs to start. If startKey exists its status is included in the final list.numEntries- Number of entries to list from the start keyclientAddress- a hint to key manager, order the datanode in returned pipeline by distance between client and datanode.- Returns:
- list of file status
- Throws:
IOException- if file or bucket or volume does not exist
-
listStatus
public List<org.apache.hadoop.ozone.om.helpers.OzoneFileStatus> listStatus(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, boolean recursive, String startKey, long numEntries, String clientAddress, boolean allowPartialPrefixes) throws IOException List the status for a file or a directory and its contents.- Specified by:
listStatusin interfaceOzoneManagerFS- Parameters:
args- Key argsrecursive- For a directory if true all the descendants of a particular directory are listedstartKey- Key from which listing needs to start. If startKey exists its status is included in the final list.numEntries- Number of entries to list from the start keyclientAddress- a hint to key manager, order the datanode in returned pipeline by distance between client and datanode.allowPartialPrefixes- if partial prefixes should be allowed, this is needed in context of ListKeys- Returns:
- list of file status
- Throws:
IOException- if file or bucket or volume does not exist
-
sortDatanodes
-
getDeletedDirEntries
public org.apache.hadoop.hdds.utils.db.TableIterator<String,? extends org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, getDeletedDirEntriesorg.apache.hadoop.ozone.om.helpers.OmKeyInfo>> (String volume, String bucket) throws IOException Description copied from interface:KeyManagerReturns an iterator for pending deleted directories for volume and bucket.- Specified by:
getDeletedDirEntriesin interfaceKeyManager- Throws:
IOException
-
getPendingDeletionSubDirs
public DeleteKeysResult getPendingDeletionSubDirs(long volumeId, long bucketId, org.apache.hadoop.ozone.om.helpers.OmKeyInfo parentInfo, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, throws IOExceptionBoolean, IOException> filter, int remainingNum) Description copied from interface:KeyManagerReturns all sub directories under the given parent directory.- Specified by:
getPendingDeletionSubDirsin interfaceKeyManager- Parameters:
parentInfo-- Returns:
- list of dirs
- Throws:
IOException
-
getPendingDeletionSubFiles
public DeleteKeysResult getPendingDeletionSubFiles(long volumeId, long bucketId, org.apache.hadoop.ozone.om.helpers.OmKeyInfo parentInfo, org.apache.ratis.util.function.CheckedFunction<org.apache.hadoop.hdds.utils.db.Table.KeyValue<String, org.apache.hadoop.ozone.om.helpers.OmKeyInfo>, throws IOExceptionBoolean, IOException> filter, int remainingNum) Description copied from interface:KeyManagerReturns all sub files under the given parent directory.- Specified by:
getPendingDeletionSubFilesin interfaceKeyManager- Parameters:
parentInfo-- Returns:
- list of files
- Throws:
IOException
-
isBucketFSOptimized
- Throws:
IOException
-
getKeyInfo
public org.apache.hadoop.ozone.om.helpers.OmKeyInfo getKeyInfo(org.apache.hadoop.ozone.om.helpers.OmKeyArgs args, ResolvedBucket bucket, String clientAddress) throws IOException Description copied from interface:KeyManagerReturn info of an existing key to client side to access to data on datanodes.- Specified by:
getKeyInfoin interfaceKeyManager- Parameters:
args- the args of the key provided by client.clientAddress- a hint to key manager, order the datanode in returned pipeline by distance between client and datanode.- Returns:
- a OmKeyInfo instance client uses to talk to container.
- Throws:
IOException
-
refreshPipelineFromCache
protected void refreshPipelineFromCache(org.apache.hadoop.ozone.om.helpers.OmKeyInfo keyInfo, boolean forceRefresh) throws IOException - Throws:
IOException
-