Skip to content

ClassPathFingerprints: add a kind word and move cache invalidation into Logic #301

Open

Description

@sergej-koscejev

Problem

ClassPathFingerprints (daemon/src/main/kotlin/com/specificlanguages/mops/daemon/ClassPathFingerprints.kt:29) keeps content hashes of class path files between calls. Under the design standards it is an Adapter with a cache (adapter-cache), but:

  • its KDoc has no kind word (kind-in-kdoc) and no Hides: line (hides-line);
  • it decides inline when a cached hash is still true: cachedHash (ClassPathFingerprints.kt:69) compares the stamp and applies the racy window. adapter-cache says cache invalidation is Logic that the Adapter uses (adapter-deps), in the Adapter's package.

What to build

  • Mark the class as an Adapter with a Hides: line and a sentence on its cache and thread safety (state-one-owner).
  • Move the decision "may this cached hash be reused, and may this stamp be trusted next time" into Logic in the same package, with unit tests.

Explicitly not doing

  • Changing what the stamp contains or the length of the racy window.

Acceptance criteria

  • ClassPathFingerprints contains no branch about whether a cached hash is still true.
  • Unit tests cover reuse, a changed stamp, a missing stamp and the racy window.

Found while reworking #217 to the rules from #300.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions