Class HashResolver


  • public final class HashResolver
    extends java.lang.Object
    • Constructor Detail

      • HashResolver

        public HashResolver​(ServerConfig config,
                            org.projectnessie.versioned.VersionStore store)
    • Method Detail

      • resolveToHead

        public ResolvedHash resolveToHead​(@Nullable @Nullable
                                          java.lang.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 @Nullable
                                             java.lang.String namedRef,
                                             @Nullable @Nullable
                                             java.lang.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 @Nullable
                                             java.lang.String namedRef,
                                             @Nullable @Nullable
                                             java.lang.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 @Nullable
                                             java.lang.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 @Nullable
                                             org.projectnessie.versioned.Hash currentHead,
                                             @Nullable @Nullable
                                             java.lang.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