ByteSync
ByteSync copied to clipboard
[feature] Add IsTransferable helper method to IFileSystemInspector
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
- [ ] Add
IsTransferable(FileSystemInfo fsi)toIFileSystemInspector - [ ] Implement in
FileSystemInspector - [ ] Returns
trueonly forRegularFile - [ ] Returns
falseforDirectory,Symlink, all POSIX special types,Unknown - [ ] Unit tests covering all entry kinds
- [ ] XML documentation
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
- Requires:
ClassifyEntry()method (issue #263) - Requires:
FileSystemEntryKindenum (issue #262)
Priority
Nice to Have — Convenience method that improves code readability.