Access to default policies via IAerospikeClient and IAsyncClient


#1

I’m thinking … wouldn’t it be useful to be able to get default policies (Policy, WritePolicy, …) via IAerospikeClient and IAsyncClient interfaces?

It would let to configure common setting in one place and make per operation adjustments just by applying delta.

Regards, Lukasz


#2

Yes, that was the intention when using AerospikeClient/AsyncClient directly. It didn’t get carried over to the interfaces. Are you using IAerospikeClient because of mock framework restrictions?


#3

Can’t exactly say, since it was 2 days ago and we are in the prototyping phase (we are moving very fast). I think it was Guice framework which couldn’t set up things correctly due to some issues with bytecode modification. I can’t say now what caused Guice to even think about bytecode modification, maybe we have some AOP weaver somewhere.

For now I’ve just copied default values and setup the Policy from scratch, but probably at some point we would like to end up with a cleaner approach. Especially that it might happen that we will use Aerospike more extensively.


#4

If you use AerospikeClient directly, you have access to the “public final” default policies, so you wouldn’t need to initialize the policies from scratch.

At some point, we either need to add get methods for these policies or just remove final from AerospikeClient class/methods which would mean IAerospikeClient is not necessary.