{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/FileSystem/pulls/comments/79858856","id":79858856,"diff_hunk":"@@ -0,0 +1,153 @@\n+﻿// Copyright (c) .NET Foundation. All rights reserved.\n+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n+\n+using System;\n+using System.Diagnostics;\n+using System.IO;\n+using System.Linq;\n+using System.Security.Cryptography;\n+using System.Text;\n+using Microsoft.Extensions.FileProviders.Physical.Internal;\n+using Microsoft.Extensions.FileSystemGlobbing;\n+using Microsoft.Extensions.FileSystemGlobbing.Abstractions;\n+using Microsoft.Extensions.Primitives;\n+\n+namespace Microsoft.Extensions.FileProviders.Physical\n+{\n+    public class PollingWildCardChangeToken : IChangeToken\n+    {\n+        public static readonly TimeSpan PollingInterval = TimeSpan.FromSeconds(4);\n+        private const int DefaultBufferSize = 256;\n+        private readonly object _enumerationLock = new object();\n+        private readonly DirectoryInfoBase _directoryInfo;\n+        private readonly Matcher _matcher;\n+        private bool _changed;\n+        private DateTime _lastScanTimeUtc;\n+        private byte[] _fileNameBuffer;\n+        private byte[] _previousHash;\n+\n+        public PollingWildCardChangeToken(\n+            string root,\n+            string pattern)\n+            : this(\n+                new DirectoryInfoWrapper(new DirectoryInfo(root)),\n+                pattern,\n+                Internal.Clock.Instance)\n+        {\n+        }\n+\n+        public PollingWildCardChangeToken(\n+            DirectoryInfoBase directoryInfo,\n+            string pattern,\n+            IClock clock)\n+        {\n+            _directoryInfo = directoryInfo;\n+            Clock = clock;\n+\n+            _matcher = new Matcher(StringComparison.OrdinalIgnoreCase);\n+            _matcher.AddInclude(pattern);\n+            CalculateChanges();\n+        }\n+\n+        /// <inheritdoc />\n+        public bool ActiveChangeCallbacks => false;\n+\n+        public IClock Clock { get; }","path":"src/Microsoft.Extensions.FileProviders.Physical/PollingWildCardChangeToken.cs","position":55,"original_position":55,"commit_id":"e937d62270d64bd10e87d93214a1c1f1b2ac8117","original_commit_id":"e937d62270d64bd10e87d93214a1c1f1b2ac8117","user":{"login":"pranavkm","id":174281,"avatar_url":"https://avatars.githubusercontent.com/u/174281?v=3","gravatar_id":"","url":"https://api.github.com/users/pranavkm","html_url":"https://github.com/pranavkm","followers_url":"https://api.github.com/users/pranavkm/followers","following_url":"https://api.github.com/users/pranavkm/following{/other_user}","gists_url":"https://api.github.com/users/pranavkm/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavkm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavkm/subscriptions","organizations_url":"https://api.github.com/users/pranavkm/orgs","repos_url":"https://api.github.com/users/pranavkm/repos","events_url":"https://api.github.com/users/pranavkm/events{/privacy}","received_events_url":"https://api.github.com/users/pranavkm/received_events","type":"User","site_admin":false},"body":"We could consider commonizing this with the one in Caching and Kestrel - https://github.com/aspnet/KestrelHttpServer/blob/dev/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/ISystemClock.cs. Security has this type too but it's public API: https://github.com/aspnet/Security/blob/22d133cefa20926b25eeb82779343b23a221117f/src/Microsoft.AspNetCore.Authentication/ISystemClock.cs","created_at":"2016-09-21T15:17:33Z","updated_at":"2016-09-21T15:28:41Z","html_url":"https://github.com/aspnet/FileSystem/pull/235#discussion_r79858856","pull_request_url":"https://api.github.com/repos/aspnet/FileSystem/pulls/235","_links":{"self":{"href":"https://api.github.com/repos/aspnet/FileSystem/pulls/comments/79858856"},"html":{"href":"https://github.com/aspnet/FileSystem/pull/235#discussion_r79858856"},"pull_request":{"href":"https://api.github.com/repos/aspnet/FileSystem/pulls/235"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/FileSystem/pulls/235","id":86065202,"html_url":"https://github.com/aspnet/FileSystem/pull/235","diff_url":"https://github.com/aspnet/FileSystem/pull/235.diff","patch_url":"https://github.com/aspnet/FileSystem/pull/235.patch","issue_url":"https://api.github.com/repos/aspnet/FileSystem/issues/235","number":235,"state":"open","locked":false,"title":"Modify PhysicalFileWatcher.Watch to work for new files being added","user":{"login":"pranavkm","id":174281,"avatar_url":"https://avatars.githubusercontent.com/u/174281?v=3","gravatar_id":"","url":"https://api.github.com/users/pranavkm","html_url":"https://github.com/pranavkm","followers_url":"https://api.github.com/users/pranavkm/followers","following_url":"https://api.github.com/users/pranavkm/following{/other_user}","gists_url":"https://api.github.com/users/pranavkm/gists{/gist_id}","starred_url":"https://api.github.com/users/pranavkm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pranavkm/subscriptions","organizations_url":"https://api.github.com/users/pranavkm/orgs","repos_url":"https://api.github.com/users/pranavkm/repos","events_url":"https://api.github.com/users/pranavkm/events{/privacy}","received_events_url":"https://api.github.com/users/pranavkm/received_events","type":"User","site_admin":false},"body":"Fixes #233","created_at":"2016-09-20T22:05:57Z","updated_at":"2016-09-21T15:28:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29c9ed5679fbc1bbe2558f4489fc84bf1559391e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/FileSystem/pulls/235/commits","review_comments_url":"https://api.github.com/repos/aspnet/FileSystem/pulls/235/comments","review_comment_url":"https://api.github.com/repos/aspnet/FileSystem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/FileSystem/issues/235/comments","statuses_url":"https://api.github.com/repos/aspnet/FileSystem/statuses/e937d62270d64bd10e87d93214a1c1f1b2ac8117","head":{"label":"aspnet:prkrishn/glob-prototype","ref":"prkrishn/glob-prototype","sha":"e937d62270d64bd10e87d93214a1c1f1b2ac8117","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16161950,"name":"FileSystem","full_name":"aspnet/FileSystem","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/FileSystem","description":"Abstraction of file system APIs.","fork":false,"url":"https://api.github.com/repos/aspnet/FileSystem","forks_url":"https://api.github.com/repos/aspnet/FileSystem/forks","keys_url":"https://api.github.com/repos/aspnet/FileSystem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/FileSystem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/FileSystem/teams","hooks_url":"https://api.github.com/repos/aspnet/FileSystem/hooks","issue_events_url":"https://api.github.com/repos/aspnet/FileSystem/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/FileSystem/events","assignees_url":"https://api.github.com/repos/aspnet/FileSystem/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/FileSystem/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/FileSystem/tags","blobs_url":"https://api.github.com/repos/aspnet/FileSystem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/FileSystem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/FileSystem/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/FileSystem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/FileSystem/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/FileSystem/languages","stargazers_url":"https://api.github.com/repos/aspnet/FileSystem/stargazers","contributors_url":"https://api.github.com/repos/aspnet/FileSystem/contributors","subscribers_url":"https://api.github.com/repos/aspnet/FileSystem/subscribers","subscription_url":"https://api.github.com/repos/aspnet/FileSystem/subscription","commits_url":"https://api.github.com/repos/aspnet/FileSystem/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/FileSystem/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/FileSystem/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/FileSystem/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/FileSystem/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/FileSystem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/FileSystem/merges","archive_url":"https://api.github.com/repos/aspnet/FileSystem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/FileSystem/downloads","issues_url":"https://api.github.com/repos/aspnet/FileSystem/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/FileSystem/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/FileSystem/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/FileSystem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/FileSystem/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/FileSystem/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/FileSystem/deployments","created_at":"2014-01-23T04:09:34Z","updated_at":"2016-09-07T06:47:06Z","pushed_at":"2016-09-20T22:14:59Z","git_url":"git://github.com/aspnet/FileSystem.git","ssh_url":"git@github.com:aspnet/FileSystem.git","clone_url":"https://github.com/aspnet/FileSystem.git","svn_url":"https://github.com/aspnet/FileSystem","homepage":"","size":1204,"stargazers_count":113,"watchers_count":113,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":38,"forks":54,"open_issues":38,"watchers":113,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"c0380bd1863219b8db345364e2f1315cf2b1ad26","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16161950,"name":"FileSystem","full_name":"aspnet/FileSystem","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/FileSystem","description":"Abstraction of file system APIs.","fork":false,"url":"https://api.github.com/repos/aspnet/FileSystem","forks_url":"https://api.github.com/repos/aspnet/FileSystem/forks","keys_url":"https://api.github.com/repos/aspnet/FileSystem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/FileSystem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/FileSystem/teams","hooks_url":"https://api.github.com/repos/aspnet/FileSystem/hooks","issue_events_url":"https://api.github.com/repos/aspnet/FileSystem/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/FileSystem/events","assignees_url":"https://api.github.com/repos/aspnet/FileSystem/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/FileSystem/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/FileSystem/tags","blobs_url":"https://api.github.com/repos/aspnet/FileSystem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/FileSystem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/FileSystem/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/FileSystem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/FileSystem/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/FileSystem/languages","stargazers_url":"https://api.github.com/repos/aspnet/FileSystem/stargazers","contributors_url":"https://api.github.com/repos/aspnet/FileSystem/contributors","subscribers_url":"https://api.github.com/repos/aspnet/FileSystem/subscribers","subscription_url":"https://api.github.com/repos/aspnet/FileSystem/subscription","commits_url":"https://api.github.com/repos/aspnet/FileSystem/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/FileSystem/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/FileSystem/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/FileSystem/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/FileSystem/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/FileSystem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/FileSystem/merges","archive_url":"https://api.github.com/repos/aspnet/FileSystem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/FileSystem/downloads","issues_url":"https://api.github.com/repos/aspnet/FileSystem/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/FileSystem/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/FileSystem/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/FileSystem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/FileSystem/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/FileSystem/releases{/id}","deployments_url":"https://api.github.com/repos/aspnet/FileSystem/deployments","created_at":"2014-01-23T04:09:34Z","updated_at":"2016-09-07T06:47:06Z","pushed_at":"2016-09-20T22:14:59Z","git_url":"git://github.com/aspnet/FileSystem.git","ssh_url":"git@github.com:aspnet/FileSystem.git","clone_url":"https://github.com/aspnet/FileSystem.git","svn_url":"https://github.com/aspnet/FileSystem","homepage":"","size":1204,"stargazers_count":113,"watchers_count":113,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"open_issues_count":38,"forks":54,"open_issues":38,"watchers":113,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/FileSystem/pulls/235"},"html":{"href":"https://github.com/aspnet/FileSystem/pull/235"},"issue":{"href":"https://api.github.com/repos/aspnet/FileSystem/issues/235"},"comments":{"href":"https://api.github.com/repos/aspnet/FileSystem/issues/235/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/FileSystem/pulls/235/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/FileSystem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/FileSystem/pulls/235/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/FileSystem/statuses/e937d62270d64bd10e87d93214a1c1f1b2ac8117"}}}}
{"actor":{"display_login":"pranavkm"}}