### how the hydrus network synchronises

The hydrus network does not work like regular client-server architectures.

The most important difference is its decentralisation of processing; rather than make an expensive http request every time it wants something, the client makes an all-inclusive synchronisation request about once a day and performs all searches on its local cache.

### so, how does the client make sure it has what it needs to do its searches?

When the client contacts a repository, it downloads every single change that has occured since the last time it checked. It keeps all this data, and searches over whatever is appropriate to its own circumstances. If its local circumstances change (e.g. you import a thousand new files), it doesn't need to download anything more. A repository does not know anything about any particular client's circumstances.

### tell me more! use diagrams!

These diagrams are a little old! 'librarium' is the old name for the client, and the database looks a little different now, but they give the general idea.

tags:

files:

### the update request

The main request looks like this:

- GET /update?begin=1298778949 HTTP/1.1

Which is a standard http query. 'begin' is a timestamp telling the repository "please give me the update which starts with this timestamp" (begin=0 initialises). The repository answers in YAML, which you can review in include/HydrusConstants.py.

The update duration is currently 100,000 seconds.

### what about the other requests?

I suggest you review the code for information on the other requests. HydrusServer.py does the parsing, and ProcessRequest in the databases does most of the actual magic. ConnectionToService in ClientConstants.py does the client-side request-bundling and response parsing. If you have detailed questions, you can always email me!

YAML is very important in the hydrus network. I love it. Just do some googling if you want to learn more, and play around with yaml.safe_dump and yaml.safe_load in the python console to get some hands-on experience.