Drop msgpack dependency

We've been using msgpack just to pack the API document into sqlite
binary documents. This is easily achievable with json. We can pull
msgpack in again when there's a real use case for it.

Change-Id: I60e31806edafd71de62a1809f047a8ad772094cc
This commit is contained in:
Flavio Percoco 2014-01-23 18:56:14 +01:00
parent 5bcdc9a7cd
commit 475332f9a8
2 changed files with 4 additions and 5 deletions

View File

@ -14,10 +14,10 @@
# limitations under the License.
import contextlib
import json
import sqlite3
import uuid
import msgpack
from oslo.config import cfg
from marconi.common import decorators
@ -126,10 +126,10 @@ class DataDriver(storage.DataDriverBase):
:param o: a Python str, unicode, int, long, float, bool, None
or a dict or list of %o
"""
return sqlite3.Binary(msgpack.dumps(o))
return sqlite3.Binary(json.dumps(o))
sqlite3.register_converter('DOCUMENT', lambda s:
msgpack.loads(s, encoding='utf-8'))
json.loads(s, encoding='utf-8'))
@staticmethod
def uuid(o):

View File

@ -77,10 +77,9 @@ class QueueController(base.QueueBase):
if project is None:
project = ''
# msgpack of {} is "\x80"
self.driver.run('''
insert or ignore into Queues
values (null, ?, ?, "\x80")
values (null, ?, ?, "{}")
''', project, name)
return self.driver.affected