-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be more selective about file metdata in listdir
The directory iterator we use is configurable about what file metdata to retrieve. This can in some situations significantly improve performance of generating directory listing.
- Loading branch information
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import enum | ||
import pytest | ||
|
||
from middlewared.test.integration.utils import call | ||
|
||
|
||
class DirectoryRequestMask(enum.IntFlag): | ||
ACL = enum.auto() | ||
CTLDIR = enum.auto() | ||
REALPATH = enum.auto() | ||
XATTRS = enum.auto() | ||
ZFS_ATTRS = enum.auto() | ||
|
||
|
||
@pytest.mark.parametrize('select_key,request_mask', [ | ||
('realpath', DirectoryRequestMask.REALPATH.value), | ||
('acl', DirectoryRequestMask.ACL.value), | ||
('zfs_attrs', DirectoryRequestMask.ZFS_ATTRS.value), | ||
('is_ctldir', DirectoryRequestMask.CTLDIR.value), | ||
('xattrs', DirectoryRequestMask.XATTRS.value), | ||
([], None), | ||
('name', 0) | ||
]) | ||
def test__select_to_request_mask(select_key, request_mask): | ||
val = call('filesystem.listdir_request_mask', select_key) | ||
|
||
if select_key == []: | ||
assert val is None | ||
|
||
assert val == request_mask |