Skip to content

[C++] Implement GetFileInfo for a single file in Azure filesystem #38335

@Tom-Newton

Description

@Tom-Newton

Describe the enhancement requested

Implement Result<FileInfo> AzureFileSystem::GetFileInfo(const std::string& path).

Logic I suggest we apply:

  1. Parse the string path to AzurePath.
  2. If path.container.empty() then this is the root of the storage account. Its a directory and we don't really have any more info to add.
  3. If path.path_to_file.empty() then this is the root of a container. Try to fetch properties of the container. If the container exists and not IsDeleted() then its a directory and probably we can add the last modified time.
  4. Call BlobClient::GetProperties(). If the storage account is hierarchical namespace it possible that we will get the properties for a directory, so we should always check this https://github.com/Azure/azure-sdk-for-cpp/blob/dd236311193c6a3debf3b12c47f14e49a20c72c7/sdk/storage/azure-storage-files-datalake/src/datalake_utilities.cpp#L86-L91.

All of this only needs the simple blob endpoints - nothing exclusive to hierarchical namespace enabled accounts.

The other GetFileInfo method requires doing directory listing which will be some additional complexity so I propose implementing that in a separate PR.

Related Issues:

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions