Skip to content

Commit

Permalink
Renamed Text to String
Browse files Browse the repository at this point in the history
 -o renamed for const, commits, method names, tests, docs, picture names
 -o found and fixed buffer leak bug
  • Loading branch information
Zhen committed Nov 9, 2015
1 parent 58f4110 commit 8b720a8
Show file tree
Hide file tree
Showing 18 changed files with 127 additions and 128 deletions.
12 changes: 6 additions & 6 deletions community/bolt/src/docs/dev/messaging.asciidoc
Expand Up @@ -83,7 +83,7 @@ All parameters in the `INIT` message are required.
[source,bolt_message_struct] [source,bolt_message_struct]
---- ----
InitMessage (signature=0x01) { InitMessage (signature=0x01) {
Text clientName String clientName
} }
---- ----


Expand All @@ -110,8 +110,8 @@ The `RUN` message is a client message used to start a new job on the server. It
[source,bolt_message_struct] [source,bolt_message_struct]
---- ----
RunMessage (signature=0x10) { RunMessage (signature=0x10) {
Text statement String statement
Map<Text,Value> parameters Map<String,Value> parameters
} }
---- ----


Expand Down Expand Up @@ -240,7 +240,7 @@ It has the following structure:
[source,bolt_message_struct] [source,bolt_message_struct]
---- ----
SuccessMessage (signature=0x70) { SuccessMessage (signature=0x70) {
Map<Text,Value> metadata Map<String,Value> metadata
} }
---- ----


Expand All @@ -261,7 +261,7 @@ It has the following structure:
[source,bolt_message_struct] [source,bolt_message_struct]
---- ----
FailureMessage (signature=0x7F) { FailureMessage (signature=0x7F) {
Map<Text,Value> metadata Map<String,Value> metadata
} }
---- ----


Expand Down Expand Up @@ -294,7 +294,7 @@ It has the following structure:
[source,bolt_message_struct] [source,bolt_message_struct]
---- ----
IgnoredMessage (signature=0x7E) { IgnoredMessage (signature=0x7E) {
Map<Text,Value> metadata Map<String,Value> metadata
} }
---- ----


Expand Down
60 changes: 30 additions & 30 deletions community/bolt/src/docs/dev/serialization.asciidoc
Expand Up @@ -15,7 +15,7 @@ For details on the layout and meaning of specific messages, see <<bolt-messaging
|<<bolt-packstream-booleans,Boolean>> |Boolean true or false |<<bolt-packstream-booleans,Boolean>> |Boolean true or false
|<<bolt-packstream-ints,Integer>> |64-bit signed integer |<<bolt-packstream-ints,Integer>> |64-bit signed integer
|<<bolt-packstream-floats,Float>> |64-bit floating point number |<<bolt-packstream-floats,Float>> |64-bit floating point number
|<<bolt-packstream-text,Text>> |Unicode text string |<<bolt-packstream-string,String>> |Unicode string
|<<bolt-packstream-lists,List>> |Ordered collection of values |<<bolt-packstream-lists,List>> |Ordered collection of values
|<<bolt-packstream-maps,Map>> |Unordered, keyed collection of values |<<bolt-packstream-maps,Map>> |Unordered, keyed collection of values
|<<bolt-value-nodestruct,Node>> |A node in the graph with optional properties and labels |<<bolt-value-nodestruct,Node>> |A node in the graph with optional properties and labels
Expand Down Expand Up @@ -158,13 +158,13 @@ Value: -1.1
C1 BF F1 99 99 99 99 99 9A C1 BF F1 99 99 99 99 99 9A
---- ----


[[bolt-packstream-text]] [[bolt-packstream-string]]
=== Text === String
Text data is represented as UTF-8 encoded binary data. String data is represented as UTF-8 encoded binary data.
Note that sizes used for text are the byte counts of the UTF-8 encoded data, not the character count of the original text. Note that sizes used for string are the byte counts of the UTF-8 encoded data, not the character count of the original string.


