Difference between revisions of "Deployment Platform/Sneakernet/Packets format"
Jump to navigation
Jump to search
(Created page with "Packets' structure: * '''PUSH''' packet: :* {{Code|type}}: {{Code|push}} :* {{Code|src}}: sender's identity to push from :* {{Code|[dst]}}: receiver's identity to push to, op...") |
m (moved Harmonic Distribution/Sneakernet/Packets format to Deployment Platform/Sneakernet/Packets format) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Packets | + | == Packets format == |
− | + | Packets are tarball files with {{Code|.packet}} suffix. | |
− | |||
− | |||
− | |||
− | |||
− | * '''ACK''' packet: | + | On logic level, every packet consists of: |
+ | |||
+ | * one header, a dictionary of key-value pairs; | ||
+ | * records, a dictionary of key-value pairs and optional data depending on record type. | ||
+ | |||
+ | == Header == | ||
+ | |||
+ | Header is being stored in JSON notation in {{Code|/header}} file in packet tarball. | ||
+ | |||
+ | * {{Code|src}}, sender's GUID | ||
+ | * {{Code|dst}}, optional destination GUID | ||
+ | * {{Code|filename}}, suggested file name for packet file, it is assumed to be unique | ||
+ | |||
+ | == Record types == | ||
+ | |||
+ | Push changes of Sugar Network resource's properties. | ||
+ | :* {{Code|cmd: sn_push}}; | ||
+ | :* {{Code|content_type: records}}; | ||
+ | :* {{Code|document}}, Sugar Network resource to push diff to; | ||
+ | :* {{Code|guid}}, document GUID to push diff for; | ||
+ | :* {{Code|diff}}, dictionary of {{Code|<prop_name>: {"value": <value>, "mtime": <mtime>}}} with changed property values. | ||
+ | |||
+ | '''ACK''' packet: | ||
:* {{Code|type}}: {{Code|ack}} | :* {{Code|type}}: {{Code|ack}} | ||
:* {{Code|src}}: master's identity | :* {{Code|src}}: master's identity | ||
Line 14: | Line 32: | ||
:* {{Code|pull_sequence}}: Sequence after merging original PUSH packet | :* {{Code|pull_sequence}}: Sequence after merging original PUSH packet | ||
− | * | + | Pull Sugar Network data. |
− | :* {{Code| | + | :* {{Code|cmd: sn_pull}}; |
− | :* {{Code| | + | :* {{Code|sequence}}: sequence to pull. |
− | :* {{Code| | + | |
− | :* {{Code|sequence}}: | + | Pull files from shared directory. |
+ | :* {{Code|cmd: files_pull}}; | ||
+ | :* {{Code|directory}}, synchronized directory to pull; | ||
+ | :* {{Code|sequence}}, sequence to pull. | ||
+ | |||
+ | Push a file from shared directory. | ||
+ | :* {{Code|cmd: files_push}}; | ||
+ | :* {{Code|directory}}, synchronized directory; | ||
+ | :* {{Code|path}}, pushed file path relative to {{Code|directory}}; | ||
+ | |||
+ | Push deleted file from shared directory. | ||
+ | :* {{Code|cmd: files_delete}}; | ||
+ | :* {{Code|directory}}, synchronized directory; | ||
+ | :* {{Code|path}}, pushed file path relative to {{Code|directory}}; | ||
+ | |||
+ | Commit recently pushed shared files. | ||
+ | :* {{Code|cmd: files_commit}}; | ||
+ | :* {{Code|directory}}, synchronized directory; | ||
+ | :* {{Code|sequence}}, pushed sequence. | ||
+ | |||
+ | Push usage statistics. | ||
+ | :* {{Code|cmd: stats_push}}; | ||
+ | :* {{Code|user}}, user GUID; | ||
+ | :* {{Code|db}}, RRD dn name; | ||
+ | :* {{Code|sequence}}, pushed sequence. | ||
+ | |||
+ | ACK pushed usage statistics. | ||
+ | :* {{Code|cmd: stats_ack}}; | ||
+ | :* {{Code|sequence}}, pushed sequence as {{Code|{user: {db: sequence}}}} dictionary. |
Latest revision as of 15:32, 8 October 2012
Packets format
Packets are tarball files with .packet
suffix.
On logic level, every packet consists of:
- one header, a dictionary of key-value pairs;
- records, a dictionary of key-value pairs and optional data depending on record type.
Header
Header is being stored in JSON notation in /header
file in packet tarball.
src
, sender's GUIDdst
, optional destination GUIDfilename
, suggested file name for packet file, it is assumed to be unique
Record types
Push changes of Sugar Network resource's properties.
cmd: sn_push
;content_type: records
;document
, Sugar Network resource to push diff to;guid
, document GUID to push diff for;diff
, dictionary of<prop_name>: {"value": <value>, "mtime": <mtime>
} with changed property values.
ACK packet:
type
:ack
src
: master's identitydst
: receiver's identity ack is intended forpush_sequence
: original PUSH packet's sequencepull_sequence
: Sequence after merging original PUSH packet
Pull Sugar Network data.
cmd: sn_pull
;sequence
: sequence to pull.
Pull files from shared directory.
cmd: files_pull
;directory
, synchronized directory to pull;sequence
, sequence to pull.
Push a file from shared directory.
cmd: files_push
;directory
, synchronized directory;path
, pushed file path relative todirectory
;
Push deleted file from shared directory.
cmd: files_delete
;directory
, synchronized directory;path
, pushed file path relative todirectory
;
Commit recently pushed shared files.
cmd: files_commit
;directory
, synchronized directory;sequence
, pushed sequence.
Push usage statistics.
cmd: stats_push
;user
, user GUID;db
, RRD dn name;sequence
, pushed sequence.
ACK pushed usage statistics.
cmd: stats_ack
;sequence
, pushed sequence as{user: {db: sequence
}} dictionary.