Skip to content

Commit ef20031

Browse files
committed
chore: Update to Exobytes and ylem-io instead of commons
1 parent d69e5f5 commit ef20031

File tree

76 files changed

+757
-391
lines changed

Some content is hidden

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

76 files changed

+757
-391
lines changed

pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<properties>
2929
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3030
<lucene-version>8.5.2</lucene-version>
31-
<commons-version>2.0.0-SNAPSHOT</commons-version>
3231
</properties>
3332

3433
<modules>

silo-api/pom.xml

+15-9
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,27 @@
2020

2121
<dependencies>
2222
<dependency>
23-
<groupId>se.l4.commons</groupId>
24-
<artifactId>commons-id</artifactId>
25-
<version>${commons-version}</version>
23+
<groupId>se.l4.ylem.ids</groupId>
24+
<artifactId>ylem-ids</artifactId>
25+
<version>1.0.0</version>
2626
</dependency>
2727

2828
<dependency>
29-
<groupId>se.l4.commons</groupId>
30-
<artifactId>commons-io</artifactId>
31-
<version>${commons-version}</version>
29+
<groupId>se.l4.ylem.io</groupId>
30+
<artifactId>ylem-io</artifactId>
31+
<version>1.0.0</version>
3232
</dependency>
3333

3434
<dependency>
35-
<groupId>se.l4.commons</groupId>
36-
<artifactId>commons-serialization</artifactId>
37-
<version>${commons-version}</version>
35+
<groupId>se.l4.exobytes</groupId>
36+
<artifactId>exobytes</artifactId>
37+
<version>1.0.0-SNAPSHOT</version>
38+
</dependency>
39+
40+
<dependency>
41+
<groupId>com.google.guava</groupId>
42+
<artifactId>guava</artifactId>
43+
<version>29.0-jre</version>
3844
</dependency>
3945
</dependencies>
4046

silo-api/src/main/java/se/l4/silo/binary/BinaryEntity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package se.l4.silo.binary;
22

3-
import se.l4.commons.io.Bytes;
43
import se.l4.silo.DeleteResult;
54
import se.l4.silo.Entity;
65
import se.l4.silo.FetchResult;
76
import se.l4.silo.StoreResult;
7+
import se.l4.ylem.io.Bytes;
88

