Class AbstractDatabaseAdapter<OP_CONTEXT extends java.lang.AutoCloseable,CONFIG extends DatabaseAdapterConfig>
- java.lang.Object
-
- org.projectnessie.versioned.persist.adapter.spi.AbstractDatabaseAdapter<OP_CONTEXT,CONFIG>
-
- Type Parameters:
OP_CONTEXT- context for each operation, so for each operation inDatabaseAdapterthat 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
AbstractDatabaseAdapterimplementations. The recommended way to "inject" such managed resources into short-livedAbstractDatabaseAdapterimplementations is via a special configuration attribute.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractDatabaseAdapter.CommonAncestorStateprotected static classAbstractDatabaseAdapter.ConflictingKeyCheckResult
-
Field Summary
Fields Modifier and Type Field Description protected static longCOMMIT_LOG_HASH_SEEDprotected CONFIGconfigstatic org.projectnessie.versioned.HashNO_ANCESTORprotected static org.projectnessie.versioned.StoreWorkerSTORE_WORKERprotected static java.lang.StringTAG_COUNTprotected static java.lang.StringTAG_HASH
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDatabaseAdapter(CONFIG config, AdapterEventConsumer eventConsumer)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract OP_CONTEXTborrowConnection()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 CommitLogEntrybuildIndividualCommit(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 aCommitLogEntryusing the given values.protected CommitLogEntrybuildKeyList(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 givenCommitLogEntry, will read from the database.protected AbstractDatabaseAdapter.ConflictingKeyCheckResultcheckConflictingKeysForCommit(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 rangesinceCommitExcluding] .. [upToCommitIncludingcontain any of the givenContentKeys.protected voidcheckExpectedGlobalStates(OP_CONTEXT ctx, CommitParams commitParams, java.util.function.Consumer<java.lang.String> mismatches)Verifies that the current global-states match theexpectedStates, produces human readable messages for the violations.protected CommitLogEntrycheckForModifiedKeysBetweenExpectedAndCurrentCommit(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 CommitLogEntrycommitAttempt(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.HashcopyCommits(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 CommitLogEntrydoFetchFromCommitLog(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 voiddoUpdateMultipleCommits(OP_CONTEXT ctx, java.util.List<CommitLogEntry> entries)protected abstract voiddoWriteIndividualCommit(OP_CONTEXT ctx, CommitLogEntry entry)protected abstract voiddoWriteKeyListEntities(OP_CONTEXT ctx, java.util.List<KeyListEntity> newKeyListEntities)protected abstract voiddoWriteMultipleCommits(OP_CONTEXT ctx, java.util.List<CommitLogEntry> entries)protected abstract intentitySize(CommitLogEntry entry)Calculate the expected size of the givenCommitLogEntryin the database (in bytes).protected abstract intentitySize(KeyListEntry entry)Calculate the expected size of the givenCommitLogEntryin the database (in bytes).java.util.stream.Stream<CommitLogEntry>fetchCommitLogEntries(java.util.stream.Stream<org.projectnessie.versioned.Hash> hashes)Loads commit log entries.CommitLogEntryfetchFromCommitLog(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash)Load the commit-log entry for the given hash, returnnull, 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 givenContentKeys andcommitSha.protected org.projectnessie.versioned.HashfindCommonAncestor(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> RfindCommonAncestor(OP_CONTEXT ctx, org.projectnessie.versioned.Hash from, AbstractDatabaseAdapter.CommonAncestorState state, java.util.function.BiFunction<java.lang.Integer,org.projectnessie.versioned.Hash,R> result)CONFIGgetConfig()AdapterEventConsumergetEventConsumer()protected org.projectnessie.versioned.HashhashOnRef(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 thatrefexists and that the hash inhashOnRefexists in that reference.protected org.projectnessie.versioned.HashhashOnRef(OP_CONTEXT ctx, org.projectnessie.versioned.NamedRef reference, java.util.Optional<org.projectnessie.versioned.Hash> hashOnRef, org.projectnessie.versioned.Hash knownHead)protected booleanhasKeyCollisions(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.HashindividualCommitHash(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 aCommitLogEntry.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 aStreamof 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 intmaxEntitySize(int value)protected org.projectnessie.versioned.HashmergeAttempt(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.HashmergeTransplantCommon(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 updatedReferenceInfowith the commit-meta of the reference's HEAD commit.protected static booleannamedRefsAnyRetrieves(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 givenGetNamedRefsParams.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 booleannamedRefsRequiresBaseReference(org.projectnessie.versioned.GetNamedRefsParams params)protected static booleannamedRefsRequiresBaseReference(org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptions retrieveOptions)protected static org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptionsnamedRefsRetrieveOptionsForReference(org.projectnessie.versioned.GetNamedRefsParams params, org.projectnessie.versioned.NamedRef ref)protected static org.projectnessie.versioned.GetNamedRefsParams.RetrieveOptionsnamedRefsRetrieveOptionsForReference(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 givenGetNamedRefsParams, updates the returnedReferenceInfos 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.HashnoAncestorHash()Get theHashfor "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)LikereadCommitLogStream(AutoCloseable, Hash), but only returns thecommit-log-entry hashes, which can be taken fromCommitLogEntry.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)CommitLogEntryrebuildKeyList(CommitLogEntry entry, java.util.function.Function<org.projectnessie.versioned.Hash,CommitLogEntry> inMemoryCommits)Populates the aggregated key-list for the givenentryand returns it.protected voidrepositoryEvent(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 returnedStreamis consumed.protected CommitLogEntrysquashCommits(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.HashtransplantAttempt(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 voidtryLoopStateCompletion(java.lang.Boolean success, TryLoopState state)protected voidvalidateHashExists(OP_CONTEXT ctx, org.projectnessie.versioned.Hash hash)protected voidwriteIndividualCommit(OP_CONTEXT ctx, CommitLogEntry entry)Write a new commit-entry, the given commit entry is to be persisted as is.voidwriteKeyListEntities(OP_CONTEXT ctx, java.util.List<KeyListEntity> newKeyListEntities)protected voidwriteMultipleCommits(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
-
Methods inherited from interface org.projectnessie.versioned.persist.adapter.DatabaseAdapter
assertCleanStateForTests, assign, commit, commitLog, create, delete, diff, eraseRepo, fetchRepositoryDescription, globalContent, hashOnReference, initializeRepo, keys, merge, namedRef, namedRefs, repoMaintenance, transplant, updateMultipleCommits, updateRepositoryDescription, values, writeMultipleCommits
-
-
-
-
Field Detail
-
TAG_HASH
protected static final java.lang.String TAG_HASH
- See Also:
- Constant Field Values
-
TAG_COUNT
protected static final java.lang.String TAG_COUNT
- See Also:
- Constant Field Values
-
config
protected final CONFIG extends DatabaseAdapterConfig config
-
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
-
-
Constructor Detail
-
AbstractDatabaseAdapter
protected AbstractDatabaseAdapter(CONFIG config, AdapterEventConsumer eventConsumer)
-
-
Method Detail
-
getConfig
public CONFIG getConfig()
- Specified by:
getConfigin interfaceDatabaseAdapter
-
getEventConsumer
public AdapterEventConsumer getEventConsumer()
-
borrowConnection
public abstract OP_CONTEXT borrowConnection()
-
noAncestorHash
public org.projectnessie.versioned.Hash noAncestorHash()
Description copied from interface:DatabaseAdapterGet theHashfor "beginning of time".- Specified by:
noAncestorHashin interfaceDatabaseAdapter
-
fetchCommitLogEntries
public java.util.stream.Stream<CommitLogEntry> fetchCommitLogEntries(java.util.stream.Stream<org.projectnessie.versioned.Hash> hashes)
Description copied from interface:DatabaseAdapterLoads commit log entries.- Specified by:
fetchCommitLogEntriesin interfaceDatabaseAdapter- Returns:
- the loaded
CommitLogEntrys, non-existing entries will not be returned.
-
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:DatabaseAdapterPopulates the aggregated key-list for the givenentryand returns it.- Specified by:
rebuildKeyListin interfaceDatabaseAdapter- Parameters:
entry- theCommitLogEntryto build the aggregated key list forinMemoryCommits- function to retrieve not-yet-written commit-log-entries- Returns:
- commit-log-entry with the aggregated key-list. The returned
CommitLogEntryhas 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-contextcommitParams- commit parametersbranchHead- current HEAD ofbranchnewKeyLists- consumer for optimistically writtenKeyListEntitys- Returns:
- optimistically written commit-log-entry
- Throws:
org.projectnessie.versioned.ReferenceNotFoundExceptionorg.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 contexttoHead- current HEAD oftoBranchbranchCommits- consumer for the individual commits to mergenewKeyLists- consumer for optimistically writtenKeyListEntitys- Returns:
- hash of the last commit-log-entry written to
toBranch - Throws:
org.projectnessie.versioned.ReferenceNotFoundExceptionorg.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 contexttargetHead- current HEAD oftargetBranchbranchCommits- consumer for the individual commits to mergenewKeyLists- consumer for optimistically writtenKeyListEntitys- Returns:
- hash of the last commit-log-entry written to
targetBranch - Throws:
org.projectnessie.versioned.ReferenceNotFoundExceptionorg.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.ReferenceConflictExceptionorg.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 contextfrom- "from" reference to compute the difference from, appears on the "from" side inDiffwith hash infromto compute the diff for, must exist infromto- "to" reference to compute the difference from, appears on the "to" side inDiffwith hash intoto compute the diff for, must exist intokeyFilter- 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 givenGetNamedRefsParams.- Parameters:
ctx- database-adapter contextparams- defines which kind of references and which additional information shall be retrieveddefaultBranchHead- prerequisite, the hash of the default branch's HEAD commit (depending on the database-adapter implementation). Ifnull,namedRefsWithDefaultBranchRelatedInfo(AutoCloseable, GetNamedRefsParams, Stream, Hash)will not add additional default-branch related information (common ancestor and commits behind/ahead).refs- currentStreamofReferenceInfoto 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 updatedReferenceInfowith 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 givenGetNamedRefsParams, updates the returnedReferenceInfos 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 alsonullif the named reference points to thenoAncestorHash()(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 thatrefexists and that the hash inhashOnRefexists in that reference.- Parameters:
ctx- technical operation contextref- reference that must containhashOnRefknownHead- current HEAD ofrefhashOnRef- hash to verify whether it exists inrefcommitLogVisitor- optional consumer that will receive all visitedCommitLogEntrys, can benull.- Returns:
- value of
hashOnRefor, ifhashOnRefis empty,knownHead - Throws:
org.projectnessie.versioned.ReferenceNotFoundException- if eitherrefdoes not exist orhashOnRefdoes not exist onref
-
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, returnnull, 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:DatabaseAdapterScan all commit log entries, no guarantees about order nor about the behavior when commits happen while the returnedStreamis consumed.- Specified by:
scanAllCommitLogEntriesin interfaceDatabaseAdapter
-
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)
LikereadCommitLogStream(AutoCloseable, Hash), but only returns thecommit-log-entry hashes, which can be taken fromCommitLogEntry.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 aStreamof entries for either the global-state-log or a commit-log or a reflog entry. UsereadCommitLogStream(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 aCommitLogEntryusing the given values. This function also includes aKeyList, if triggered by the values ofcurrentKeyListDistanceandDatabaseAdapterConfig.getKeyListDistance(), so read operations may happen.- Throws:
org.projectnessie.versioned.ReferenceNotFoundExceptionorg.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 aCommitLogEntry.
-
buildKeyList
protected CommitLogEntry buildKeyList(OP_CONTEXT ctx, CommitLogEntry unwrittenEntry, java.util.function.Consumer<org.projectnessie.versioned.Hash> newKeyLists, @Nonnull @Nonnull java.util.function.Function<org.projectnessie.versioned.Hash,CommitLogEntry> inMemoryCommits) throws org.projectnessie.versioned.ReferenceNotFoundException
Adds a complete key-list to the givenCommitLogEntry, will read from the database.The implementation fills
CommitLogEntry.getKeyList()with the most recently updatedContentKeys.If the calculated size of the database-object/row gets larger than
DatabaseAdapterConfig.getMaxKeyListSize(), the nextContentKeys will be added to newKeyListEntitys, each with a maximum size ofDatabaseAdapterConfig.getMaxKeyListSize().The current implementation fetches all keys and "blindly" populated
CommitLogEntry.getKeyList()and nestedKeyListEntityviaCommitLogEntry.getKeyListsIds(). So this implementation does not yet reuse previousKeyListEntitys. A follow-up improvement should check if already existingKeyListEntitys contain the same keys. This proposed optimization should be accompanied by an optimized read of the keys: for example, if the set of changed keys only affectsCommitLogEntry.getKeyList()but not the keys viaKeyListEntity, it is just unnecessary to both read and re-write those rows forKeyListEntity.- Throws:
org.projectnessie.versioned.ReferenceNotFoundException
-
maxEntitySize
protected int maxEntitySize(int value)
-
entitySize
protected abstract int entitySize(CommitLogEntry entry)
Calculate the expected size of the givenCommitLogEntryin the database (in bytes).
-
entitySize
protected abstract int entitySize(KeyListEntry entry)
Calculate the expected size of the givenCommitLogEntryin 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 givenContentKeys andcommitSha. 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 contextcontentIds- 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 givenCommitLogEntrycan 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 rangesinceCommitExcluding] .. [upToCommitIncludingcontain any of the givenContentKeys.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 aReferenceConflictExceptionor. 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.ReferenceConflictExceptionorg.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.ReferenceNotFoundExceptionorg.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 theexpectedStates, 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)
-
-