[
https://issues.apache.org/jira/browse/HBASE-19213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277336#comment-16277336
]
Appy commented on HBASE-19213:
------------------------------
(Probably better place for design related stuff)
Implementation in HTable/RemoteHTable/RawAyncTableImpl are almost same (except
then*()) functions.
Corresponding interface in AsyncTable#CheckAndMutateBuilder has almost all same
functions (except return type of then*()) functions.
Let's not copy-paste since it becomes increasingly hard to maintain equality of
things. For instance, if a change is done in AsyncTable#CheckAndMutateBuilder,
there's no way to make sure that it comes here.
Following is a suggestion which have few benefits:
1) ties the two interfaces in a generic way to make sure that they remain
"aligned" by means of compile checks. Will free us from doing similar aligning
work every release.
2) Gets rid of 3-way code duplication
{noformat}
------ Design------
interface CheckAndMutateBuilderBase<T> {
....common functions...
T then*();
}
class CheckAndMutateBuilderBaseImpl<T> implements CheckAndMutateBuilder<T> {
....common implementations (ie. all except then*() functions
}
interface Table {
....
interface CheckAndMutateBuilder extends CheckAndMutateBuilder<Boolean>;
}
interface AsyncTable {
....
interface CheckAndMutateBuilder extends
CheckAndMutateBuilder<CompletableFuture<Boolean>>;
}
{noformat}
Implementations use the CheckAndMutateBuilderBaseImpl.
What do you think?
> Align check and mutate operations in Table and AsyncTable
> ---------------------------------------------------------
>
> Key: HBASE-19213
> URL: https://issues.apache.org/jira/browse/HBASE-19213
> Project: HBase
> Issue Type: Sub-task
> Components: API
> Affects Versions: 2.0.0-alpha-4
> Reporter: Peter Somogyi
> Assignee: Peter Somogyi
> Priority: Minor
> Fix For: 2.0.0-beta-1
>
> Attachments: HBASE-19213.branch-2.002.patch,
> HBASE-19213.master.001.patch, HBASE-19213.master.001.patch,
> HBASE-19213.master.002.patch
>
>
> Check and mutate methods are way different. Table has checkAndx methods (some
> of them are deprecated), but AsyncTable has an interface called
> CheckAndMutateBuilder and these kind of operations are handled through that.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)