Commit 64adfd48 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Drop INVALID_PTID constant, replaced in memory by a None value.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2311 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 651e04e1
...@@ -107,7 +107,6 @@ cell_state_prefix_dict = { ...@@ -107,7 +107,6 @@ cell_state_prefix_dict = {
INVALID_UUID = '\0' * 16 INVALID_UUID = '\0' * 16
INVALID_TID = '\xff' * 8 INVALID_TID = '\xff' * 8
INVALID_OID = '\xff' * 8 INVALID_OID = '\xff' * 8
INVALID_PTID = '\0' * 8
INVALID_SERIAL = INVALID_TID INVALID_SERIAL = INVALID_TID
INVALID_PARTITION = 0xffffffff INVALID_PARTITION = 0xffffffff
ZERO_TID = '\0' * 8 ZERO_TID = '\0' * 8
...@@ -200,13 +199,14 @@ def _encodeUUID(uuid): ...@@ -200,13 +199,14 @@ def _encodeUUID(uuid):
return uuid return uuid
def _decodePTID(ptid): def _decodePTID(ptid):
if ptid == INVALID_PTID: ptid = unpack('!Q', ptid)[0]
if ptid == 0:
return None return None
return unpack('!Q', ptid)[0] return ptid
def _encodePTID(ptid): def _encodePTID(ptid):
if ptid is None: if ptid is None:
return INVALID_PTID ptid = 0
assert isinstance(ptid, (int, long)), ptid assert isinstance(ptid, (int, long)), ptid
return pack('!Q', ptid) return pack('!Q', ptid)
......
...@@ -19,7 +19,7 @@ import unittest ...@@ -19,7 +19,7 @@ import unittest
import MySQLdb import MySQLdb
from mock import Mock from mock import Mock
from neo.util import dump, p64, u64 from neo.util import dump, p64, u64
from neo.protocol import CellStates, INVALID_PTID, ZERO_OID, ZERO_TID, MAX_TID from neo.protocol import CellStates, ZERO_OID, ZERO_TID, MAX_TID
from neo.tests import NeoTestBase from neo.tests import NeoTestBase
from neo.exception import DatabaseFailure from neo.exception import DatabaseFailure
from neo.storage.database.mysqldb import MySQLDatabaseManager from neo.storage.database.mysqldb import MySQLDatabaseManager
......
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