.Text markers .String markers
[cols="^20,<50,<30",options="header",name="packstream-text-marker-table"] [cols="^20,<50,<30",options="header",name="packstream-string-marker-table"]
|======================= |=======================
|Marker |Size |Maximum data size |Marker |Size |Maximum data size
|`0x80`..`0x8F` |contained within low-order nibble of marker |15 bytes |`0x80`..`0x8F` |contained within low-order nibble of marker |15 bytes
Expand All @@ -173,32 +173,32 @@ Note that sizes used for text are the byte counts of the UTF-8 encoded data, not
|`0xD2` |32-bit big-endian unsigned integer |4 294 967 295 bytes |`0xD2` |32-bit big-endian unsigned integer |4 294 967 295 bytes
|======================= |=======================


==== Tiny Text Strings & Empty Text Strings ==== Tiny Strings & Empty Strings
For encoded text containing fewer than 16 bytes, including empty strings, the marker byte should contain the high-order nibble `1000` followed by a low-order nibble containing the size. For encoded string containing fewer than 16 bytes, including empty strings, the marker byte should contain the high-order nibble `1000` followed by a low-order nibble containing the size.
The encoded data then immediately follows the marker. The encoded data then immediately follows the marker.
The example below shows how the string "Hello" would be represented: The example below shows how the string "Hello" would be represented:


// TODO: Convert this to a code-segment that can be tested // TODO: Convert this to a code-segment that can be tested
image:packstream-tinytext.png[] image:packstream-tinystring.png[]


==== Regular Text Strings ==== Regular Strings
For encoded text containing 16 bytes or more, the marker `0xD0`, `0xD1` or `0xD2` should be used, depending on scale. For encoded string containing 16 bytes or more, the marker `0xD0`, `0xD1` or `0xD2` should be used, depending on scale.
This marker is followed by the size and the UTF-8 encoded data as in the example below: This marker is followed by the size and the UTF-8 encoded data as in the example below:


// TODO: Convert this to a code-segment that can be tested // TODO: Convert this to a code-segment that can be tested
image:packstream-text.png[] image:packstream-string.png[]


==== Examples ==== Examples


.Tiny text .Tiny string
[source,bolt_packstream_type] [source,bolt_packstream_type]
---- ----
Value: "a" Value: "a"
81 61 81 61
---- ----


.Regular text .Regular string
[source,bolt_packstream_type] [source,bolt_packstream_type]
---- ----
Value: "abcdefghijklmonpqrstuvwxyz" Value: "abcdefghijklmonpqrstuvwxyz"
Expand All @@ -207,7 +207,7 @@ D0 1A 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6F
6E 70 71 72 73 74 75 76 77 78 79 7A 6E 70 71 72 73 74 75 76 77 78 79 7A
---- ----


.Text with special characters .String with special characters
[source,bolt_packstream_type] [source,bolt_packstream_type]
---- ----
Value: "En å flöt över ängen" Value: "En å flöt över ängen"
Expand Down Expand Up @@ -386,8 +386,8 @@ A Node represents a node from a Neo4j graph and consists of a unique identifier
---- ----
Node (signature=0x4E) { Node (signature=0x4E) {
Integer nodeIdentity Integer nodeIdentity
List<Text> labels List<String> labels
Map<Text, Value> properties Map<String, Value> properties
} }
---- ----


Expand All @@ -398,11 +398,11 @@ A Relationship represents a relationship from a Neo4j graph and consists of a un
[source,bolt_value_struct] [source,bolt_value_struct]
---- ----
Relationship (signature=0x52) { Relationship (signature=0x52) {
Integer relIdentity Integer relIdentity
Integer startNodeIdentity Integer startNodeIdentity
Integer endNodeIdentity Integer endNodeIdentity
Text type String type
Map<Text, Value> properties Map<String, Value> properties
} }
---- ----


