Commit 41b537c8 authored by Vincent Pelletier's avatar Vincent Pelletier

Move add64 to neo.util module.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2473 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4de58db3
......@@ -20,7 +20,7 @@ import neo
from neo.handler import EventHandler
from neo.protocol import Packets, ZERO_TID, ZERO_OID
from neo import util
from neo.util import add64
# TODO: benchmark how different values behave
RANGE_LENGTH = 4000
......@@ -78,10 +78,6 @@ def checkConnectionIsReplicatorConnection(func):
return result
return decorator
def add64(packed, offset):
"""Add a python number to a 64-bits packed value"""
return util.p64(util.u64(packed) + offset)
class ReplicationHandler(EventHandler):
"""This class handles events for replications."""
......
......@@ -17,9 +17,10 @@
import unittest
from mock import Mock
from neo.util import add64
from neo.tests import NeoUnitTestBase
from neo.protocol import Packets, ZERO_OID, ZERO_TID
from neo.storage.handlers.replication import ReplicationHandler, add64
from neo.storage.handlers.replication import ReplicationHandler
from neo.storage.handlers.replication import RANGE_LENGTH, MIN_RANGE_LENGTH
class FakeDict(object):
......
......@@ -28,6 +28,10 @@ def u64(s):
def p64(n):
return pack('!Q', n)
def add64(packed, offset):
"""Add a python number to a 64-bits packed value"""
return p64(u64(packed) + offset)
def dump(s):
"""Dump a binary string in hex."""
if s is None:
......
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