99
/**
1010
* Simple binary key-value entity. Can be used to associate an identifier

silo-api/src/main/java/se/l4/silo/binary/BinaryEntry.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package se.l4.silo.binary;
22

3-
import se.l4.commons.io.Bytes;
43
import se.l4.silo.FetchResult;
4+
import se.l4.ylem.io.Bytes;
55

66
/**
77
* Item as returned via {@link FetchResult}.

silo-api/src/main/java/se/l4/silo/index/IndexQueryRequest.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import java.util.Collections;
55
import java.util.List;
66

7-
import se.l4.commons.serialization.AllowAny;
8-
import se.l4.commons.serialization.Expose;
9-
import se.l4.commons.serialization.ReflectionSerializer;
10-
import se.l4.commons.serialization.Use;
7+
import se.l4.exobytes.AllowAny;
8+
import se.l4.exobytes.AnnotationSerialization;
9+
import se.l4.exobytes.Expose;
10+
import se.l4.exobytes.Use;
11+
import se.l4.exobytes.internal.reflection.ReflectionSerializer;
1112

12-
@Use(ReflectionSerializer.class)
13+
@AnnotationSerialization
1314
public class IndexQueryRequest
1415
{
1516
@Expose

silo-api/src/main/java/se/l4/silo/query/QueryType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package se.l4.silo.query;
22

3-
import se.l4.commons.serialization.format.StreamingInput;
3+
import se.l4.exobytes.streaming.StreamingInput;
44
import se.l4.silo.Entity;
55
import se.l4.silo.structured.ObjectEntity;
66
import se.l4.silo.structured.StructuredEntity;

silo-api/src/main/java/se/l4/silo/structured/DefaultObjectEntity.java

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package se.l4.silo.structured;
22

33
import java.io.ByteArrayInputStream;
4+
import java.io.ByteArrayOutputStream;
45
import java.io.IOException;
56
import java.util.Iterator;
67
import java.util.Optional;
78
import java.util.function.Function;
89

9-
import se.l4.commons.serialization.Serializer;
10-
import se.l4.commons.serialization.format.BinaryInput;
11-
import se.l4.commons.serialization.format.StreamingInput;
10+
import se.l4.exobytes.Serializer;
11+
import se.l4.exobytes.streaming.StreamingFormat;
12+
import se.l4.exobytes.streaming.StreamingInput;
13+
import se.l4.exobytes.streaming.StreamingOutput;
1214
import se.l4.silo.FetchResult;
1315
import se.l4.silo.StorageException;
1416
import se.l4.silo.query.Query;
@@ -87,8 +89,13 @@ public void store(T data)
8789
try
8890
{
8991
Object id = identityMapper.apply(data);
90-
byte[] binary = serializer.toBytes(data);
91-
parent.store(id, new BinaryInput(new ByteArrayInputStream(binary)));
92+
93+
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
94+
try(StreamingOutput out = StreamingFormat.LEGACY_BINARY.createOutput(bytes))
95+
{
96+
out.writeObject(serializer, data);
97+
}
98+
parent.store(id, StreamingFormat.LEGACY_BINARY.createInput(new ByteArrayInputStream(bytes.toByteArray())));
9299
}
93100
catch(Exception e)
94101
{

silo-api/src/main/java/se/l4/silo/structured/StructuredEntity.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import java.util.function.Function;
44

5-
import se.l4.commons.serialization.Serializer;
6-
import se.l4.commons.serialization.SerializerCollection;
7-
import se.l4.commons.serialization.format.StreamingInput;
5+
import se.l4.exobytes.Serializer;
6+
import se.l4.exobytes.Serializers;
7+
import se.l4.exobytes.streaming.StreamingInput;
88
import se.l4.silo.DeleteResult;
99
import se.l4.silo.Entity;
1010
import se.l4.silo.FetchResult;
@@ -65,7 +65,7 @@ public interface StructuredEntity
6565
/**
6666
* Get an entity that translates the structured data into objects. This
6767
* will call {@link #asObject(Serializer)} with a serializer fetched
68-
* from the current {@link SerializerCollection}.
68+
* from the current {@link Serializers}.
6969
*
7070
* @param type
7171
* @return

silo-engine/pom.xml

-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525
<version>${project.version}</version>
2626
</dependency>
2727

28-
<dependency>
29-
<groupId>se.l4.commons</groupId>
30-
<artifactId>commons-config</artifactId>
31-
<version>${commons-version}</version>
32-
</dependency>
33-
3428
<dependency>
3529
<groupId>com.carrotsearch</groupId>
3630
<artifactId>hppc</artifactId>

silo-engine/src/main/java/se/l4/silo/engine/DataEncounter.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import java.util.Map;
55
import java.util.function.BiConsumer;
66

7-
import se.l4.commons.io.Bytes;
8-
import se.l4.commons.serialization.format.StreamingInput;
7+
import se.l4.exobytes.streaming.StreamingInput;
8+
import se.l4.ylem.io.Bytes;
99

1010
public interface DataEncounter
1111
{

silo-engine/src/main/java/se/l4/silo/engine/DataStorage.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.io.IOException;
44

5-
import se.l4.commons.io.Bytes;
5+
import se.l4.ylem.io.Bytes;
66

77
/**
88
* Data storage for raw binary data. Binary data is always associated with an

silo-engine/src/main/java/se/l4/silo/engine/EntityCreationEncounter.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package se.l4.silo.engine;
22

3-
import se.l4.commons.serialization.SerializerCollection;
3+
import se.l4.exobytes.Serializers;
44
import se.l4.silo.engine.builder.StorageBuilder;
55

66
/**
@@ -27,11 +27,11 @@ public interface EntityCreationEncounter<Config>
2727
Config getConfig();
2828

2929
/**
30-
* Get the {@link SerializerCollection} in use for this entity.
30+
* Get the {@link Serializers} in use for this entity.
3131
*
3232
* @return
3333
*/
34-
SerializerCollection getSerializerCollection();
34+
Serializers getSerializerCollection();
3535

