Line 97: |
Line 97: |
| Data to receive: | | Data to receive: |
| :* property value in JSON notation. | | :* property value in JSON notation. |
| + | |
| + | === Notifications === |
| + | |
| + | It is possible to subscribe to server events. Notification will happen using HTML5 [[wikipedia:Server-sent_events|Server-sent events]]. |
| + | |
| + | To start subscription, send the following request: |
| + | |
| + | '''GET''' /?cmd='''subscribe'''[&only_commits=1] |
| + | |
| + | Where: |
| + | * {{Code|only_commits}},<br>subscribers can be notified only with ''commit'' events; that is useful to minimize interactions between server and clients. |
| + | |
| + | Response will be served with ''text/event-stream'' MIME type for default SSE message type. SSE message will be a JSONified object with the following, at least, attributes: |
| + | |
| + | * {{Code|event}}<br>event type. |
| | | |
| === Usage statistics === | | === Usage statistics === |
Line 113: |
Line 128: |
| * {{Code|values}} an array of {{Code|timestamp, row}} tuples when {{Code|row}} is a dictionary of database field names and values. | | * {{Code|values}} an array of {{Code|timestamp, row}} tuples when {{Code|row}} is a dictionary of database field names and values. |
| | | |
− | === Notifications === | + | === GNU/Linux packages meta database === |
| | | |
− | It is possible to subscribe to server events. Notification will happen using HTML5 [[wikipedia:Server-sent_events|Server-sent events]].
| + | There is a special Project resource, ''Packages''. This project is intended to support a metadata ''database'' for all GNU/Linux packages that are being used as dependencies for activities Sugar Network provides. |
| | | |
− | To start subscription, send the following request:
| + | Every entry in the ''Packages'' project is a map of native package names to a particular GNU/Linux distribution. So, activities mention only ''Packages'' entry name as a dependency. Afterwards, on a client side, a ''Packages'' entry name will be resolved to a package name according to the local distribution and it will be passed to the PackageKit to install corresponding dependency. |
| | | |
− | '''GET''' /?cmd='''subscribe'''[&only_commits=1]
| + | ''Packages'' project might be considered as a temporal solution when, and if, [http://distributions.freedesktop.org/wiki/AppStream/MetadataNotes AppStream's MetadataNotes] will be reused in the future. |
− | | |
− | Where:
| |
− | * {{Code|only_commits}},<br>subscribers can be notified only with ''commit'' events; that is useful to minimize interactions between server and clients.
| |
− | | |
− | Response will be served with ''text/event-stream'' MIME type for default SSE message type. SSE message will be a JSONified object with the following, at least, attributes:
| |
− | | |
− | * {{Code|event}}<br>event type.
| |
| | | |
| == Additional resources == | | == Additional resources == |
Line 147: |
Line 155: |
| * {{Code|PACKAGE}}<br>a name of the particular package. | | * {{Code|PACKAGE}}<br>a name of the particular package. |
| | | |
− | [[Sugar Network]] supports a metadata ''database'' for all packages that are being used as dependencies for activities it provides (see ''Packages'' project using one of the existing [[Sugar_Network#Try_it|Sugar Network clients]]). Every entry in the ''database'' contains a map of native package names for a particular GNU/Linux distribution. So, activities mention only the ''database'' entry name as a dependency. [[Sugar Network]] will automatically generate dependency graphs for packagekit-backend-presolve using the ''metadata'' database. Afterwards, on the launch side, the ''database'' entry name will be resolved to a package name according to the local distribution and it will be passed to the PackageKit (on XO laptops, packagekit-backend-presolve will be used; on regular platforms, the default PackageKit back-end is used). | + | Using [[#GNU/Linux packages meta database|Packages]]'s metadata, [[Sugar Network]] will automatically generate dependency graphs for packagekit-backend-presolve. |
− | | |
− | Packages metadata ''database'' might be considered as a temporal solution when, and if, [http://distributions.freedesktop.org/wiki/AppStream/MetadataNotes AppStream's MetadataNotes] will be reused in the future.
| |
| | | |
| == Local resources == | | == Local resources == |