Java-Lang -> Chronicle-Bytes, Chronicle-Values

This commit is contained in:
leventov
2015-11-22 22:10:39 +03:00
parent b6f5b7cab5
commit ade2196e72
277 changed files with 5193 additions and 12072 deletions
@@ -22,17 +22,9 @@ import net.openhft.chronicle.hash.ChronicleHashInstanceBuilder;
import net.openhft.chronicle.hash.replication.SingleChronicleHashReplication;
import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig;
import net.openhft.chronicle.hash.replication.TimeProvider;
import net.openhft.chronicle.hash.serialization.BytesReader;
import net.openhft.chronicle.hash.serialization.BytesWriter;
import net.openhft.chronicle.hash.serialization.SizeMarshaller;
import net.openhft.chronicle.hash.serialization.internal.DummyValue;
import net.openhft.chronicle.hash.serialization.internal.DummyValueMarshaller;
import net.openhft.chronicle.hash.serialization.*;
import net.openhft.chronicle.map.ChronicleMap;
import net.openhft.chronicle.map.ChronicleMapBuilder;
import net.openhft.lang.io.serialization.BytesMarshaller;
import net.openhft.lang.io.serialization.BytesMarshallerFactory;
import net.openhft.lang.io.serialization.ObjectFactory;
import net.openhft.lang.io.serialization.ObjectSerializer;
import org.jetbrains.annotations.NotNull;
import java.io.File;
@@ -57,8 +49,9 @@ public final class ChronicleSetBuilder<K>
ChronicleSetBuilder(Class<K> keyClass) {
chronicleMapBuilder = ChronicleMapBuilder.of(keyClass, DummyValue.class)
.valueMarshallers(DummyValueMarshaller.INSTANCE, DummyValueMarshaller.INSTANCE)
.valueSizeMarshaller(DummyValueMarshaller.INSTANCE);
.valueReaderAndDataAccess(
DummyValueMarshaller.INSTANCE, DummyValueMarshaller.INSTANCE)
.valueSizeMarshaller(SizeMarshaller.constant(0));
}
public static <K> ChronicleSetBuilder<K> of(Class<K> keyClass) {
@@ -222,38 +215,37 @@ public final class ChronicleSetBuilder<K>
}
@Override
public ChronicleSetBuilder<K> bytesMarshallerFactory(
BytesMarshallerFactory bytesMarshallerFactory) {
chronicleMapBuilder.bytesMarshallerFactory(bytesMarshallerFactory);
return this;
}
/**
* {@inheritDoc}
*
* <p> Example: <pre>{@code Set<Key> set = ChronicleSetBuilder.of(Key.class)
* .entries(1_000_000)
* .keySize(100)
* // this class hasn't implemented yet, just for example
* .objectSerializer(new KryoObjectSerializer())
* .create();}</pre>
*/
@Override
public ChronicleSetBuilder<K> objectSerializer(ObjectSerializer objectSerializer) {
chronicleMapBuilder.objectSerializer(objectSerializer);
return this;
}
@Override
public ChronicleSetBuilder<K> keyMarshaller(@NotNull BytesMarshaller<? super K> keyMarshaller) {
chronicleMapBuilder.keyMarshaller(keyMarshaller);
public ChronicleSetBuilder<K> keyReaderAndDataAccess(
SizedReader<K> keyReader, @NotNull DataAccess<K> keyDataAccess) {
chronicleMapBuilder.keyReaderAndDataAccess(keyReader, keyDataAccess);
return this;
}
@Override
public ChronicleSetBuilder<K> keyMarshallers(
@NotNull BytesWriter<? super K> keyWriter, @NotNull BytesReader<K> keyReader) {
chronicleMapBuilder.keyMarshallers(keyWriter, keyReader);
@NotNull BytesReader<K> keyReader, @NotNull BytesWriter<? super K> keyWriter) {
chronicleMapBuilder.keyMarshallers(keyReader, keyWriter);
return this;
}
@Override
public <M extends BytesReader<K> & BytesWriter<? super K>>
ChronicleSetBuilder<K> keyMarshaller(@NotNull M marshaller) {
chronicleMapBuilder.keyMarshaller(marshaller);
return this;
}
@Override
public ChronicleSetBuilder<K> keyMarshallers(
@NotNull SizedReader<K> keyReader, @NotNull SizedWriter<? super K> keyWriter) {
chronicleMapBuilder.keyMarshallers(keyReader, keyWriter);
return this;
}
@Override
public <M extends SizedReader<K> & SizedWriter<? super K>>
ChronicleSetBuilder<K> keyMarshaller(@NotNull M sizedMarshaller) {
chronicleMapBuilder.keyMarshaller(sizedMarshaller);
return this;
}
@@ -263,29 +255,6 @@ public final class ChronicleSetBuilder<K>
return this;
}
/**
* {@inheritDoc}
*
* <p>Actually this is just a convenience method supporting key marshaller configurations, made
* initially during {@link #of(Class)} call. Because if you {@linkplain
* #keyMarshaller(BytesMarshaller) configure} own custom key marshaller, this method doesn't
* take any effect on the maps constructed by this builder.
*
* @see #of(Class)
*/
@Override
public ChronicleSetBuilder<K> keyDeserializationFactory(
@NotNull ObjectFactory<? extends K> keyDeserializationFactory) {
chronicleMapBuilder.keyDeserializationFactory(keyDeserializationFactory);
return this;
}
@Override
public ChronicleSetBuilder<K> immutableKeys() {
chronicleMapBuilder.immutableKeys();
return this;
}
@Override
public ChronicleSetBuilder<K> aligned64BitMemoryOperationsAtomic(
boolean aligned64BitMemoryOperationsAtomic) {