DalaDev.FileTransfer.Sync (dala_dev v0.4.0)

Copy Markdown View Source

Pure sync-action computation shared by all file-transfer platforms.

Compares local and remote file maps and returns a list of actions:

  • {:push, relative_path} — local is new or newer
  • {:pull, relative_path} — remote is newer
  • {:delete, relative_path} — remote-only file (when delete enabled)

Local map: %{relative_path => %{size: integer, mtime: integer}} Remote map: %{relative_path => {size, mtime}}

Public for testing (see AGENTS.md "Public API Seams").

Summary

Functions

Computes sync actions from local and remote file maps.

Lists regular files under dir as {relative_path, absolute_path} pairs.

Functions

compute_actions(local_map, remote_map, delete?)

@spec compute_actions(
  %{required(String.t()) => map()},
  %{required(String.t()) => {integer(), integer()}},
  boolean()
) :: [{:push | :pull | :delete, String.t()}]

Computes sync actions from local and remote file maps.

list_files(dir)

@spec list_files(String.t()) :: [{String.t(), String.t()}]

Lists regular files under dir as {relative_path, absolute_path} pairs.