HTTP-APIs / hydra-python-agent

Python Hydra smart client and test console
MIT License
22 stars 42 forks source link

Generalise sync mechanism #141

Open chrizandr opened 4 years ago

chrizandr commented 4 years ago

I'm submitting a

Current Behaviour:

Right now the agent uses sockets to sync itself with a hydrus server.

Expected Behaviour:

This will not work with a purely REST based Hydra server. We need to make the agent generic to work with non-hydrus based Hydra servers.

Steps to reproduce:

Do you want to work on this issue?

thrishik7 commented 4 years ago

@chrizandr I haven't completely understood what has to been done. Should it be refactored by REST over Sockets?

sudipt1999 commented 4 years ago

@chrizandr currently the hydrus uses a socket functionality as implemented by @Guttz in his pull request https://github.com/HTTP-APIs/hydra-python-agent/pull/123, so I thing for making it generic we will require something like a generic Resource URIs instead of sockets so that we can communicate with them and maitain a table like structure to keep the records of sync updates. Adding few Resource URI's like

  1. api/last_updated
  2. api/updates Am I getting it right?`
sudipt1999 commented 4 years ago

@xadahiya @Guttz @Mec-iS ! kindly rectify if I am wrong!

Mec-iS commented 4 years ago

sockets are only used for the synchronisation mechanism. Standard REST uses HTTP requests.

As explained multiple times, there are two separate subsystems in place:

  1. the REST server endpoints: these are Hydra-described endpoints
  2. the sync mechanism: this is a hydrus/agent specific functionality (not in the standard), to allow hydrus to push updates to the agent so to save requests

we want to keep this setup, so any change to this is not required.

sudipt1999 commented 4 years ago

@Mec-iS so as given by @chrizandr

Current Behaviour:
Right now the agent uses sockets to sync itself with a hydrus server.

Expected Behaviour:
This will not work with a purely REST based Hydra server. We need to make the agent generic to work with non-hydrus based Hydra servers.

Doesn't the expected behaviour requires to remove sockets since they won;t work with REST based Hydra Server, so can we include some sort of caching to reduce the request!

Mec-iS commented 4 years ago

No. it implies adding HTTP requests when the server is not hydrus. In the case the server is not hydrus (but any other standard implementation), every time some data is needed in the agent it should issue a request to the server.

sudipt1999 commented 4 years ago

So, how do you propose to generalize the mechanism! @Mec-iS , I mean a rough idea !

Mec-iS commented 4 years ago

the sync mechanism for a non-hydrus server is simply requesting data via an HTTP request everytime is needed. So we should have code in the agent that finds out if the server is hydrus and switch between two modes:

In this last case the behaviour is exactly the one for Heracles.ts

sudipt1999 commented 4 years ago

@Mec-iS Thanks a lot! I got it how will we generalize the mechanicms now!

amalthundiyil commented 2 years ago

Has this issue been resolved ?