Skip to content

Commit

Permalink
move glob matching into its own file (#5945)
Browse files Browse the repository at this point in the history
### Problem

See #5871, where we describe an encapsulation leak created by implementing all of the glob expansion logic in the body of `VFS`.

### Solution

- Create `glob_matching.rs`, exporting the `GlobMatching` trait, which exports the two methods `canonicalize` and `expand`, which call into methods in a private trait `GlobMatchingImplementation`. 

**Note:** `canonicalize` calls `expand`, and vice versa, which is why both methods were moved to `glob_matching.rs`.

### Result

Orthogonal glob matching logic is made into a trait that is implemented for all types implementing `VFS`, removing the encapsulation leak. The `VFS` trait is now just four method signature declarations, making the trait much easier to read and understand.
  • Loading branch information
cosmicexplorer authored Jun 12, 2018
1 parent b6d3978 commit 4e531ae
Show file tree
Hide file tree
Showing 6 changed files with 408 additions and 375 deletions.
2 changes: 1 addition & 1 deletion src/rust/engine/fs/fs_util/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern crate protobuf;

use bytes::Bytes;
use clap::{App, Arg, SubCommand};
use fs::{ResettablePool, Snapshot, Store, StoreFileByDigest, VFS};
use fs::{GlobMatching, ResettablePool, Snapshot, Store, StoreFileByDigest, VFS};
use futures::future::Future;
use hashing::{Digest, Fingerprint};
use protobuf::Message;
Expand Down
Loading

0 comments on commit 4e531ae

Please sign in to comment.