VaclavDedik / infinispan-py

Python client for Infinispan key-value store
MIT License
3 stars 3 forks source link

Implement remote script execution #7

Open VaclavDedik opened 7 years ago

VaclavDedik commented 7 years ago

spec: http://infinispan.org/docs/stable/user_guide/user_guide.html#request_header

sonuagarwal1008 commented 7 years ago

@VaclavDedik hi, i want to contribute in infinispan-py can i start with this task? can you give some idea what exactly is to be done?

VaclavDedik commented 7 years ago

Hi! this task is about remote script execution, i.e. it should allow the user to put a JavaScript script on the infinispan server (which shouldn't need any implementation as it is done with simple client.put operation) and execute it (e.g. like this: client.exec('sample-script', params={k: 'exec-key', v: 'exec-value'}).

So, to implement this functionality, you need to implement the Exec request and response operations, which means you need to declare two classes in hotrod package:

class ExecRequest(Request):
    OP_CODE = 0x2B
    ...

class ExecResponse(Response):
    OP_CODE = 0x2C
    ...

You need to add the correct message fields in both the request and the response, see the other request and response types. The documentation is here: http://infinispan.org/docs/stable/user_guide/user_guide.html#request_header Or I think better documentation is here: https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/7.0/html/Developer_Guide/sect-Hot_Rod_Operations.html#Hot_Rod_Exec_Operation

You will also need to implement API for this in the Infinispan class, something like this:

def exec(self, script_name, params={}):
    ...

The script will be added with simple put operation, so that shouldn't need any implementation.