Summary
Add a convenience method IsTransferable() to IFileSystemInspector that determines whether a filesystem entry can be synchronized. This provides a single, clear API for the most common classification question.
Background
After implementing ClassifyEntry(), callers will often need to check:
var kind = inspector.ClassifyEntry(fileInfo);
if (kind.HasFlag(FileSystemEntryKind.NonTransferable))
{
// skip
}
A helper method simplifies this common pattern.
Proposed API
public interface IFileSystemInspector
{
// Existing methods...
/// <summary>
/// Determines if an entry is a regular file that can be synchronized.
/// Returns false for symlinks, special files, directories, etc.
/// </summary>
bool IsTransferable(FileSystemInfo fsi);
}
Implementation
public bool IsTransferable(FileSystemInfo fsi)
{
var kind = ClassifyEntry(fsi);
// Only regular files are transferable
return kind == FileSystemEntryKind.RegularFile;
}
Usage Example
// Before (verbose)
var kind = _inspector.ClassifyEntry(fileInfo);
if (kind != FileSystemEntryKind.RegularFile)
{
RecordSkippedEntry(...);
return;
}
// After (concise)
if (!_inspector.IsTransferable(fileInfo))
{
RecordSkippedEntry(...);
return;
}
Acceptance Criteria
Technical Notes
- This is a convenience wrapper, not new logic
- Keeps
ClassifyEntry() as the source of truth
- Consider adding
IsTransferableDirectory() if needed for directory sync scenarios
Dependencies
Priority
Nice to Have — Convenience method that improves code readability.
Summary
Add a convenience method
IsTransferable()toIFileSystemInspectorthat determines whether a filesystem entry can be synchronized. This provides a single, clear API for the most common classification question.Background
After implementing
ClassifyEntry(), callers will often need to check:A helper method simplifies this common pattern.
Proposed API
Implementation
Usage Example
Acceptance Criteria
IsTransferable(FileSystemInfo fsi)toIFileSystemInspectorFileSystemInspectortrueonly forRegularFilefalseforDirectory,Symlink, all POSIX special types,UnknownTechnical Notes
ClassifyEntry()as the source of truthIsTransferableDirectory()if needed for directory sync scenariosDependencies
ClassifyEntry()method (issue [refactor] Add ClassifyEntry method to IFileSystemInspector #263)FileSystemEntryKindenum (issue [refactor] Create FileSystemEntryKind enum for explicit entry classification #262)Priority
Nice to Have — Convenience method that improves code readability.