Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does the community edition allow adding your own map implementation? #55

Closed
javafanboy opened this issue Jan 25, 2022 · 5 comments
Closed
Assignees
Labels

Comments

@javafanboy
Copy link

Type of question

Question about availability of a feature

Question

What did you do?
A clear and concise description of the steps you took (or insert a code snippet).

I would like to be able to write my own cache map implementation with Coherent community edition - is this possible?

@javafanboy javafanboy added the RFA label Jan 25, 2022
@aseovic
Copy link
Member

aseovic commented Jan 26, 2022

Of course -- there is no difference between community and commercial editions in this regard.

In general, any thread-safe java.util.Map implementation is an acceptable replacement for com.tangosol.net.cache.LocalCache (which is what is used by default), but it may limit the features that are available.

For example, to support events, it also needs to implement com.tangosol.util.ObservableMap interface, and to support caching (expiry, eviction, etc.) it needs to implement com.tangosol.net.cache.CacheMap, or better yet, com.tangosol.net.cache.ConfigurableCacheMap interface.

The above may require a lot of work to implement properly, so if you don't mind me asking, what are you trying to accomplish that one of the built-in implementations don't provide? If it's something that you think is generally useful, we are happy to accept contributions as well ;-)

@aseovic aseovic self-assigned this Jan 26, 2022
@javafanboy
Copy link
Author

javafanboy commented Jan 27, 2022

Great - some thoughts I had in mind was to look into developing implementations using Caffeine (i would also like @ben-manes take advantage of TinyFLU but at the same time have some other goodness provided by Coherence) and a local OSS KeyValue Database library like RocksDB or a high performance persisted Map like Chronicle Map (as Coherence CE as I understand it lacks the "elastic data" feature present in the commercial version).
Are there any blog-post or documentation section that you can sugest that clearly explains what you need to do in addition to implementing the class to use it as "part of" Coherence (i.e. how to configure its use etc.)?
Assuming I actually decide to do this I would of course be happy to contribute - that is what OSS is all about!

@aseovic
Copy link
Member

aseovic commented Jan 28, 2022

Awesome. There is already #16 and I just reached out to @ben-manes to see if he's willing to restart that work, and he is. Are you on public Coherence Slack? May be easier to continue specific discussion there.

But to answer your question, the backing map to use is configured via backing-map-scheme within cache config.

By default, most cache configs will have something like this within one of the higher level cache schemes, such as distributed-cache-scheme:

<backing-map-scheme>
    <local-scheme/>
</backing-map-scheme>

which will create and configure an instance of a LocalCache.

You can specify custom implementation via class-scheme:

<backing-map-scheme>
    <class-scheme>
        <class-name>com.tangosol.util.SafeHashMap</class-name>
    </class-scheme>
</backing-map-scheme>

@aseovic
Copy link
Member

aseovic commented Jan 28, 2022

Also, funny that you mention RocksDB and Chronicle: I'm actually looking into possible integration points with both Chronicle Map and Chronicle Queue myself for the last few days, and @mgamanho is playing with RocksDB atm.

Fortuitous timing, I guess... ;-)

@aseovic
Copy link
Member

aseovic commented Jan 28, 2022

Finally, in case you decide to contribute, please go ahead and sign the Oracle Contributor Agreement, so we don't have any admin hurdles in a way when the time comes to merge pull requests.

Also, please review Contributing Guidelines and Developer Guidelines before starting.

@aseovic aseovic closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants