Class FpDefault

  • All Implemented Interfaces:
    org.cactoos.BiFunc<Path,​Path,​Path>, Footprint

    public final class FpDefault
    extends FpEnvelope
    Default footprint that covers all the scenarios of updating target from source using cache.

    General statements: 1) if target older than source - target is not updated 2) if target younger than source or does not exist - it will be created and filled up. It can be created from source, or from global cache if it exists and cacheable and older than source. 3) the cache is updated if it's cacheable AND (it does not exist or if it's younger than source)

    Excluding any type of errors there are 4 possible scenarios of this Footprint work: 1) do nothing and just return target file. 2) update target from source and return target. 3) update target from source, update cache from target and return target. 4) copy content from cache to target and return target.

    Since:
    0.41
    • Constructor Detail

      • FpDefault

        public FpDefault​(org.cactoos.Func<Path,​String> content,
                         Path base,
                         String semver,
                         String hash,
                         Path tail)
        Ctor.
        Parameters:
        content - Function that returns content from source
        base - Base cache directory
        semver - Semver as part of absolute cache path
        hash - Git hash as part of absolute cache path
        tail - The last part of absolute cache path
      • FpDefault

        public FpDefault​(org.cactoos.Func<Path,​String> content,
                         Path base,
                         String semver,
                         Supplier<String> hash,
                         Path tail)
        Ctor.
        Parameters:
        content - Function that returns content from source
        base - Base cache directory
        semver - Semver as part of absolute cache path
        hash - Git hash as part of absolute cache path
        tail - The last part of absolute cache path