-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
Signed-off-by: riccardomodanese <riccardo.modanese@eurotech.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.kapua.service.datastore.internal.model; | ||
|
||
/** | ||
* Once a message is going to be stored to datastore the store call can terminate with error on client side (due to timeout for example) but performed on server side. | ||
* The store call is then retried and the message could be inserted twice. | ||
* To avoid that, the current implementation does a query looking for a message with a specific id (the one from the message) in all the indexes belonging to the account. | ||
* This is safer since changes in the message indexing by or the settings of the datastore (index by week/day/hour) can affect the index where the message should be stored to and then the effectivness of the check. | ||
* But this has a performance drawback. The number of queries to be performed are linear with the indexes available so, if there are a lot of indexes, the query will need more time and resources to be executed. | ||
* This enum define a new parameter to change the search behavior by account. | ||
*/ | ||
public enum MessageUniquenessCheck { | ||
Check warning on line 23 in service/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java Codecov / codecov/patchservice/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java#L23
|
||
|
||
/** | ||
* No check | ||
*/ | ||
NONE, | ||
Check warning on line 28 in service/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java Codecov / codecov/patchservice/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java#L28
|
||
/** | ||
* The search is done only to the index where the message is expected to be, based on current configuration. | ||
*/ | ||
BOUND, | ||
Check warning on line 32 in service/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java Codecov / codecov/patchservice/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java#L32
|
||
/** | ||
* Will check in all the indexes defined for the account | ||
*/ | ||
FULL | ||
Check warning on line 36 in service/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java Codecov / codecov/patchservice/datastore/internal/src/main/java/org/eclipse/kapua/service/datastore/internal/model/MessageUniquenessCheck.java#L36
|
||
} |