[ 
https://issues.apache.org/jira/browse/LUCENE-2126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789944#action_12789944
 ] 

Michael Busch commented on LUCENE-2126:
---------------------------------------

{quote}
What does a "normal" user do with a file?

   Step 1: Open the file.
   Step 2: Write data to the file.
   Step 3: Close the file.

Then, later...

   Step 1: Open the file.
   Step 2: Read data from the file.
   Step 3: Close the file.

You're saying that Lucene's file abstraction is easier to understand if you
break that up?
{quote}

No, I'm saying "normal" users do not work directly with files, so they won't do 
any of your steps above. They don't need to know those I/O related classes 
(except Directory).

DataInput/Output is about encoding/decoding of data, which is all a user of 
2125 needs to worry about. The user doesn't have to know that the attribute is 
first serialized into byte slices in TermsHashPerField and then written into 
the file(s) the actual codec defines.  

{quote}
But the idea that this strange fragmentation of the IO hierarchy makes things
easier - I don't get it at all. And I certainly don't see how it's such an
improvement over what exists now that it justifies a change to the public API.
{quote}

It makes it easier for a 2125 user. It does not make it harder for someone 
"advanced" who's dealing with IndexInput/Output already.

It makes it also cleaner - look e.g. at ByteSliceReader/Writer: those classes 
just currently throw RuntimeExceptions in the methods that this patch leaves in 
IndexInput/Output. Why? Because they're not dealing with file I/O, but with 
data (de)serialization.

> Split up IndexInput and IndexOutput into DataInput and DataOutput
> -----------------------------------------------------------------
>
>                 Key: LUCENE-2126
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2126
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: Flex Branch
>            Reporter: Michael Busch
>            Assignee: Michael Busch
>            Priority: Minor
>             Fix For: Flex Branch
>
>         Attachments: lucene-2126.patch
>
>
> I'd like to introduce the two new classes DataInput and DataOutput
> that contain all methods from IndexInput and IndexOutput that actually
> decode or encode data, such as readByte()/writeByte(),
> readVInt()/writeVInt().
> Methods like getFilePointer(), seek(), close(), etc., which are not
> related to data encoding, but to files as input/output source stay in
> IndexInput/IndexOutput.
> This patch also changes ByteSliceReader/ByteSliceWriter to extend
> DataInput/DataOutput. Previously ByteSliceReader implemented the
> methods that stay in IndexInput by throwing RuntimeExceptions.
> See also LUCENE-2125.
> All tests pass.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to