Expand Down Expand Up @@ -485,9 +485,9 @@ The general serialised structure is as follows:
[source,bolt_value_struct] [source,bolt_value_struct]
---- ----
UnboundRelationship (signature=0x72) { UnboundRelationship (signature=0x72) {
Integer relIdentity Integer relIdentity
Text type // e.g. "KNOWS" String type // e.g. "KNOWS"
Map<Text, Value> properties // e.g. {since:1999} Map<String, Value> properties // e.g. {since:1999}
} }
---- ----


Expand All @@ -501,7 +501,7 @@ These are all the marker bytes:
|======================= |=======================
|Marker |Binary |Type |Description |Marker |Binary |Type |Description
|`0x00`..`0x7F` |`0xxxxxxx` |`+TINY_INT` |Integer 0 to 127 |`0x00`..`0x7F` |`0xxxxxxx` |`+TINY_INT` |Integer 0 to 127
|`0x80`..`0x8F` |`1000xxxx` |`TINY_TEXT` |UTF-8 encoded text string (fewer than 2^4^ bytes) |`0x80`..`0x8F` |`1000xxxx` |`TINY_STRING` |UTF-8 encoded string (fewer than 2^4^ bytes)
|`0x90`..`0x9F` |`1001xxxx` |`TINY_LIST` |List (fewer than 2^4^ items) |`0x90`..`0x9F` |`1001xxxx` |`TINY_LIST` |List (fewer than 2^4^ items)
|`0xA0`..`0xAF` |`1010xxxx` |`TINY_MAP` |Map (fewer than 2^4^ key-value pairs) |`0xA0`..`0xAF` |`1010xxxx` |`TINY_MAP` |Map (fewer than 2^4^ key-value pairs)
|`0xB0`..`0xBF` |`1011xxxx` |`TINY_STRUCT` |Structure (fewer than 2^4^ fields) |`0xB0`..`0xBF` |`1011xxxx` |`TINY_STRUCT` |Structure (fewer than 2^4^ fields)
Expand All @@ -515,9 +515,9 @@ These are all the marker bytes:
|`0xCA` |`11001010` |`INT_32` |32-bit signed integer |`0xCA` |`11001010` |`INT_32` |32-bit signed integer
|`0xCB` |`11001011` |`INT_64` |64-bit signed integer |`0xCB` |`11001011` |`INT_64` |64-bit signed integer
|`0xCC`..`0xCF` |`11001100` | |Reserved |`0xCC`..`0xCF` |`11001100` | |Reserved
|`0xD0` |`11010000` |`TEXT_8` |UTF-8 encoded text string (fewer than 2^8^ bytes) |`0xD0` |`11010000` |`STRING_8` |UTF-8 encoded string (fewer than 2^8^ bytes)
|`0xD1` |`11010001` |`TEXT_16` |UTF-8 encoded text string (fewer than 2^16^ bytes) |`0xD1` |`11010001` |`STRING_16` |UTF-8 encoded string (fewer than 2^16^ bytes)
|`0xD2` |`11010010` |`TEXT_32` |UTF-8 encoded text string (fewer than 2^32^ bytes) |`0xD2` |`11010010` |`STRING_32` |UTF-8 encoded string (fewer than 2^32^ bytes)
|`0xD3` |`11010011` | |Reserved |`0xD3` |`11010011` | |Reserved
|`0xD4` |`11010100` |`LIST_8` |List (fewer than 2^8^ items) |`0xD4` |`11010100` |`LIST_8` |List (fewer than 2^8^ items)
|`0xD5` |`11010101` |`LIST_16` |List (fewer than 2^16^ items) |`0xD5` |`11010101` |`LIST_16` |List (fewer than 2^16^ items)
Expand Down
Expand Up @@ -239,8 +239,8 @@ public Object unpack() throws IOException
PackType valType = peekNextType(); PackType valType = peekNextType();
switch ( valType ) switch ( valType )
{ {
case TEXT: case STRING:
return unpackText(); return unpackString();
case INTEGER: case INTEGER:
return unpackLong(); return unpackLong();
case FLOAT: case FLOAT:
Expand Down Expand Up @@ -354,8 +354,8 @@ public Map<String, Object> unpackMap() throws IOException
unpack(); unpack();
more = false; more = false;
break; break;
case TEXT: case STRING:
String key = unpackText(); String key = unpackString();
Object val = unpack(); Object val = unpack();
if( map.put( key, val ) != null ) if( map.put( key, val ) != null )
{ {
Expand All @@ -372,7 +372,7 @@ public Map<String, Object> unpackMap() throws IOException
map = new HashMap<>( size, 1 ); map = new HashMap<>( size, 1 );
for ( int i = 0; i < size; i++ ) for ( int i = 0; i < size; i++ )
{ {
String key = unpackText(); String key = unpackString();
Object val = unpack(); Object val = unpack();
if( map.put( key, val ) != null ) if( map.put( key, val ) != null )
{ {
Expand Down
Expand Up @@ -322,7 +322,7 @@ private <E extends Exception> void unpackRecordMessage( MessageHandler<E> output
private <E extends Exception> void unpackRunMessage( MessageHandler<E> output ) private <E extends Exception> void unpackRunMessage( MessageHandler<E> output )
throws E, IOException throws E, IOException
{ {
String statement = unpacker.unpackText(); String statement = unpacker.unpackString();
Map<String,Object> params = unpacker.unpackMap(); Map<String,Object> params = unpacker.unpackMap();
output.handleRunMessage( statement, params ); output.handleRunMessage( statement, params );
} }
Expand All @@ -341,7 +341,7 @@ private <E extends Exception> void unpackPullAllMessage( MessageHandler<E> outpu


private <E extends Exception> void unpackInitMessage( MessageHandler<E> output ) throws IOException, E private <E extends Exception> void unpackInitMessage( MessageHandler<E> output ) throws IOException, E
{ {
String clientName = unpacker.unpackText(); String clientName = unpacker.unpackString();
output.handleInitMessage( clientName ); output.handleInitMessage( clientName );
} }


Expand Down
Expand Up @@ -88,7 +88,7 @@ public static ValueNode unpackFields( Neo4jPack.Unpacker unpacker )
labels = new ArrayList<>( numLabels ); labels = new ArrayList<>( numLabels );
for ( int i = 0; i < numLabels; i++ ) for ( int i = 0; i < numLabels; i++ )
{ {
labels.add( DynamicLabel.label( unpacker.unpackText() ) ); labels.add( DynamicLabel.label( unpacker.unpackString() ) );
} }
} }
else else
Expand Down
Expand Up @@ -67,7 +67,7 @@ public static ValueRelationship unpackFields( Neo4jPack.Unpacker unpacker )
long relId = unpacker.unpackLong(); long relId = unpacker.unpackLong();
long startNodeId = unpacker.unpackLong(); long startNodeId = unpacker.unpackLong();
long endNodeId = unpacker.unpackLong(); long endNodeId = unpacker.unpackLong();
String relTypeName = unpacker.unpackText(); String relTypeName = unpacker.unpackString();


Map<String, Object> props = unpacker.unpackMap(); Map<String, Object> props = unpacker.unpackMap();


Expand Down
Expand Up @@ -56,7 +56,7 @@ public static ValueUnboundRelationship unpackFields( Neo4jPack.Unpacker unpacker
throws IOException throws IOException
{ {
long relId = unpacker.unpackLong(); long relId = unpacker.unpackLong();
String relTypeName = unpacker.unpackText(); String relTypeName = unpacker.unpackString();


Map<String, Object> props = unpacker.unpackMap(); Map<String, Object> props = unpacker.unpackMap();


Expand Down

0 comments on commit 8b720a8

Please sign in to comment.