3636
/**
3737
* Create the main storage for this entity.

silo-engine/src/main/java/se/l4/silo/engine/LocalSilo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.Objects;
77
import java.util.concurrent.TimeUnit;
88

9-
import se.l4.commons.serialization.SerializerCollection;
9+
import se.l4.exobytes.Serializers;
1010
import se.l4.silo.Entity;
1111
import se.l4.silo.ResourceHandle;
1212
import se.l4.silo.Silo;
@@ -41,7 +41,7 @@ public class LocalSilo
4141
private final StorageEngine storageEngine;
4242
private final ThreadLocal<TransactionImpl> transactions;
4343

44-
public LocalSilo(LocalEngineFactories factories, SerializerCollection serializers, Vibe vibe, LogBuilder logBuilder, Path storage, EngineConfig config)
44+
public LocalSilo(LocalEngineFactories factories, Serializers serializers, Vibe vibe, LogBuilder logBuilder, Path storage, EngineConfig config)
4545
{
4646
Objects.requireNonNull(factories, "factories is required");
4747
Objects.requireNonNull(serializers, "serializers is required");

silo-engine/src/main/java/se/l4/silo/engine/Storage.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
import java.io.InputStream;
55
import java.util.function.Function;
66

7-
import se.l4.commons.io.Bytes;
8-
import se.l4.commons.serialization.format.BinaryInput;
9-
import se.l4.commons.serialization.format.StreamingInput;
7+
import se.l4.exobytes.streaming.StreamingFormat;
8+
import se.l4.exobytes.streaming.StreamingInput;
109
import se.l4.silo.DeleteResult;
1110
import se.l4.silo.Entity;
1211
import se.l4.silo.FetchResult;
1312
import se.l4.silo.StorageException;
1413
import se.l4.silo.StoreResult;
1514
import se.l4.silo.query.QueryFetchResult;
1615
import se.l4.silo.query.QueryResult;
16+
import se.l4.ylem.io.Bytes;
1717

1818
/**
1919
* Storage that can be used by {@link Entity entities}.
@@ -55,7 +55,7 @@ default StreamingInput getStructured(Object id)
5555
throw new StorageException("Unknown storage version: " + tag + ", this version of Silo is either old or the data is corrupt");
5656
}
5757

58-
return new BinaryInput(stream);
58+
return StreamingFormat.LEGACY_BINARY.createInput(stream);
5959
}
6060
catch(IOException e)
6161
{

silo-engine/src/main/java/se/l4/silo/engine/builder/SiloBuilder.java

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package se.l4.silo.engine.builder;
22

3-
import se.l4.commons.serialization.DefaultSerializerCollection;
4-
import se.l4.commons.serialization.SerializerCollection;
5-
import se.l4.commons.types.TypeFinder;
3+
import se.l4.exobytes.Serializers;
4+
import se.l4.exobytes.internal.DefaultSerializers;
65
import se.l4.silo.Silo;
76
import se.l4.silo.engine.EntityTypeFactory;
87
import se.l4.silo.engine.LocalSilo;
@@ -21,21 +20,12 @@ public interface SiloBuilder
2120
{
2221
/**
2322
* Set the serializer collection to use. If this is not called an
24-
* instance of {@link DefaultSerializerCollection} will be used.
23+
* instance of {@link DefaultSerializers} will be used.
2524
*
2625
* @param collection
2726
* @return
2827
*/
29-
SiloBuilder withSerializerCollection(SerializerCollection collection);
30-
31-
/**
32-
* Set the auto loader to use. If this is set the created instance will
33-
* be able to pick up extensions automatically.
34-
*
35-
* @param loader
36-
* @return
37-
*/
38-
SiloBuilder withTypeFinder(TypeFinder finder);
28+
SiloBuilder withSerializerCollection(Serializers collection);
3929

4030
/**
4131
* Set the {@link Vibe} instance to use. Setting this will enable reporting

0 commit comments

Comments
 (0)