Conversation
a857f9e to
341f21a
Compare
Current coverage is 83.77%
@@ master #981 diff @@
==========================================
Files 17 17
Lines 5153 5064 -89
Methods 0 0
Messages 0 0
Branches 919 908 -11
==========================================
- Hits 4362 4242 -120
- Misses 571 596 +25
- Partials 220 226 +6
|
borg/item.py
Outdated
|
|
||
| def as_dict(self): | ||
| """return the internal dictionary""" | ||
| return self._dict # XXX use StableDict? |
There was a problem hiding this comment.
Since msgpack doesn't order keys (afaik)... yes, since hash-order in the item-stream would break metadata deduplication.
Would also avoid returning the mutable state of the object.
There was a problem hiding this comment.
yes, before msgpack is invoked, existing code always wrapped the existing dict with StableDict().
So, putting this into .as_dict() ...
|
I think this should use >>> from borg.item import Item
>>> item = Item()
>>> item.some_invalid_key = 1234
>>> serialized = item.as_dict()
>>> serialized
{}vs >>> from borg.item import Item
>>> item = Item()
>>> item.some_invalid_key = 1234
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Item' object has no attribute 'some_invalid_key' |
|
ok, good idea. |
f9cd9d9 to
af20e4b
Compare
af20e4b to
e6cf4ee
Compare
|
merge? this is isolated, so should be no problem. |
|
Just need to remember that we still have to do the actual refactoring :) |
Item class + tests for now, WIP.
This is just the isolated item class + tests for now.
When this is merged, there needs to be a widespread refactoring to actually use this.