From fa3429f1ccaf275872ceb66d9d032abfd32a6743 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 4 Mar 2019 10:47:05 -0500 Subject: [PATCH 1/3] Serialize queue items using their path and type --- src/allmydata/frontends/magic_folder.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 851e271c7..0fb7b93f9 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -773,7 +773,7 @@ ALL_FILES = MessageType( _ITEMS = Field( u"items", - lambda deque: list(deque), + lambda deque: list(dict(relpath=item.relpath_u, kind=item.kind) for item in deque), u"Items in a processing queue.", ) @@ -1055,6 +1055,8 @@ class IQueuedItem(Interface): @implementer(IQueuedItem) class QueuedItem(object): + kind = None + def __init__(self, relpath_u, progress, size): self.relpath_u = relpath_u self.progress = progress @@ -1096,7 +1098,7 @@ class UploadItem(QueuedItem): """ Represents a single item the _deque of the Uploader """ - pass + kind = u"upload" _ITEM = Field( @@ -1611,6 +1613,8 @@ class DownloadItem(QueuedItem): """ Represents a single item in the _deque of the Downloader """ + kind = u"download" + def __init__(self, relpath_u, progress, filenode, metadata, size): super(DownloadItem, self).__init__(relpath_u, progress, size) self.file_node = filenode From 4ec6e59cc3014a1d944246e4a3c079221a72b57c Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 4 Mar 2019 10:47:29 -0500 Subject: [PATCH 2/3] news fragment --- newsfragments/2982.other | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/2982.other diff --git a/newsfragments/2982.other b/newsfragments/2982.other new file mode 100644 index 000000000..e69de29bb From 0be2cbccc928da9b03e44be4a9098b0adc29f81d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 4 Mar 2019 11:00:08 -0500 Subject: [PATCH 3/3] We don't need quoting in Eliot structured logs. Also quote_filepath seems to be doing the wrong thing but it's not entirely clear how. --- src/allmydata/frontends/magic_folder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 0fb7b93f9..6bf31dbd4 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -536,7 +536,7 @@ REMOVE_FROM_PENDING = ActionType( PATH = Field( u"path", - lambda fp: quote_filepath(fp), + lambda fp: fp.asTextMode().path, u"A local filesystem path.", eliotutil.validateInstanceOf(FilePath), )