Skip to content

Commit 7a64aa6

Browse files
authored
Merge pull request #4802 from gchq/gh-4758_variable_len_sequence
Gh 4758 variable len sequence
2 parents b92bbc5 + 50b75dc commit 7a64aa6

File tree

98 files changed

+4517
-1112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4517
-1112
lines changed

Diff for: gradle/libs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ elasticsearch = "8.12.2"
1313
httpcore = "4.4.16" # Transient dependency of Elasticsearch
1414
flyway = "10.0.0"
1515
guice = "7.0.0"
16-
gwt = "2.11.0"
16+
gwt = "2.12.2"
1717
jackson-swagger = "2.11.1" # Specific version of jackson for use with the swagger plugin
1818
jmh = "1.37"
1919
jooq = "3.18.7" # Defined at the top of this file

Diff for: stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/DuplicateCheckFactoryImpl.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
@Singleton
2121
public class DuplicateCheckFactoryImpl implements DuplicateCheckFactory {
2222

23-
private final ByteBufferFactory byteBufferFactory;
2423
private final DuplicateCheckStoreConfig analyticResultStoreConfig;
2524
private final DuplicateCheckStorePool<String, DuplicateCheckStore> pool;
2625

@@ -30,7 +29,6 @@ public DuplicateCheckFactoryImpl(final DuplicateCheckDirs duplicateCheckDirs,
3029
final DuplicateCheckStoreConfig duplicateCheckStoreConfig,
3130
final DuplicateCheckRowSerde duplicateCheckRowSerde,
3231
final Provider<Executor> executorProvider) {
33-
this.byteBufferFactory = byteBufferFactory;
3432
this.analyticResultStoreConfig = duplicateCheckStoreConfig;
3533

3634
pool = new DuplicateCheckStorePool<>(k -> new DuplicateCheckStore(
@@ -84,9 +82,13 @@ public synchronized DuplicateCheckRows fetchData(final FindDuplicateCheckCriteri
8482
}
8583

8684
public synchronized Boolean delete(final DeleteDuplicateCheckRequest request) {
87-
return pool.use(request.getAnalyticDocUuid(), store -> store.delete(request, byteBufferFactory));
85+
return pool.use(request.getAnalyticDocUuid(), store -> store.delete(request));
8886
}
8987

88+
89+
// --------------------------------------------------------------------------------
90+
91+
9092
private static class NoOpDuplicateCheck implements DuplicateCheck {
9193

9294
@Override

Diff for: stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/DuplicateCheckRowSerde.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,17 @@
1717
import java.util.Arrays;
1818
import java.util.List;
1919

20-
class DuplicateCheckRowSerde {
20+
/**
21+
* The serialised key is of the form:
22+
* <pre>{@code <hash bytes (8)><seq no bytes(variable)>}</pre>
23+
*/
24+
public class DuplicateCheckRowSerde {
2125

2226
private static final LambdaLogger LOGGER = LambdaLoggerFactory.getLogger(DuplicateCheckRowSerde.class);
2327

28+
private static final int HASH_BYTES = Long.BYTES;
29+
private static final int MAX_KEY_BYTES = HASH_BYTES + Long.BYTES;
30+
2431
private final ByteBufferFactory byteBufferFactory;
2532

2633
@Inject
@@ -44,7 +51,7 @@ protected long createHash(final byte[] bytes) {
4451
private LmdbKV createLmdbKV(final byte[] bytes) {
4552
// Hash the value.
4653
final long rowHash = createHash(bytes);
47-
final ByteBuffer keyByteBuffer = byteBufferFactory.acquire(Long.BYTES);
54+
final ByteBuffer keyByteBuffer = byteBufferFactory.acquire(MAX_KEY_BYTES);
4855
keyByteBuffer.putLong(rowHash);
4956
keyByteBuffer.flip();
5057

@@ -78,4 +85,8 @@ private byte[] serialise(final List<String> values) {
7885
}
7986
return bytes;
8087
}
88+
89+
public int getKeyLength() {
90+
return HASH_BYTES;
91+
}
8192
}

0 commit comments

Comments
 (0)