[
https://issues.apache.org/jira/browse/OAK-4642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15407403#comment-15407403
]
Chetan Mehrotra commented on OAK-4642:
--------------------------------------
With O2 we modify existing {{IndexUpdateCallback}} and thus all the places
where callback gets constructed would need to be modified. Further the place
where callback gets constructed might be not be aware of all the data
(indexPath etc) So it would not be possible also
With O4 we introduce a new interface
{code}
public interface ContextAwareCallback extends IndexUpdateCallback {
IndexingContext getIndexingContext();
}
{code}
And then in {{IndexUpdate}} instead of passing a normal callback we pass an
impl of ContextAwareCallback. Then index editor provider can check if the
provided callback is of new interface then cast and get the required context.
So here the changes required are very minimal. See the [o4
patch|^OAK-4642-o4-v1.patch] for just the approach (testcase pending)
> Provide a way to pass indexing related state to IndexEditorProvider
> -------------------------------------------------------------------
>
> Key: OAK-4642
> URL: https://issues.apache.org/jira/browse/OAK-4642
> Project: Jackrabbit Oak
> Issue Type: Technical task
> Components: core
> Reporter: Chetan Mehrotra
> Assignee: Chetan Mehrotra
> Fix For: 1.6
>
> Attachments: OAK-4642-o4-v1.patch
>
>
> An index editor needs access to some more data points like below in the
> indexing process
> # reindexing - Currently the index implementation use some heuristic like
> check before root state being empty to determine if they are running in
> reindexing mode
> # indexing mode - sync or async
> # index path of the index (see OAK-4152)
> # CommitInfo (see OAK-4640)
> For this we need to provide a way to pass these data points from indexing
> flow. We have following options
> * O1 - Introduce a new interface which takes an {{IndexingContext}} instance
> which provide access to such datapoints. This would require some broader
> change
> ** Whereever the IndexEditorProvider is invoked it would need to check if the
> instance implements new interface. If yes then new method needs to be used
> * O2 - Here we can introduce such data points as part of callback interface.
> With this we would need to implement such methods in places where code
> constructs the callback
> * O3 - Make a backward incompatible change and just modify the existing
> interface and adapt the various implementation
> * O4 - Similar to O2 but here instead of modifying the existing
> {{IndexUpdateCallback}} we can introduce a new interface
> {{ContextualCallback}} which extends {{IndexUpdateCallback}} and provide
> access to {{IndexingContext}}. Editor provider implementation can then check
> if the callback implements this new interface and then cast it and access the
> context. So only those client which are interested in new capability make use
> of this
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)