Skip to content

[feature] Add IsTransferable helper method to IFileSystemInspector #269

@paul-fresquet

Description

@paul-fresquet

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) to IFileSystemInspector
  • Implement in FileSystemInspector
  • Returns true only for RegularFile
  • Returns false for Directory, 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

Priority

Nice to Have — Convenience method that improves code readability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions