You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "David M. Lloyd (JIRA)" <ji...@apache.org> on 2008/01/04 17:44:34 UTC
[jira] Created: (DIRMINA-507) IoBuffer: Support prepending data
IoBuffer: Support prepending data
---------------------------------
Key: DIRMINA-507
URL: https://issues.apache.org/jira/browse/DIRMINA-507
Project: MINA
Issue Type: New Feature
Components: Core
Reporter: David M. Lloyd
Priority: Minor
I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
* A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
* A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
* Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559989#action_12559989 ]
David M. Lloyd commented on DIRMINA-507:
----------------------------------------
Yes, this might be possible. However, the semantics of a composite IoBuffer might be necessarily limited - in other words, writing might have to be disallowed to make it work predictably, or to make the implementation practical. Also if you compare the complexity of using a composite IoBuffer versus the current technique that I use, which is just to .skip() a set amount of bytes (and of course remember to .skip() the same number of bytes on .flip()), it may not be worth it.
In conclusion: ?????
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559070#action_12559070 ]
David M. Lloyd commented on DIRMINA-507:
----------------------------------------
Only if you copy the data - I'm proposing that a mechanism be added to reserve space at the start of the buffer. This way you could prepend data without incurring the overhead of copying.
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (DIRMINA-507) IoBuffer: Support
prepending data
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558944#action_12558944 ]
trustin edited comment on DIRMINA-507 at 1/14/08 11:16 PM:
---------------------------------------------------------------
Doesn't prepending slow down the overall performance degradation unless we have a CompositeIoBuffer?
We could simply provide move() method to create some room for prepending. WDYT?
was (Author: trustin):
Doesn't prepending slow down the overall performance unless we create a CompositeIoBuffer?
We could simply provide move() method to create some room for prepending. WDYT?
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556002#action_12556002 ]
David M. Lloyd commented on DIRMINA-507:
----------------------------------------
Or, to avoid extra methods, you could use a negative index for put*(int index, ...). Though that might introduce bugs since it's a behavior change...
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560954#action_12560954 ]
Trustin Lee commented on DIRMINA-507:
-------------------------------------
hmmm I think we need to try to implement a cool Composite buffer first to see how much capability it can have. Then we could decide we need prepend operations. Let me speed up! :)
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny updated DIRMINA-507:
--------------------------------------
Fix Version/s: 3.0.0-M1
Will be rethink totally in 3.0.
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
> Fix For: 3.0.0-M1
>
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559801#action_12559801 ]
Trustin Lee commented on DIRMINA-507:
-------------------------------------
Oh I see. Then it sounds pretty complicated comparing to CompositeIoBuffer idea. What do you think about waiting for CompositeIoBuffer implementation? You could allocate another buffer and create a new CompositeIoBuffer with the two buffers.
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558944#action_12558944 ]
Trustin Lee commented on DIRMINA-507:
-------------------------------------
Doesn't prepending slow down the overall performance unless we create a CompositeIoBuffer?
We could simply provide move() method to create some room for prepending. WDYT?
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIRMINA-507) IoBuffer: Support prepending data
Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555998#action_12555998 ]
David M. Lloyd commented on DIRMINA-507:
----------------------------------------
I guess the "prepend*()" methods would be more efficient overall than returning a slice, since a slice would always incur the overhead of, well, creating a slice, even if all you're doing is writing a single byte or int.
> IoBuffer: Support prepending data
> ---------------------------------
>
> Key: DIRMINA-507
> URL: https://issues.apache.org/jira/browse/DIRMINA-507
> Project: MINA
> Issue Type: New Feature
> Components: Core
> Reporter: David M. Lloyd
> Priority: Minor
>
> I'd like to see IoBuffer enhanced to support prepending data. It could work as follows:
> * A means to specificy or reserve space should be provided. An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer. IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided. An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area. Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data. Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.