[ 
https://issues.apache.org/jira/browse/HBASE-5548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesse Yates updated HBASE-5548:
-------------------------------

    Attachment: ruby_HBASE-5548-v2.patch

Went back and forth a bunch on how I wanted to implement this (including coding 
up a couple different versions), hence the few days its taken me to get this 
patch up. 

Went with the current model as it helps keep concerns separate - table just 
does the internal work of how to do scans, puts, etc (the latter to be impl), 
and passes on the formatting work and specific help implementations to the 
command instances. 

To get here, had to add the ability to call a command by name in the Shell 
class, hence the internal_command method, but actually reuses most of the 
current support, even when calling the method from the table (safe views of 
commands, etc).

Final consideration: we may want to add a method to the command class so a 
command instance can add the ability to add a method to a table more easily, 
instead of having to add the section seen at the bottom of ::Commands::Scan, 
where we open back up the Table class. 

Thoughts? Or is that work minimal enough to justify for adding new commands?

If we are happy with this, I'll port the other table commands to this new model 
and post up a patch for review.

For completeness, the other major options considered:
* have table do all the formatting,etc now handled by the commands 
** side effect - commands are pretty useless except for help and is a pretty 
big rewrite and require the table to get a formmater as well as an instance of 
each command
** bonus - methods like scan_internal can be made private

* similar to this patch, but have the command on load register itself with the 
table so can do help
** minus - lots of reproduced functionality like what the Shell is currently 
doing with loading commands. Also, don't gain much and same problems as above
** bonus - code is a bit more centralized 
                
> Add ability to get a table in the shell
> ---------------------------------------
>
>                 Key: HBASE-5548
>                 URL: https://issues.apache.org/jira/browse/HBASE-5548
>             Project: HBase
>          Issue Type: Improvement
>          Components: shell
>            Reporter: Jesse Yates
>            Assignee: Jesse Yates
>             Fix For: 0.96.0
>
>         Attachments: ruby_HBASE-5528-v0.patch, ruby_HBASE-5548-v1.patch, 
> ruby_HBASE-5548-v2.patch
>
>
> Currently, all the commands that operate on a table in the shell first have 
> to take the table as name as input. 
> There are two main considerations:
> * It is annoying to have to write the table name every time, when you should 
> just be able to get a reference to a table
> * the current implementation is very wasteful - it creates a new HTable for 
> each call (but reuses the connection since it uses the same configuration)
> We should be able to get a handle to a single HTable and then operate on that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to