Skip to content

Package: MessageUniquenessCheck

MessageUniquenessCheck

nameinstructionbranchcomplexitylinemethod
static {...}
M: 34 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.datastore.internal.model;
14:
15: /**
16: * 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.
17: * The store call is then retried and the message could be inserted twice.
18: * 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.
19: * 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.
20: * 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.
21: * This enum define a new parameter to change the search behavior by account.
22: */
23: public enum MessageUniquenessCheck {
24:
25: /**
26: * No check
27: */
28: NONE,
29: /**
30: * The search is done only to the index where the message is expected to be, based on current configuration.
31: */
32: BOUND,
33: /**
34: * Will check in all the indexes defined for the account
35: */
36: FULL
37: }