From 69638baf04b2303a266a25802352880380250a1e Mon Sep 17 00:00:00 2001 From: leventov Date: Fri, 5 Feb 2016 17:11:19 +0700 Subject: [PATCH] Use TextWire instead of BinaryWire for Chronicle Map's self-bootstrapping header encoding --- spec/3-memory-layout.md | 2 +- spec/3_1-header-fields.md | 4 ++-- .../java/net/openhft/chronicle/map/ChronicleMapBuilder.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/3-memory-layout.md b/spec/3-memory-layout.md index e457430f0..d4accf2b2 100644 --- a/spec/3-memory-layout.md +++ b/spec/3-memory-layout.md @@ -36,7 +36,7 @@ takes one big continuous block of memory. Its structure, from lower addresses to It's structure and initialization order are described in the [Self Bootstrapping Data]( https://github.com/OpenHFT/RFC/blob/master/Self-Bootstrapping-Data/Self-Bootstraping-Data-0.1.md) -specification. It is encoded in Binary Wire format. Once created, this header is never changed. It +specification. It is encoded in Text Wire format. Once created, this header is never changed. It contains all configurations, immutable for Chronicle Map during the instance lifetime: number of segments, various sizes, offsets, etc. See the specification of the fields on [Map Header Fields](3_1-header-fields.md) page. diff --git a/spec/3_1-header-fields.md b/spec/3_1-header-fields.md index b561038ff..0f2c96715 100644 --- a/spec/3_1-header-fields.md +++ b/spec/3_1-header-fields.md @@ -1,8 +1,8 @@ # 3.1. Chronicle Map Data Store Header Fields Header of a persisted Chronicle Map instance is written once, when the instance and the file are -created, and never changed after that. It is stored in [Binary Wire Format -](https://github.com/OpenHFT/RFC/blob/master/Wire-Format-API/Binary/Binary-Wire-Format-API-0.1.md)). +created, and never changed after that. It is stored in [Text Wire Format +](https://github.com/OpenHFT/RFC/blob/master/Wire-Format-API/Text/Text-Wire-Format-API-0.1.md)). The top-level structure name is `!net.openhft.chronicle.map.VanillaChronicleMap`. It contains the following fields: diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java index cff9f9e70..7653914c2 100755 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapBuilder.java @@ -35,7 +35,7 @@ import net.openhft.chronicle.map.replication.MapRemoteOperations; import net.openhft.chronicle.set.ChronicleSetBuilder; import net.openhft.chronicle.threads.NamedThreadFactory; import net.openhft.chronicle.values.ValueModel; -import net.openhft.chronicle.wire.BinaryWire; +import net.openhft.chronicle.wire.TextWire; import net.openhft.chronicle.wire.Wire; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; @@ -1518,7 +1518,7 @@ public final class ChronicleMapBuilder implements Bytes headerBytes = Bytes.wrapForRead(headerBuffer); headerBytes.readPosition(headerBuffer.position()); headerBytes.readLimit(headerBuffer.limit()); - Wire wire = new BinaryWire(headerBytes); + Wire wire = new TextWire(headerBytes); VanillaChronicleMap map = wire.getValueIn().typedMarshallable(); assert map != null; map.initBeforeMapping(file, fileChannel, headerBuffer.limit()); @@ -1565,7 +1565,7 @@ public final class ChronicleMapBuilder implements headerBuffer.putInt(SIZE_WORD_OFFSET, NOT_READY | DATA); Bytes headerBytes = Bytes.wrapForWrite(headerBuffer); headerBytes.writePosition(SELF_BOOTSTRAPPING_HEADER_OFFSET); - Wire wire = new BinaryWire(headerBytes); + Wire wire = new TextWire(headerBytes); wire.getValueOut().typedMarshallable(map); int headerLimit = (int) headerBytes.writePosition();