Class AbstractDatabaseAdapter<OP_CONTEXT extends java.lang.AutoCloseable,​CONFIG extends DatabaseAdapterConfig>

  • Type Parameters:
    OP_CONTEXT - context for each operation, so for each operation in DatabaseAdapter that requires database access. For example, used to have one "borrowed" database connection per database-adapter operation.
    CONFIG - configuration interface type for the concrete implementation
    All Implemented Interfaces:
    DatabaseAdapter

    public abstract class AbstractDatabaseAdapter<OP_CONTEXT extends java.lang.AutoCloseable,​CONFIG extends DatabaseAdapterConfig>
    extends java.lang.Object
    implements DatabaseAdapter
    Contains all the database-independent logic for a Database-adapter.

    This class does not implement everything from DatabaseAdapter.

    Implementations must consider that production environments may use instances of this class in JAX-RS RequestScope, which means that it must be very cheap to create new instances of the implementations.

    Managed resources like a connection-pool must be managed outside of AbstractDatabaseAdapter implementations. The recommended way to "inject" such managed resources into short-lived AbstractDatabaseAdapter implementations is via a special configuration attribute.

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract OP_CONTEXT borrowConnection()  
      protected java.util.stream.Stream<Difference> buildDiff​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash from, org.projectnessie.versioned.Hash to, KeyFilterPredicate keyFilter)
      Compute the diff between two references.
      protected CommitLogEntry buildIndividualCommit​(OP_CONTEXT ctx, long timeInMicros, java.util.List<org.projectnessie.versioned.Hash> parentHashes, long commitSeq, org.projectnessie.nessie.relocated.protobuf.ByteString commitMeta, java.lang.Iterable<KeyWithBytes> puts, java.util.Set<org.projectnessie.model.ContentKey> deletes, int currentKeyListDistance, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits, java.lang.Iterable<org.projectnessie.versioned.Hash> additionalParents)
      Builds a CommitLogEntry using the given values.
      protected CommitLogEntry buildKeyList​(OP_CONTEXT ctx, CommitLogEntry unwrittenEntry, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
      Adds a complete key-list to the given CommitLogEntry, will read from the database.
      protected AbstractDatabaseAdapter.ConflictingKeyCheckResult checkConflictingKeysForCommit​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash upToCommitIncluding, org.projectnessie.versioned.Hash sinceCommitExcluding, java.util.Set<org.projectnessie.model.ContentKey> keys, java.util.function.Consumer<java.lang.String> mismatches)
      Check whether the commits in the range sinceCommitExcluding] .. [upToCommitIncluding contain any of the given ContentKeys.
      protected void checkExpectedGlobalStates​(OP_CONTEXT ctx, CommitParams commitParams, java.util.function.Consumer<java.lang.String> mismatches)
      Verifies that the current global-states match the expectedStates, produces human readable messages for the violations.
      protected CommitLogEntry checkForModifiedKeysBetweenExpectedAndCurrentCommit​(OP_CONTEXT ctx, CommitParams commitParams, org.projectnessie.versioned.Hash branchHead, java.util.List<java.lang.String> mismatches)
      If the current HEAD of the target branch for a commit/transplant/merge is not equal to the expected/reference HEAD, verify that there is no conflict, like keys in the operations of the commit(s) contained in keys of the commits 'expectedHead (excluding) ..
      protected CommitLogEntry commitAttempt​(OP_CONTEXT ctx, long timeInMicros, org.projectnessie.versioned.Hash branchHead, CommitParams commitParams, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists)
      Logic implementation of a commit-attempt.
      protected org.projectnessie.versioned.Hash copyCommits​(OP_CONTEXT ctx, long timeInMicros, org.projectnessie.versioned.Hash targetHead, java.util.List<CommitLogEntry> commitsChronological, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, org.projectnessie.versioned.MetadataRewriter<org.projectnessie.nessie.relocated.protobuf.ByteString> rewriteMetadata, java.util.function.Predicate<org.projectnessie.model.ContentKey> includeKeyPredicate, java.util.function.Consumer<CommitLogEntry> addedCommits)
      For merge/transplant, applies the given commits onto the target-hash.
      protected abstract CommitLogEntry doFetchFromCommitLog​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash)  
      protected abstract java.util.Map<ContentId,​org.projectnessie.nessie.relocated.protobuf.ByteString> doFetchGlobalStates​(OP_CONTEXT ctx, java.util.Set<ContentId> contentIds)  
      protected abstract java.util.stream.Stream<KeyListEntity> doFetchKeyLists​(OP_CONTEXT ctx, java.util.List<org.projectnessie.versioned.Hash> keyListsIds)  
      protected abstract java.util.List<CommitLogEntry> doFetchMultipleFromCommitLog​(OP_CONTEXT ctx, java.util.List<org.projectnessie.versioned.Hash> hashes)  
      protected abstract java.util.stream.Stream<CommitLogEntry> doScanAllCommitLogEntries​(OP_CONTEXT c)  
      protected abstract void doUpdateMultipleCommits​(OP_CONTEXT ctx, java.util.List<CommitLogEntry> entries)  
      protected abstract void doWriteIndividualCommit​(OP_CONTEXT ctx, CommitLogEntry entry)  
      protected abstract void doWriteKeyListEntities​(OP_CONTEXT ctx, java.util.List<KeyListEntity> newKeyListEntities)  
      protected abstract void doWriteMultipleCommits​(OP_CONTEXT ctx, java.util.List<CommitLogEntry> entries)  
      protected abstract int entitySize​(CommitLogEntry entry)
      Calculate the expected size of the given CommitLogEntry in the database (in bytes).
      protected abstract int entitySize​(KeyListEntry entry)
      Calculate the expected size of the given CommitLogEntry in the database (in bytes).
      java.util.stream.Stream<CommitLogEntry> fetchCommitLogEntries​(java.util.stream.Stream<org.projectnessie.versioned.Hash> hashes)
      Loads commit log entries.
      CommitLogEntry fetchFromCommitLog​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash)
      Load the commit-log entry for the given hash, return null, if not found.
      protected java.util.Map<ContentId,​org.projectnessie.nessie.relocated.protobuf.ByteString> fetchGlobalStates​(OP_CONTEXT ctx, java.util.Set<ContentId> contentIds)
      Fetches the global-state information for the given content-ids.
      java.util.stream.Stream<KeyListEntity> fetchKeyLists​(OP_CONTEXT ctx, java.util.List<org.projectnessie.versioned.Hash> keyListsIds)  
      protected java.util.Map<org.projectnessie.model.ContentKey,​ContentAndState> fetchValues​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash refHead, java.util.Collection<org.projectnessie.model.ContentKey> keys, KeyFilterPredicate keyFilter)
      Fetch the global-state and per-ref content for the given ContentKeys and commitSha.
      protected org.projectnessie.versioned.Hash findCommonAncestor​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash from, org.projectnessie.versioned.NamedRef toBranch, org.projectnessie.versioned.Hash toHead)
      Finds the common-ancestor of two commit-log-entries.
      protected <R> R findCommonAncestor​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash from, AbstractDatabaseAdapter.CommonAncestorState state, java.util.function.BiFunction<java.lang.Integer,​org.projectnessie.versioned.Hash,​R> result)  
      CONFIG getConfig()  
      AdapterEventConsumer getEventConsumer()  
      protected org.projectnessie.versioned.Hash hashOnRef​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash knownHead, org.projectnessie.versioned.NamedRef ref, java.util.Optional<org.projectnessie.versioned.Hash> hashOnRef, java.util.function.Consumer<CommitLogEntry> commitLogVisitor)
      Ensures that ref exists and that the hash in hashOnRef exists in that reference.
      protected org.projectnessie.versioned.Hash hashOnRef​(OP_CONTEXT ctx, org.projectnessie.versioned.NamedRef reference, java.util.Optional<org.projectnessie.versioned.Hash> hashOnRef, org.projectnessie.versioned.Hash knownHead)
      protected boolean hasKeyCollisions​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash refHead, java.util.Set<org.projectnessie.model.ContentKey> keysTouchedOnTarget, java.util.List<CommitLogEntry> commitsChronological, java.util.function.Function<org.projectnessie.model.ContentKey,​org.projectnessie.versioned.ImmutableKeyDetails.Builder> keyDetails)
      For merge/transplant, verifies that the given commits do not touch any of the given keys.
      protected org.projectnessie.versioned.Hash individualCommitHash​(java.util.List<org.projectnessie.versioned.Hash> parentHashes, org.projectnessie.nessie.relocated.protobuf.ByteString commitMeta, java.lang.Iterable<KeyWithBytes> puts, java.lang.Iterable<org.projectnessie.model.ContentKey> deletes)
      Calculate the hash for the content of a CommitLogEntry.
      protected java.util.stream.Stream<KeyListEntry> keysForCommitEntry​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash, KeyFilterPredicate keyFilter)
      Retrieve the content-keys and their types for the commit-log-entry with the given hash.
      protected java.util.stream.Stream<KeyListEntry> keysForCommitEntry​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash, KeyFilterPredicate keyFilter, java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
      Retrieve the content-keys and their types for the commit-log-entry with the given hash.
      protected <T> java.util.Spliterator<T> logFetcher​(OP_CONTEXT ctx, T initial, java.util.function.BiFunction<OP_CONTEXT,​java.util.List<org.projectnessie.versioned.Hash>,​java.util.List<T>> fetcher, java.util.function.Function<T,​java.util.List<org.projectnessie.versioned.Hash>> nextPage)
      Constructs a Stream of entries for either the global-state-log or a commit-log or a reflog entry.
      protected <T> java.util.Spliterator<T> logFetcherWithPage​(OP_CONTEXT ctx, java.util.List<org.projectnessie.versioned.Hash> initialPage, java.util.function.BiFunction<OP_CONTEXT,​java.util.List<org.projectnessie.versioned.Hash>,​java.util.List<T>> fetcher, java.util.function.Function<T,​java.util.List<org.projectnessie.versioned.Hash>> nextPage)  
      protected int maxEntitySize​(int value)  
      protected org.projectnessie.versioned.Hash mergeAttempt​(OP_CONTEXT ctx, long timeInMicros, org.projectnessie.versioned.Hash toHead, java.util.function.Consumer<org.projectnessie.versioned.Hash> branchCommits, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, java.util.function.Consumer<CommitLogEntry> writtenCommits, java.util.function.Consumer<CommitLogEntry> addedCommits, MergeParams mergeParams, org.projectnessie.versioned.ImmutableMergeResult.Builder<CommitLogEntry> mergeResult)
      Logic implementation of a merge-attempt.
      protected org.projectnessie.versioned.Hash mergeTransplantCommon​(OP_CONTEXT ctx, long timeInMicros, org.projectnessie.versioned.Hash toHead, java.util.function.Consumer<org.projectnessie.versioned.Hash> branchCommits, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, java.util.List<CommitLogEntry> commitsToMergeChronological, java.util.List<CommitLogEntry> toEntriesReverseChronological, MetadataRewriteParams params, org.projectnessie.versioned.ImmutableMergeResult.Builder<CommitLogEntry> mergeResult, java.util.function.Consumer<CommitLogEntry> writtenCommits, java.util.function.Consumer<CommitLogEntry> addedCommits, java.util.List<org.projectnessie.versioned.Hash> additionalParents)  
      protected java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedReferenceWithCommitMeta​(OP_CONTEXT ctx, org.projectnessie.versioned.GetNamedRefsParams params, java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs)
      Returns an updated ReferenceInfo with the commit-meta of the reference's HEAD commit.
      protected static boolean namedRefsAnyRetrieves​(org.projectnessie.versioned.GetNamedRefsParams params)  
      protected java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedRefsFilterAndEnhance​(OP_CONTEXT ctx, org.projectnessie.versioned.GetNamedRefsParams params, org.projectnessie.versioned.Hash defaultBranchHead, java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs)
      Common functionality to filter and enhance based on the given GetNamedRefsParams.
      protected static java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedRefsMaybeFilter​(org.projectnessie.versioned.GetNamedRefsParams params, java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs)
      Applies the reference type filter (tags or branches) to the Java stream.
      protected static boolean namedRefsRequiresBaseReference​(org.projectnessie.versioned.GetNamedRefsParams params)  
      protected static boolean namedRefsRequiresBaseReference​(org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions retrieveOptions)  
      protected static org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions namedRefsRetrieveOptionsForReference​(org.projectnessie.versioned.GetNamedRefsParams params, org.projectnessie.versioned.NamedRef ref)  
      protected static org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions namedRefsRetrieveOptionsForReference​(org.projectnessie.versioned.GetNamedRefsParams params, org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString> ref)  
      protected java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedRefsWithDefaultBranchRelatedInfo​(OP_CONTEXT ctx, org.projectnessie.versioned.GetNamedRefsParams params, java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs, org.projectnessie.versioned.Hash defaultBranchHead)
      If necessary based on the given GetNamedRefsParams, updates the returned ReferenceInfos with the common-ancestor of the named reference and the default branch and the number of commits behind/ahead compared to the default branch.
      org.projectnessie.versioned.Hash noAncestorHash()
      Get the Hash for "beginning of time".
      protected java.util.Spliterator<CommitLogEntry> readCommitLog​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash initialHash, java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)  
      protected java.util.Spliterator<org.projectnessie.versioned.Hash> readCommitLogHashes​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash initialHash)  
      protected java.util.stream.Stream<org.projectnessie.versioned.Hash> readCommitLogHashesStream​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash initialHash)
      Like readCommitLogStream(AutoCloseable, Hash), but only returns the commit-log-entry hashes, which can be taken from CommitLogEntry.getParents(), thus no need to perform a read-operation against every hash.
      protected java.util.stream.Stream<CommitLogEntry> readCommitLogStream​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash initialHash)
      Reads from the commit-log starting at the given commit-log-hash.
      protected java.util.stream.Stream<CommitLogEntry> readCommitLogStream​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash initialHash, java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)  
      CommitLogEntry rebuildKeyList​(CommitLogEntry entry, java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
      Populates the aggregated key-list for the given entry and returns it.
      protected void repositoryEvent​(java.util.function.Supplier<? extends AdapterEvent.Builder<?,​?>> eventBuilder)  
      java.util.stream.Stream<CommitLogEntry> scanAllCommitLogEntries()
      Scan all commit log entries, no guarantees about order nor about the behavior when commits happen while the returned Stream is consumed.
      protected CommitLogEntry squashCommits​(OP_CONTEXT ctx, long timeInMicros, org.projectnessie.versioned.Hash toHead, java.util.List<CommitLogEntry> commitsToMergeChronological, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, org.projectnessie.versioned.MetadataRewriter<org.projectnessie.nessie.relocated.protobuf.ByteString> rewriteMetadata, java.util.function.Predicate<org.projectnessie.model.ContentKey> includeKeyPredicate, java.lang.Iterable<org.projectnessie.versioned.Hash> additionalParents, java.util.function.Consumer<CommitLogEntry> addedCommits)
      For merge/transplant, applies one squashed commit derived from the given commits onto the target-hash.
      protected org.projectnessie.versioned.Hash transplantAttempt​(OP_CONTEXT ctx, long timeInMicros, org.projectnessie.versioned.Hash targetHead, java.util.function.Consumer<org.projectnessie.versioned.Hash> branchCommits, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, java.util.function.Consumer<CommitLogEntry> writtenCommits, java.util.function.Consumer<CommitLogEntry> addedCommits, TransplantParams transplantParams, org.projectnessie.versioned.ImmutableMergeResult.Builder<CommitLogEntry> mergeResult)
      Logic implementation of a transplant-attempt.
      protected void tryLoopStateCompletion​(java.lang.Boolean success, TryLoopState state)  
      protected void validateHashExists​(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash)  
      protected void writeIndividualCommit​(OP_CONTEXT ctx, CommitLogEntry entry)
      Write a new commit-entry, the given commit entry is to be persisted as is.
      void writeKeyListEntities​(OP_CONTEXT ctx, java.util.List<KeyListEntity> newKeyListEntities)  
      protected void writeMultipleCommits​(OP_CONTEXT ctx, java.util.List<CommitLogEntry> entries)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STORE_WORKER

        protected static final org.projectnessie.versioned.StoreWorker STORE_WORKER
      • NO_ANCESTOR

        public static final org.projectnessie.versioned.Hash NO_ANCESTOR
      • COMMIT_LOG_HASH_SEED

        protected static long COMMIT_LOG_HASH_SEED
    • Method Detail

      • borrowConnection

        public abstract OP_CONTEXT borrowConnection()
      • noAncestorHash

        public org.projectnessie.versioned.Hash noAncestorHash()
        Description copied from interface: DatabaseAdapter
        Get the Hash for "beginning of time".
        Specified by:
        noAncestorHash in interface DatabaseAdapter
      • rebuildKeyList

        public CommitLogEntry rebuildKeyList​(CommitLogEntry entry,
                                             @Nonnull @Nonnull
                                             java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
                                      throws org.projectnessie.versioned.ReferenceNotFoundException
        Description copied from interface: DatabaseAdapter
        Populates the aggregated key-list for the given entry and returns it.
        Specified by:
        rebuildKeyList in interface DatabaseAdapter
        Parameters:
        entry - the CommitLogEntry to build the aggregated key list for
        inMemoryCommits - function to retrieve not-yet-written commit-log-entries
        Returns:
        commit-log-entry with the aggregated key-list. The returned CommitLogEntry has not been persisted.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • commitAttempt

        protected CommitLogEntry commitAttempt​(OP_CONTEXT ctx,
                                               long timeInMicros,
                                               org.projectnessie.versioned.Hash branchHead,
                                               CommitParams commitParams,
                                               java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists)
                                        throws org.projectnessie.versioned.ReferenceNotFoundException,
                                               org.projectnessie.versioned.ReferenceConflictException
        Logic implementation of a commit-attempt.
        Parameters:
        ctx - technical operation-context
        commitParams - commit parameters
        branchHead - current HEAD of branch
        newKeyLists - consumer for optimistically written KeyListEntitys
        Returns:
        optimistically written commit-log-entry
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
        org.projectnessie.versioned.ReferenceConflictException
      • mergeAttempt

        protected org.projectnessie.versioned.Hash mergeAttempt​(OP_CONTEXT ctx,
                                                                long timeInMicros,
                                                                org.projectnessie.versioned.Hash toHead,
                                                                java.util.function.Consumer<org.projectnessie.versioned.Hash> branchCommits,
                                                                java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists,
                                                                java.util.function.Consumer<CommitLogEntry> writtenCommits,
                                                                java.util.function.Consumer<CommitLogEntry> addedCommits,
                                                                MergeParams mergeParams,
                                                                org.projectnessie.versioned.ImmutableMergeResult.Builder<CommitLogEntry> mergeResult)
                                                         throws org.projectnessie.versioned.ReferenceNotFoundException,
                                                                org.projectnessie.versioned.ReferenceConflictException
        Logic implementation of a merge-attempt.
        Parameters:
        ctx - technical operation context
        toHead - current HEAD of toBranch
        branchCommits - consumer for the individual commits to merge
        newKeyLists - consumer for optimistically written KeyListEntitys
        Returns:
        hash of the last commit-log-entry written to toBranch
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
        org.projectnessie.versioned.ReferenceConflictException
      • transplantAttempt

        protected org.projectnessie.versioned.Hash transplantAttempt​(OP_CONTEXT ctx,
                                                                     long timeInMicros,
                                                                     org.projectnessie.versioned.Hash targetHead,
                                                                     java.util.function.Consumer<org.projectnessie.versioned.Hash> branchCommits,
                                                                     java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists,
                                                                     java.util.function.Consumer<CommitLogEntry> writtenCommits,
                                                                     java.util.function.Consumer<CommitLogEntry> addedCommits,
                                                                     TransplantParams transplantParams,
                                                                     org.projectnessie.versioned.ImmutableMergeResult.Builder<CommitLogEntry> mergeResult)
                                                              throws org.projectnessie.versioned.ReferenceNotFoundException,
                                                                     org.projectnessie.versioned.ReferenceConflictException
        Logic implementation of a transplant-attempt.
        Parameters:
        ctx - technical operation context
        targetHead - current HEAD of targetBranch
        branchCommits - consumer for the individual commits to merge
        newKeyLists - consumer for optimistically written KeyListEntitys
        Returns:
        hash of the last commit-log-entry written to targetBranch
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
        org.projectnessie.versioned.ReferenceConflictException
      • mergeTransplantCommon

        protected org.projectnessie.versioned.Hash mergeTransplantCommon​(OP_CONTEXT ctx,
                                                                         long timeInMicros,
                                                                         org.projectnessie.versioned.Hash toHead,
                                                                         java.util.function.Consumer<org.projectnessie.versioned.Hash> branchCommits,
                                                                         java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists,
                                                                         java.util.List<CommitLogEntry> commitsToMergeChronological,
                                                                         java.util.List<CommitLogEntry> toEntriesReverseChronological,
                                                                         MetadataRewriteParams params,
                                                                         org.projectnessie.versioned.ImmutableMergeResult.Builder<CommitLogEntry> mergeResult,
                                                                         java.util.function.Consumer<CommitLogEntry> writtenCommits,
                                                                         java.util.function.Consumer<CommitLogEntry> addedCommits,
                                                                         java.util.List<org.projectnessie.versioned.Hash> additionalParents)
                                                                  throws org.projectnessie.versioned.ReferenceConflictException,
                                                                         org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceConflictException
        org.projectnessie.versioned.ReferenceNotFoundException
      • buildDiff

        @MustBeClosed
        protected java.util.stream.Stream<Difference> buildDiff​(OP_CONTEXT ctx,
                                                                org.projectnessie.versioned.Hash from,
                                                                org.projectnessie.versioned.Hash to,
                                                                KeyFilterPredicate keyFilter)
                                                         throws org.projectnessie.versioned.ReferenceNotFoundException
        Compute the diff between two references.
        Parameters:
        ctx - technical operation context
        from - "from" reference to compute the difference from, appears on the "from" side in Diff with hash in from to compute the diff for, must exist in from
        to - "to" reference to compute the difference from, appears on the "to" side in Diff with hash in to to compute the diff for, must exist in to
        keyFilter - optional filter on key + content-id + content-type
        Returns:
        computed difference
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • namedRefsFilterAndEnhance

        @MustBeClosed
        protected java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedRefsFilterAndEnhance​(OP_CONTEXT ctx,
                                                                                                                                                                       org.projectnessie.versioned.GetNamedRefsParams params,
                                                                                                                                                                       org.projectnessie.versioned.Hash defaultBranchHead,
                                                                                                                                                                       java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs)
        Common functionality to filter and enhance based on the given GetNamedRefsParams.
        Parameters:
        ctx - database-adapter context
        params - defines which kind of references and which additional information shall be retrieved
        defaultBranchHead - prerequisite, the hash of the default branch's HEAD commit (depending on the database-adapter implementation). If null, namedRefsWithDefaultBranchRelatedInfo(AutoCloseable, GetNamedRefsParams, Stream, Hash) will not add additional default-branch related information (common ancestor and commits behind/ahead).
        refs - current Stream of ReferenceInfo to be enhanced.
        Returns:
        filtered/enhanced stream based on refs.
      • namedRefsMaybeFilter

        protected static java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedRefsMaybeFilter​(org.projectnessie.versioned.GetNamedRefsParams params,
                                                                                                                                                                         java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs)
        Applies the reference type filter (tags or branches) to the Java stream.
      • namedRefsRequiresBaseReference

        protected static boolean namedRefsRequiresBaseReference​(org.projectnessie.versioned.GetNamedRefsParams params)
      • namedRefsRequiresBaseReference

        protected static boolean namedRefsRequiresBaseReference​(org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions retrieveOptions)
      • namedRefsAnyRetrieves

        protected static boolean namedRefsAnyRetrieves​(org.projectnessie.versioned.GetNamedRefsParams params)
      • namedRefsRetrieveOptionsForReference

        protected static org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions namedRefsRetrieveOptionsForReference​(org.projectnessie.versioned.GetNamedRefsParams params,
                                                                                                                             org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString> ref)
      • namedRefsRetrieveOptionsForReference

        protected static org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions namedRefsRetrieveOptionsForReference​(org.projectnessie.versioned.GetNamedRefsParams params,
                                                                                                                             org.projectnessie.versioned.NamedRef ref)
      • namedReferenceWithCommitMeta

        @MustBeClosed
        protected java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedReferenceWithCommitMeta​(OP_CONTEXT ctx,
                                                                                                                                                                          org.projectnessie.versioned.GetNamedRefsParams params,
                                                                                                                                                                          java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs)
        Returns an updated ReferenceInfo with the commit-meta of the reference's HEAD commit.
      • namedRefsWithDefaultBranchRelatedInfo

        @MustBeClosed
        protected java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> namedRefsWithDefaultBranchRelatedInfo​(OP_CONTEXT ctx,
                                                                                                                                                                                   org.projectnessie.versioned.GetNamedRefsParams params,
                                                                                                                                                                                   java.util.stream.Stream<org.projectnessie.versioned.ReferenceInfo<org.projectnessie.nessie.relocated.protobuf.ByteString>> refs,
                                                                                                                                                                                   org.projectnessie.versioned.Hash defaultBranchHead)
        If necessary based on the given GetNamedRefsParams, updates the returned ReferenceInfos with the common-ancestor of the named reference and the default branch and the number of commits behind/ahead compared to the default branch.

        The common ancestor and/or information of commits behind/ahead is meaningless (null) for the default branch. Both fields are also null if the named reference points to the noAncestorHash() (beginning of time).

      • hashOnRef

        protected org.projectnessie.versioned.Hash hashOnRef​(OP_CONTEXT ctx,
                                                             org.projectnessie.versioned.NamedRef reference,
                                                             java.util.Optional<org.projectnessie.versioned.Hash> hashOnRef,
                                                             org.projectnessie.versioned.Hash knownHead)
                                                      throws org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • hashOnRef

        protected org.projectnessie.versioned.Hash hashOnRef​(OP_CONTEXT ctx,
                                                             org.projectnessie.versioned.Hash knownHead,
                                                             org.projectnessie.versioned.NamedRef ref,
                                                             java.util.Optional<org.projectnessie.versioned.Hash> hashOnRef,
                                                             java.util.function.Consumer<CommitLogEntry> commitLogVisitor)
                                                      throws org.projectnessie.versioned.ReferenceNotFoundException
        Ensures that ref exists and that the hash in hashOnRef exists in that reference.
        Parameters:
        ctx - technical operation context
        ref - reference that must contain hashOnRef
        knownHead - current HEAD of ref
        hashOnRef - hash to verify whether it exists in ref
        commitLogVisitor - optional consumer that will receive all visited CommitLogEntrys, can be null.
        Returns:
        value of hashOnRef or, if hashOnRef is empty, knownHead
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException - if either ref does not exist or hashOnRef does not exist on ref
      • validateHashExists

        protected void validateHashExists​(OP_CONTEXT ctx,
                                          org.projectnessie.versioned.Hash hash)
                                   throws org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • fetchFromCommitLog

        public final CommitLogEntry fetchFromCommitLog​(OP_CONTEXT ctx,
                                                       org.projectnessie.versioned.Hash hash)
        Load the commit-log entry for the given hash, return null, if not found.
      • doFetchFromCommitLog

        protected abstract CommitLogEntry doFetchFromCommitLog​(OP_CONTEXT ctx,
                                                               org.projectnessie.versioned.Hash hash)
      • scanAllCommitLogEntries

        public java.util.stream.Stream<CommitLogEntry> scanAllCommitLogEntries()
        Description copied from interface: DatabaseAdapter
        Scan all commit log entries, no guarantees about order nor about the behavior when commits happen while the returned Stream is consumed.
        Specified by:
        scanAllCommitLogEntries in interface DatabaseAdapter
      • doScanAllCommitLogEntries

        @MustBeClosed
        protected abstract java.util.stream.Stream<CommitLogEntry> doScanAllCommitLogEntries​(OP_CONTEXT c)
      • doFetchMultipleFromCommitLog

        protected abstract java.util.List<CommitLogEntry> doFetchMultipleFromCommitLog​(OP_CONTEXT ctx,
                                                                                       java.util.List<org.projectnessie.versioned.Hash> hashes)
      • readCommitLogStream

        @MustBeClosed
        protected java.util.stream.Stream<CommitLogEntry> readCommitLogStream​(OP_CONTEXT ctx,
                                                                              org.projectnessie.versioned.Hash initialHash)
                                                                       throws org.projectnessie.versioned.ReferenceNotFoundException
        Reads from the commit-log starting at the given commit-log-hash.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • readCommitLogStream

        @MustBeClosed
        protected java.util.stream.Stream<CommitLogEntry> readCommitLogStream​(OP_CONTEXT ctx,
                                                                              org.projectnessie.versioned.Hash initialHash,
                                                                              @Nonnull @Nonnull
                                                                              java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
                                                                       throws org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • readCommitLog

        protected java.util.Spliterator<CommitLogEntry> readCommitLog​(OP_CONTEXT ctx,
                                                                      org.projectnessie.versioned.Hash initialHash,
                                                                      @Nonnull @Nonnull
                                                                      java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
                                                               throws org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • readCommitLogHashesStream

        @MustBeClosed
        protected java.util.stream.Stream<org.projectnessie.versioned.Hash> readCommitLogHashesStream​(OP_CONTEXT ctx,
                                                                                                      org.projectnessie.versioned.Hash initialHash)
        Like readCommitLogStream(AutoCloseable, Hash), but only returns the commit-log-entry hashes, which can be taken from CommitLogEntry.getParents(), thus no need to perform a read-operation against every hash.
      • readCommitLogHashes

        protected java.util.Spliterator<org.projectnessie.versioned.Hash> readCommitLogHashes​(OP_CONTEXT ctx,
                                                                                              org.projectnessie.versioned.Hash initialHash)
      • logFetcher

        protected <T> java.util.Spliterator<T> logFetcher​(OP_CONTEXT ctx,
                                                          T initial,
                                                          java.util.function.BiFunction<OP_CONTEXT,​java.util.List<org.projectnessie.versioned.Hash>,​java.util.List<T>> fetcher,
                                                          java.util.function.Function<T,​java.util.List<org.projectnessie.versioned.Hash>> nextPage)
        Constructs a Stream of entries for either the global-state-log or a commit-log or a reflog entry. Use readCommitLogStream(AutoCloseable, Hash) or the similar implementation for the global-log or reflog entry for non-transactional adapters.
      • logFetcherWithPage

        protected <T> java.util.Spliterator<T> logFetcherWithPage​(OP_CONTEXT ctx,
                                                                  java.util.List<org.projectnessie.versioned.Hash> initialPage,
                                                                  java.util.function.BiFunction<OP_CONTEXT,​java.util.List<org.projectnessie.versioned.Hash>,​java.util.List<T>> fetcher,
                                                                  java.util.function.Function<T,​java.util.List<org.projectnessie.versioned.Hash>> nextPage)
      • buildIndividualCommit

        protected CommitLogEntry buildIndividualCommit​(OP_CONTEXT ctx,
                                                       long timeInMicros,
                                                       java.util.List<org.projectnessie.versioned.Hash> parentHashes,
                                                       long commitSeq,
                                                       org.projectnessie.nessie.relocated.protobuf.ByteString commitMeta,
                                                       java.lang.Iterable<KeyWithBytes> puts,
                                                       java.util.Set<org.projectnessie.model.ContentKey> deletes,
                                                       int currentKeyListDistance,
                                                       java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists,
                                                       @Nonnull @Nonnull
                                                       java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits,
                                                       java.lang.Iterable<org.projectnessie.versioned.Hash> additionalParents)
                                                throws org.projectnessie.versioned.ReferenceNotFoundException,
                                                       org.projectnessie.versioned.ReferenceConflictException
        Builds a CommitLogEntry using the given values. This function also includes a KeyList, if triggered by the values of currentKeyListDistance and DatabaseAdapterConfig.getKeyListDistance(), so read operations may happen.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
        org.projectnessie.versioned.ReferenceConflictException
      • individualCommitHash

        protected org.projectnessie.versioned.Hash individualCommitHash​(java.util.List<org.projectnessie.versioned.Hash> parentHashes,
                                                                        org.projectnessie.nessie.relocated.protobuf.ByteString commitMeta,
                                                                        java.lang.Iterable<KeyWithBytes> puts,
                                                                        java.lang.Iterable<org.projectnessie.model.ContentKey> deletes)
        Calculate the hash for the content of a CommitLogEntry.
      • maxEntitySize

        protected int maxEntitySize​(int value)
      • entitySize

        protected abstract int entitySize​(CommitLogEntry entry)
        Calculate the expected size of the given CommitLogEntry in the database (in bytes).
      • entitySize

        protected abstract int entitySize​(KeyListEntry entry)
        Calculate the expected size of the given CommitLogEntry in the database (in bytes).
      • checkForModifiedKeysBetweenExpectedAndCurrentCommit

        protected CommitLogEntry checkForModifiedKeysBetweenExpectedAndCurrentCommit​(OP_CONTEXT ctx,
                                                                                     CommitParams commitParams,
                                                                                     org.projectnessie.versioned.Hash branchHead,
                                                                                     java.util.List<java.lang.String> mismatches)
                                                                              throws org.projectnessie.versioned.ReferenceNotFoundException
        If the current HEAD of the target branch for a commit/transplant/merge is not equal to the expected/reference HEAD, verify that there is no conflict, like keys in the operations of the commit(s) contained in keys of the commits 'expectedHead (excluding) .. currentHead (including)'.
        Returns:
        commit log entry at branchHead
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • keysForCommitEntry

        @MustBeClosed
        protected java.util.stream.Stream<KeyListEntry> keysForCommitEntry​(OP_CONTEXT ctx,
                                                                           org.projectnessie.versioned.Hash hash,
                                                                           KeyFilterPredicate keyFilter)
                                                                    throws org.projectnessie.versioned.ReferenceNotFoundException
        Retrieve the content-keys and their types for the commit-log-entry with the given hash.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • keysForCommitEntry

        @MustBeClosed
        protected java.util.stream.Stream<KeyListEntry> keysForCommitEntry​(OP_CONTEXT ctx,
                                                                           org.projectnessie.versioned.Hash hash,
                                                                           KeyFilterPredicate keyFilter,
                                                                           @Nonnull @Nonnull
                                                                           java.util.function.Function<org.projectnessie.versioned.Hash,​CommitLogEntry> inMemoryCommits)
                                                                    throws org.projectnessie.versioned.ReferenceNotFoundException
        Retrieve the content-keys and their types for the commit-log-entry with the given hash.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • fetchValues

        protected java.util.Map<org.projectnessie.model.ContentKey,​ContentAndState> fetchValues​(OP_CONTEXT ctx,
                                                                                                      org.projectnessie.versioned.Hash refHead,
                                                                                                      java.util.Collection<org.projectnessie.model.ContentKey> keys,
                                                                                                      KeyFilterPredicate keyFilter)
                                                                                               throws org.projectnessie.versioned.ReferenceNotFoundException
        Fetch the global-state and per-ref content for the given ContentKeys and commitSha. Non-existing keys must not be present in the returned map.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • fetchGlobalStates

        protected final java.util.Map<ContentId,​org.projectnessie.nessie.relocated.protobuf.ByteString> fetchGlobalStates​(OP_CONTEXT ctx,
                                                                                                                                java.util.Set<ContentId> contentIds)
                                                                                                                         throws org.projectnessie.versioned.ReferenceNotFoundException
        Fetches the global-state information for the given content-ids.
        Parameters:
        ctx - technical context
        contentIds - the content-ids to fetch
        Returns:
        map of content-id to state
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • doFetchGlobalStates

        protected abstract java.util.Map<ContentId,​org.projectnessie.nessie.relocated.protobuf.ByteString> doFetchGlobalStates​(OP_CONTEXT ctx,
                                                                                                                                     java.util.Set<ContentId> contentIds)
                                                                                                                              throws org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • fetchKeyLists

        @MustBeClosed
        public final java.util.stream.Stream<KeyListEntity> fetchKeyLists​(OP_CONTEXT ctx,
                                                                          java.util.List<org.projectnessie.versioned.Hash> keyListsIds)
      • doFetchKeyLists

        @MustBeClosed
        protected abstract java.util.stream.Stream<KeyListEntity> doFetchKeyLists​(OP_CONTEXT ctx,
                                                                                  java.util.List<org.projectnessie.versioned.Hash> keyListsIds)
      • writeIndividualCommit

        protected final void writeIndividualCommit​(OP_CONTEXT ctx,
                                                   CommitLogEntry entry)
                                            throws org.projectnessie.versioned.ReferenceConflictException
        Write a new commit-entry, the given commit entry is to be persisted as is. All values of the given CommitLogEntry can be considered valid and consistent.

        Implementations however can enforce strict consistency checks/guarantees, like a best-effort approach to prevent hash-collisions but without any other consistency checks/guarantees.

        Throws:
        org.projectnessie.versioned.ReferenceConflictException
      • doWriteIndividualCommit

        protected abstract void doWriteIndividualCommit​(OP_CONTEXT ctx,
                                                        CommitLogEntry entry)
                                                 throws org.projectnessie.versioned.ReferenceConflictException
        Throws:
        org.projectnessie.versioned.ReferenceConflictException
      • writeMultipleCommits

        protected final void writeMultipleCommits​(OP_CONTEXT ctx,
                                                  java.util.List<CommitLogEntry> entries)
                                           throws org.projectnessie.versioned.ReferenceConflictException
        Throws:
        org.projectnessie.versioned.ReferenceConflictException
      • doWriteMultipleCommits

        protected abstract void doWriteMultipleCommits​(OP_CONTEXT ctx,
                                                       java.util.List<CommitLogEntry> entries)
                                                throws org.projectnessie.versioned.ReferenceConflictException
        Throws:
        org.projectnessie.versioned.ReferenceConflictException
      • doUpdateMultipleCommits

        protected abstract void doUpdateMultipleCommits​(OP_CONTEXT ctx,
                                                        java.util.List<CommitLogEntry> entries)
                                                 throws org.projectnessie.versioned.ReferenceNotFoundException
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • writeKeyListEntities

        public final void writeKeyListEntities​(OP_CONTEXT ctx,
                                               java.util.List<KeyListEntity> newKeyListEntities)
      • doWriteKeyListEntities

        protected abstract void doWriteKeyListEntities​(OP_CONTEXT ctx,
                                                       java.util.List<KeyListEntity> newKeyListEntities)
      • checkConflictingKeysForCommit

        protected AbstractDatabaseAdapter.ConflictingKeyCheckResult checkConflictingKeysForCommit​(OP_CONTEXT ctx,
                                                                                                  org.projectnessie.versioned.Hash upToCommitIncluding,
                                                                                                  org.projectnessie.versioned.Hash sinceCommitExcluding,
                                                                                                  java.util.Set<org.projectnessie.model.ContentKey> keys,
                                                                                                  java.util.function.Consumer<java.lang.String> mismatches)
                                                                                           throws org.projectnessie.versioned.ReferenceNotFoundException
        Check whether the commits in the range sinceCommitExcluding] .. [upToCommitIncluding contain any of the given ContentKeys.

        Conflicts are reported via mismatches.

        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • findCommonAncestor

        protected org.projectnessie.versioned.Hash findCommonAncestor​(OP_CONTEXT ctx,
                                                                      org.projectnessie.versioned.Hash from,
                                                                      org.projectnessie.versioned.NamedRef toBranch,
                                                                      org.projectnessie.versioned.Hash toHead)
                                                               throws org.projectnessie.versioned.ReferenceConflictException
        Finds the common-ancestor of two commit-log-entries. If no common-ancestor is found, throws a ReferenceConflictException or. Otherwise, this method returns the hash of the common-ancestor.
        Throws:
        org.projectnessie.versioned.ReferenceConflictException
      • findCommonAncestor

        protected <R> R findCommonAncestor​(OP_CONTEXT ctx,
                                           org.projectnessie.versioned.Hash from,
                                           AbstractDatabaseAdapter.CommonAncestorState state,
                                           java.util.function.BiFunction<java.lang.Integer,​org.projectnessie.versioned.Hash,​R> result)
      • hasKeyCollisions

        protected boolean hasKeyCollisions​(OP_CONTEXT ctx,
                                           org.projectnessie.versioned.Hash refHead,
                                           java.util.Set<org.projectnessie.model.ContentKey> keysTouchedOnTarget,
                                           java.util.List<CommitLogEntry> commitsChronological,
                                           java.util.function.Function<org.projectnessie.model.ContentKey,​org.projectnessie.versioned.ImmutableKeyDetails.Builder> keyDetails)
                                    throws org.projectnessie.versioned.ReferenceNotFoundException
        For merge/transplant, verifies that the given commits do not touch any of the given keys.
        Parameters:
        commitsChronological - list of commit-log-entries, in order of commit-operations, chronological order
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • squashCommits

        protected CommitLogEntry squashCommits​(OP_CONTEXT ctx,
                                               long timeInMicros,
                                               org.projectnessie.versioned.Hash toHead,
                                               java.util.List<CommitLogEntry> commitsToMergeChronological,
                                               java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists,
                                               org.projectnessie.versioned.MetadataRewriter<org.projectnessie.nessie.relocated.protobuf.ByteString> rewriteMetadata,
                                               java.util.function.Predicate<org.projectnessie.model.ContentKey> includeKeyPredicate,
                                               java.lang.Iterable<org.projectnessie.versioned.Hash> additionalParents,
                                               java.util.function.Consumer<CommitLogEntry> addedCommits)
                                        throws org.projectnessie.versioned.ReferenceConflictException,
                                               org.projectnessie.versioned.ReferenceNotFoundException
        For merge/transplant, applies one squashed commit derived from the given commits onto the target-hash.
        Throws:
        org.projectnessie.versioned.ReferenceConflictException
        org.projectnessie.versioned.ReferenceNotFoundException
      • copyCommits

        protected org.projectnessie.versioned.Hash copyCommits​(OP_CONTEXT ctx,
                                                               long timeInMicros,
                                                               org.projectnessie.versioned.Hash targetHead,
                                                               java.util.List<CommitLogEntry> commitsChronological,
                                                               java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists,
                                                               org.projectnessie.versioned.MetadataRewriter<org.projectnessie.nessie.relocated.protobuf.ByteString> rewriteMetadata,
                                                               java.util.function.Predicate<org.projectnessie.model.ContentKey> includeKeyPredicate,
                                                               java.util.function.Consumer<CommitLogEntry> addedCommits)
                                                        throws org.projectnessie.versioned.ReferenceNotFoundException,
                                                               org.projectnessie.versioned.ReferenceConflictException
        For merge/transplant, applies the given commits onto the target-hash.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
        org.projectnessie.versioned.ReferenceConflictException
      • checkExpectedGlobalStates

        protected void checkExpectedGlobalStates​(OP_CONTEXT ctx,
                                                 CommitParams commitParams,
                                                 java.util.function.Consumer<java.lang.String> mismatches)
                                          throws org.projectnessie.versioned.ReferenceNotFoundException
        Verifies that the current global-states match the expectedStates, produces human readable messages for the violations.
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
      • tryLoopStateCompletion

        protected void tryLoopStateCompletion​(@Nonnull @Nonnull
                                              java.lang.Boolean success,
                                              TryLoopState state)
      • repositoryEvent

        protected void repositoryEvent​(java.util.function.Supplier<? extends AdapterEvent.Builder<?,​?>> eventBuilder)