Andrey Aleksandrov created IGNITE-8718:
------------------------------------------

             Summary: Documentation about using of the C++ 
BinaryWriter/BinaryReader should be updated
                 Key: IGNITE-8718
                 URL: https://issues.apache.org/jira/browse/IGNITE-8718
             Project: Ignite
          Issue Type: Improvement
          Components: documentation
    Affects Versions: 2.5
            Reporter: Andrey Aleksandrov
             Fix For: 2.6


The usage that should be documented:


1)In case if you get some writer from BinaryWriter then you started writing 
session. Until method close will not be called for this writer you can't get 
another writer. 
 
For example, next code isn't correct:


{code:java}
BinaryMapWriter<int64_t, int64_t> field1Writer = writer.WriteMap<int64_t, 
int64_t>("field1", MapType::HASH_MAP); //here you start writing session
BinaryMapWriter<int64_t, int64_t> field2Writer = writer.WriteMap<int64_t, 
int64_t>("field2", MapType::HASH_MAP); //here you start another writing session 
- error

{code}

Should be:
 
{code:java}
BinaryMapWriter<int64_t, int64_t> field1Writer = writer.WriteMap<int64_t, 
int64_t>("field1", MapType::HASH_MAP); //here you start writing session

//do something

field1Writer.Close() //here you end writing session

BinaryMapWriter<int64_t, int64_t> field2Writer = writer.WriteMap<int64_t, 
int64_t>("field2", MapType::HASH_MAP); //here you start another writing session

//do something

field2Writer.Close() //here you end another writing session
{code}
 
2) In case if you get some reader from BinaryWriter then you started reading 
session. Until something will not be read from this reader you can't get 
another reader. 
 
For example, next code isn't correct:
 
{code:java}
BinaryMapReader<int64_t, int64_t> field1Reader = reader.ReadMap<int64_t, 
int64_t>("field1"); //start reading session
BinaryMapReader<int64_t, int64_t> field2Reader = reader.ReadMap<int64_t, 
int64_t>("field2"); //start another read session - error

{code}
Should be for example:


{code:java}
BinaryMapReader<int64_t, int64_t> field1Reader = reader.ReadMap<int64_t, 
int64_t>("field1"); //start reading session

...
field1Reader.GetNext(key, val);  //reading done
...

BinaryMapReader<int64_t, int64_t> field2Reader = reader.ReadMap<int64_t, 
int64_t>("field2"); //start another read session

...
field2Reader.GetNext(key, val);  //reading done
...{code}
 
 
 
In the case of the writer, it could be it looks like expected. In case of the 
reader, it looks a little bit confusing.
 
These two behaviors should be described in the documentation as well.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to