Commit 96a9413f authored by Tres Seaver's avatar Tres Seaver

Use a new magic number for protocol-3 filestorage.

parent 4eceeacb
...@@ -78,12 +78,13 @@ from ZODB._compat import loads ...@@ -78,12 +78,13 @@ from ZODB._compat import loads
from ZODB._compat import decodebytes from ZODB._compat import decodebytes
from ZODB._compat import encodebytes from ZODB._compat import encodebytes
from ZODB._compat import _protocol from ZODB._compat import _protocol
from ZODB._compat import FILESTORAGE_MAGIC
# Not all platforms have fsync # Not all platforms have fsync
fsync = getattr(os, "fsync", None) fsync = getattr(os, "fsync", None)
packed_version = b"FS21" packed_version = FILESTORAGE_MAGIC
logger = logging.getLogger('ZODB.FileStorage') logger = logging.getLogger('ZODB.FileStorage')
......
...@@ -23,6 +23,7 @@ try: ...@@ -23,6 +23,7 @@ try:
IMPORT_MAPPING = {} IMPORT_MAPPING = {}
NAME_MAPPING = {} NAME_MAPPING = {}
_protocol = 1 _protocol = 1
FILESTORAGE_MAGIC = b"FS21"
except ImportError: except ImportError:
# Python 3.x: can't use stdlib's pickle because # Python 3.x: can't use stdlib's pickle because
# http://bugs.python.org/issue6784 # http://bugs.python.org/issue6784
...@@ -57,6 +58,7 @@ except ImportError: ...@@ -57,6 +58,7 @@ except ImportError:
def loads(s): def loads(s):
return zodbpickle.pickle.loads(s, encoding='ASCII', errors='bytes') return zodbpickle.pickle.loads(s, encoding='ASCII', errors='bytes')
_protocol = 3 _protocol = 3
FILESTORAGE_MAGIC = b"FS30"
# XXX: consistent spelling of inst_persistent_id/persistent_id? # XXX: consistent spelling of inst_persistent_id/persistent_id?
......
...@@ -39,6 +39,7 @@ from __future__ import print_function ...@@ -39,6 +39,7 @@ from __future__ import print_function
import binascii import binascii
import struct import struct
import sys import sys
from ZODB._compat import FILESTORAGE_MAGIC
class FormatError(ValueError): class FormatError(ValueError):
"""There is a problem with the format of the FileStorage.""" """There is a problem with the format of the FileStorage."""
...@@ -47,7 +48,7 @@ class Status: ...@@ -47,7 +48,7 @@ class Status:
checkpoint = b'c' checkpoint = b'c'
undone = b'u' undone = b'u'
packed_version = b'FS21' packed_version = FILESTORAGE_MAGIC
TREC_HDR_LEN = 23 TREC_HDR_LEN = 23
DREC_HDR_LEN = 42 DREC_HDR_LEN = 42
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment