Skip to content

Added DataLakeDirectoryClient.GetPaths()#16089

Merged
seanmcc-msft merged 3 commits intoAzure:masterfrom
seanmcc-msft:feature/storage/dataLakeDirectoryClientGetPaths
Oct 23, 2020
Merged

Added DataLakeDirectoryClient.GetPaths()#16089
seanmcc-msft merged 3 commits intoAzure:masterfrom
seanmcc-msft:feature/storage/dataLakeDirectoryClientGetPaths

Conversation

@seanmcc-msft
Copy link
Copy Markdown
Member

Resolves #13216

@ghost ghost added the Storage Storage Service (Queues, Blobs, Files) label Oct 19, 2020
Comment on lines +2226 to +2227
bool recursive = default,
bool userPrincipalName = default,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be options bag?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the way it is for DataLakeFileSystemClient.GetPaths() too. I do like the idea of an options bag though, but if we do it here, we should go back and do it for the FileSystemClient too and hide the old one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also thinking about this when I did the implementation, I wanted to see what y'all thought. I'll switch both to options bags.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we think this will add a lot of parameters in the future? You currently have 2 and the informal guideline is roughly 6.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible it could grow, but I don't know that there are any specific plans. I added this based on @kasobol-msft and @amnguye's comments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd follow this if there's no formal guidance. Let's not forget cancellationToken when we count parameters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That link offers a highly opinionated view that clashes with the rest of our (different highly opinionated 😄) style. In general for questions like this we should get them clarified in the guidelines rather than seek elsewhere so Storage libraries look and feel the same as other Azure services. I checked https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-parameters and it does now list 6 parameters:

Simple methods are methods that take up to six parameters, with most of the parameters being simple BCL primitives. ... Simple methods should follow standard .NET Design Guidelines for parameter list and overload design.

Unless we expect this to more than double, I'd suggest using parameters for now.

Copy link
Copy Markdown
Contributor

@kasobol-msft kasobol-msft Oct 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly the https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-parameters gives an example of "simple method" that has 3 parameters (2 BCL + cancellation token). In general I think 6 is too much and I think the sdk guide should trim that to 3 (6 parameter method doesn't look good imo).
Anyway in this case since we 2 params + token so let's follow the guideline then and go back to original design.

IList<PathItem> paths = await response.ToListAsync();

// Assert
Assert.AreEqual(3, paths.Count);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd assert path names as well in these tests to make sure we're getting the right one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@seanmcc-msft seanmcc-msft changed the title Added DataLakeFileClient.GetPaths() Added DataLakeDirectoryClient.GetPaths() Oct 21, 2020
@seanmcc-msft
Copy link
Copy Markdown
Member Author

/azp run net - storage - ci

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@seanmcc-msft
Copy link
Copy Markdown
Member Author

@tg-msft, @kasobol-msft, I removed the options bags. Can we merge?

@kasobol-msft
Copy link
Copy Markdown
Contributor

kasobol-msft commented Oct 22, 2020

@tg-msft, @kasobol-msft Kamil Sobol FTE, I removed the options bags. Can we merge?

Yes please.

@seanmcc-msft
Copy link
Copy Markdown
Member Author

net - storage - ci

@seanmcc-msft seanmcc-msft merged commit 50ec101 into Azure:master Oct 23, 2020
@seanmcc-msft seanmcc-msft deleted the feature/storage/dataLakeDirectoryClientGetPaths branch October 23, 2020 15:28
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQ] Azure Data Lake Gen2 DirectoryClient list paths in directory

4 participants