watch_fingerprint Module

Lightweight file fingerprinting for change detection.

Uses a size-mixed FNV-1a hash of up to three fixed-size blocks from the file (head, mid, tail) to efficiently detect modifications.

This fingerprint is intended as a fast heuristic: - It is not a cryptographic hash. - It trades perfect detection for performance on large trees. - Combining size + multiple sample blocks provides good practical coverage.


Uses

  • module~~watch_fingerprint~~UsesGraph module~watch_fingerprint watch_fingerprint fpm_command_line fpm_command_line module~watch_fingerprint->fpm_command_line fpm_filesystem fpm_filesystem module~watch_fingerprint->fpm_filesystem fpm_strings fpm_strings module~watch_fingerprint->fpm_strings iso_fortran_env iso_fortran_env module~watch_fingerprint->iso_fortran_env

Used by

  • module~~watch_fingerprint~~UsedByGraph module~watch_fingerprint watch_fingerprint module~watch_engine watch_engine module~watch_engine->module~watch_fingerprint

Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: BLOCK_SIZE = 4096
integer(kind=int64), private, parameter :: FNV_OFFSET = 1469598103934665603_int64
integer(kind=int64), private, parameter :: FNV_PRIME = 1099511628211_int64
character(len=1), private, allocatable, save :: io_buf(:)

Functions

public function file_fingerprint(path) result(fp)

Compute a fingerprint for a file path.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

Return Value integer(kind=int64)

public function manifest_key_from_files(settings, files) result(k)

Compute a key representing the current manifest-related configuration.

Read more…

Arguments

Type IntentOptional Attributes Name
class(fpm_build_settings), intent(in) :: settings
type(string_t), intent(in), allocatable :: files(:)

Return Value integer(kind=int64)


Subroutines

public subroutine accept_changes(fp_prev, fp_now, changed_idx, changed_count)

Accept the new fingerprints for the subset of changed indices.

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: fp_prev(:)
integer(kind=int64), intent(in) :: fp_now(:)
integer, intent(in) :: changed_idx(:)
integer, intent(in) :: changed_count

public subroutine init_fingerprints(files, fp_prev, fp_now, changed_idx)

Initialize fingerprint arrays for a watch list.

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(in), allocatable :: files(:)
integer(kind=int64), intent(inout), allocatable :: fp_prev(:)
integer(kind=int64), intent(inout), allocatable :: fp_now(:)
integer, intent(inout), allocatable :: changed_idx(:)

public subroutine scan_changes(files, fp_prev, fp_now, changed_idx, changed_count)

Scan files and return indices of changed entries.

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(in), allocatable :: files(:)
integer(kind=int64), intent(in) :: fp_prev(:)
integer(kind=int64), intent(inout) :: fp_now(:)
integer, intent(inout) :: changed_idx(:)
integer, intent(out) :: changed_count

private subroutine fnv1a_mix_i64(h, x)

Mix a single 64-bit value into a 64-bit FNV-1a state.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: h
integer(kind=int64), intent(in) :: x

private subroutine fnv1a_mix_str(h, s)

Mix a string into a 64-bit FNV-1a state.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: h
character(len=*), intent(in) :: s

private subroutine hash_block(u, pos, n, h)

Hash a single file block at a specific stream position.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: u
integer(kind=int64), intent(in) :: pos
integer, intent(in) :: n
integer(kind=int64), intent(inout) :: h