利用者:PeterCassetta/GSoC 2016/Server-Client Plans
目次
GSoC 2016 Python Package Manager - Server-Client Plans
This page aims to document in detail the plans for server-client communication, what will be hosted server-side, and other specifics for my project. Most everything will need to be decided on before I begin coding.
Sybren asked that I create a wiki page answering a bunch of questions he emailed me, so that will be my aim here. I'll try to answer questions as best as I can for now, and those I cannot yet give a firm answer for, I will discuss with others.
Server-Client Communication
How are the client and the server going to communicate?
The server and client will communicate over HTTPS.
Am I going for a RESTful interface with JSON over HTTP? Or something else?
Yes, Blender will request a single JSON file holding the information about all add-ons registered with the index. As per Sybren's suggestion, this file will be cached by Blender, and requested from the server with If-Modified-Since and If-None-Match HTTP headers.
I've created an example for the structure of this JSON file:
{ "schema_version": "1" "internal_url": "https://example.com/blender-addon-index/" "addons": { "example_addon_one": { "source": "internal" "name": "Example Add-on One" "description": "Example Description" "author": "Author Name" "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Example_Add-on_One" "tracker_url": "http://developer.blender.org/maniphest/task/create/?project=id&type=Bug" "location": "Window > Menu > Submenu" "category": "Category" "version": { "1.3.3": { "blender": "2.76.0" "support": "official" "filename": "1.3.3.py" } "1.4.0": { "blender": "2.77.0" "support": "official" "filename": "1.4.0.py" } } } "example_addon_two": { "source": "internal" "name": "Example Add-on Two" "description": "Example Description" "author": "Author 1 Name, Author 2 Name" "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Example_Add-on_Two" "tracker_url": "http://developer.blender.org/maniphest/task/create/?project=id&type=Bug" "location": "Window > Menu > Submenu" "category": "Category" "version": { "2.0.2": { "blender": "2.76.0" "warning": "Warning Text" "support": "testing" "filename": "2.0.2.zip" } "2.0.3": { "blender": "2.76.0" "support": "community" "filename": "2.0.3.zip" } "2.1.0": { "blender": "2.77.0" "support": "community" "filename": "2.1.0.zip" } } } "example_addon_three": { "source": "external" "external_url": "https://example.net/my-addon/" "name": "Example Add-on Three" "description": "Example Description" "author": "Author Name" "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Example_Add-on_Three" "tracker_url": "" "location": "Window > Menu > Submenu" "category": "Category" "version": { "0.3.2": { "blender": "2.77.0" "warning": "Warning Text" "support": "testing" "filename": "0.3.2.zip" } } } } }
This file would correspond to a file structure like the one proposed under Server-Side Storage.
If I'm going for a HTTP-based approach, what is the URL structure going to look like?
During GSoC at least, I plan to use the the below file structure:
index.json example_addon_one/ 1.3.3.py 1.4.0.py example_addon_two/ 2.0.2.zip 2.0.3.zip 2.1.0.zip
What information needs to be communicated?
- A list of all add-ons registered on the proposed "Blender Add-on Index"
- Each available version of every add-on
- The Blender version (or multiple versions?) each add-on supports
- Dependencies (possibly): Which version of other add-on(s) each add-on requires
- Likely the add-on download itself
How am I going to handle missing or malformed requests?
Will also be decided once more basic things such as protocol are chosen.
Server-Side Storage
What will need to be stored on the server?
A list of all available add-ons, each available version, the version of Blender each works with, and possibly dependency info at the very least. The add-ons themselves (in .zip/.py form) will probably need to be stored on the server as well.
Ton would highly prefer not having to install new software on blender.org, and requested I avoid this. I plan to double-check with him on this, but I believe he mentioned he was open to hosting add-ons as .zip/.py for the manager to download.
How will it be stored? In a relational database like MySQL, PostgreSQL or SQLite? NoSQL database like MongoDB?
I think a database would be over-complicating things, and using a version control system like git would be preferable.
Client-Side Code
How will I structure the client-side Python library, such that it can work asynchronously, and Blender can query things like download status/progress?
Protocol and server-side questions are more important to answer first, so I'll answer this when I have a better idea of how those things will look.