core, plugins file, XEP-0234, bridge: progression api enhancement:

- progressStarted have a new metadata parameter, useful to know the kind of progression, direction, etc. Check bridge doc
    - progressGetAllMetadata can be used to retrieve this data and discover on currently running progressions
    - progressFinished also have a new metadata parameter, used to e.g. indicate that hash is checked
    - core: fixed progressGetAll
    - file, XEP-0234: implemented the API modifications,  hash is returned on progressFinished
    - file: SatFile.checkSize allows to check size independently of close (be sure that all the data have been transfered though)
This commit is contained in:
Goffi 2015-11-19 18:13:26 +01:00
commit 55c75bc304
2 changed files with 161 additions and 29 deletions

View file

@ -196,13 +196,13 @@ class DbusObject(dbus.service.Object):
pass
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
signature='ss')
def progressFinished(self, id, profile):
signature='sa{ss}s')
def progressFinished(self, id, metadata, profile):
pass
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
signature='ss')
def progressStarted(self, id, profile):
signature='sa{ss}s')
def progressStarted(self, id, metadata, profile):
pass
@dbus.service.signal(const_INT_PREFIX+const_CORE_SUFFIX,
@ -458,6 +458,12 @@ class DbusObject(dbus.service.Object):
def progressGetAll(self, profile):
return self._callback("progressGetAll", unicode(profile))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='a{sa{sa{ss}}}',
async_callbacks=None)
def progressGetAllMetadata(self, profile):
return self._callback("progressGetAllMetadata", unicode(profile))
@dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX,
in_signature='s', out_signature='b',
async_callbacks=None)
@ -638,11 +644,11 @@ class DBusBridge(Bridge):
def progressError(self, error, profile, arg_2):
self.dbus_bridge.progressError(error, profile, arg_2)
def progressFinished(self, id, profile):
self.dbus_bridge.progressFinished(id, profile)
def progressFinished(self, id, metadata, profile):
self.dbus_bridge.progressFinished(id, metadata, profile)
def progressStarted(self, id, profile):
self.dbus_bridge.progressStarted(id, profile)
def progressStarted(self, id, metadata, profile):
self.dbus_bridge.progressStarted(id, metadata, profile)
def subscribe(self, sub_type, entity_jid, profile):
self.dbus_bridge.subscribe(sub_type, entity_jid, profile)

View file

@ -170,18 +170,28 @@ doc_param_3=%(doc_profile)s
[progressStarted]
type=signal
category=core
sig_in=ss
sig_in=sa{ss}s
doc=A progressing operation has just started
doc_param_0=id: id of the progression operation
doc_param_1=%(doc_profile)s
doc_param_1=metadata: dict of progress metadata, key can be:
- name: name of the progression, full path for a file
- direction: "in" for incoming data, "out" else
- type: type of the progression:
C.META_TYPE_FILE: file transfer
doc_param_2=%(doc_profile)s
[progressFinished]
type=signal
category=core
sig_in=ss
sig_in=sa{ss}s
doc=A progressing operation is finished
doc_param_0=id: id of the progression operation
doc_param_1=%(doc_profile)s
doc_param_1=metadata: dict of progress status metadata, key can be:
- hash: value of the computed hash
- hash_algo: alrorithm used to compute hash
- hash_verified: C.BOOL_TRUE if hash is verified and OK
C.BOOL_FALSE if hash was not received ([progressError] will be used if there is a mismatch)
doc_param_2=%(doc_profile)s
[progressError]
type=signal
@ -666,6 +676,17 @@ doc_return=dict with progress informations:
- position: current position
- size: end position
[progressGetAllMetadata]
type=method
category=core
sig_in=s
sig_out=a{sa{sa{ss}}}
doc=Get all active progress informations
doc_param_0=%(doc_profile)s or C.PROF_KEY_ALL for all profiles
doc_return= a dict which map profile to progress_dict
progress_dict map progress_id to progress_metadata
progress_metadata is the same dict as sent by [progressStarted]
[progressGetAll]
type=method
category=core