Class HashResolver

java.lang.Object
org.projectnessie.services.hash.HashResolver

public final class HashResolver extends Object
  • Constructor Details

    • HashResolver

      public HashResolver(org.projectnessie.services.config.ServerConfig config, org.projectnessie.versioned.VersionStore store)
  • Method Details

    • resolveToHead

      public ResolvedHash resolveToHead(@Nullable String namedRef) throws org.projectnessie.versioned.ReferenceNotFoundException
      Resolves the given namedRef to its current HEAD. Throws if the reference does not exist, or if it's DetachedRef.

      If namedRef is null, the default branch will be used.

      Throws:
      org.projectnessie.versioned.ReferenceNotFoundException
    • resolveHashOnRef

      public ResolvedHash resolveHashOnRef(@Nullable String namedRef, @Nullable String hashOnRef) throws org.projectnessie.versioned.ReferenceNotFoundException
      Resolves the given namedRef to hashOnRef if present, otherwise to its current HEAD, if available. Uses the HashValidator.DEFAULT instance.

      Throws if the reference does not exist, the hash is invalid, or is not present on the reference.

      If namedRef is DetachedRef, then a non-null hashOnRef is required.

      If namedRef is null, the default branch will be used.

      Throws:
      org.projectnessie.versioned.ReferenceNotFoundException
    • resolveHashOnRef

      public ResolvedHash resolveHashOnRef(@Nullable String namedRef, @Nullable String hashOnRef, HashValidator validator) throws org.projectnessie.versioned.ReferenceNotFoundException
      Same as resolveHashOnRef(String, String) but allows to pass a custom HashValidator.
      Throws:
      org.projectnessie.versioned.ReferenceNotFoundException
    • resolveHashOnRef

      public ResolvedHash resolveHashOnRef(ResolvedHash head, @Nullable String hashOnRef, HashValidator validator) throws org.projectnessie.versioned.ReferenceNotFoundException
      Resolves the given hashOnRef against another previously computed ResolvedHash pointing to a branch at its HEAD.

      This is useful to compute more hashes against a first resolved hash, e.g. when transplanting.

      See resolveHashOnRef(String, String) for important caveats.

      Throws:
      org.projectnessie.versioned.ReferenceNotFoundException
    • resolveHashOnRef

      public ResolvedHash resolveHashOnRef(org.projectnessie.versioned.NamedRef ref, @Nullable org.projectnessie.versioned.Hash currentHead, @Nullable String hashOnRef, HashValidator validator) throws org.projectnessie.versioned.ReferenceNotFoundException
      Resolves the given namedRef to hashOnRef if present, otherwise to currentHead, if available.

      Either currentHead or hashOnRef must be non-null. It's the caller's responsibility to validate that any user-provided input meets this requirement.

      See resolveHashOnRef(String, String) for important caveats.

      Throws:
      org.projectnessie.versioned.ReferenceNotFoundException