-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use solr optimistic locking when updating (#87)
- removes useless file `api.avdl` probably left from the beginnings - moved a little away from using ducktape everywhere, because we had to write most things manually anyways (there were more `Field.default`, `Field.computed` additionals than what could be mapped automatically). It also makes it a bit less work to deal with specific cases when bringing in one value from an argument - renamed `insert` to `upsert` for solr updates, because one never knows what it will be :-) - put `DocVersion` into solr-client module, as this is very specific to solr - refactor `MessageHandlers` to use the same basic `upsert` based operation, where `DocumentMerger` decides how to update/create entities in case they already exists or not. This has been splitted into multiple places before which have been removed - refactor `MessageHandlers` so tests don't need to use multiple threads (events can be send and afterwards the handler stream can be run) - The upsert in `MessageHandler` will retry on version conflict - enhance `EncoderSupport` to also support borers `key` annotation for changing field names. this is used to have a nice named field `version` and map it to solrs required name `_version_` - when a `ProjectUpdated` event comes first, it is stored as a `PartialEntityDocument` as well
- Loading branch information
Showing
59 changed files
with
1,370 additions
and
681 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
modules/events/src/main/scala/io/renku/search/events/syntax.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2024 Swiss Data Science Center (SDSC) | ||
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and | ||
* Eidgenössische Technische Hochschule Zürich (ETHZ). | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.renku.search.events | ||
|
||
import io.renku.events.v1.{Visibility as EventVisibility, *} | ||
import io.renku.search.model.{Id, Name} | ||
import io.renku.search.model.projects.* | ||
import java.time.Instant | ||
import io.renku.search.model.users.FirstName | ||
import io.renku.search.model.users.LastName | ||
|
||
trait syntax: | ||
extension (self: EventVisibility) | ||
def toModel: Visibility = | ||
Visibility.unsafeFromString(self.name()) | ||
|
||
extension (self: ProjectMemberRole) | ||
def toModel: MemberRole = | ||
MemberRole.unsafeFromString(self.name()) | ||
|
||
extension (self: String) | ||
def toId: Id = Id(self) | ||
def toName: Name = Name(self) | ||
def toSlug: Slug = Slug(self) | ||
def toRepository: Repository = Repository(self) | ||
def toDescription: Description = Description(self) | ||
def toFirstName: FirstName = FirstName(self) | ||
def toLastName: LastName = LastName(self) | ||
|
||
extension (self: Instant) def toCreationDate: CreationDate = CreationDate(self) | ||
|
||
object syntax extends syntax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.