Commit 7850ebec authored by Olivier Cros's avatar Olivier Cros

Move source code from neo/ to neo/lib

In order to prepare the eggification of the different neo parts, we created a
new neo/lib module, containing all of the main neo's functions. It allows to
make neo a virtual namespace, and so not containing module code anymore.




git-svn-id: https://svn.erp5.org/repos/neo/trunk@2615 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 49a524f1
# import pkg_resources
# Copyright (C) 2006-2010 Nexedi SA pkg_resources.declare_namespace(__name__)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging as logging_std
PREFIX = '%(asctime)s %(levelname)-9s %(name)-10s'
SUFFIX = ' [%(module)14s:%(lineno)3d] %(message)s'
def setupLog(name='NEO', filename=None, verbose=False):
global logging
if verbose:
level = logging_std.DEBUG
else:
level = logging_std.INFO
fmt = PREFIX + SUFFIX
logging = logging_std.getLogger(name.upper())
for handler in logging.handlers[:]:
logging.removeHandler(handler)
if filename is None:
handler = logging_std.StreamHandler()
else:
handler = logging_std.FileHandler(filename)
handler.setFormatter(logging_std.Formatter(fmt))
logging.setLevel(level)
logging.addHandler(handler)
logging.propagate = 0
# Create default logger
setupLog()
...@@ -15,19 +15,19 @@ ...@@ -15,19 +15,19 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.node import NodeManager from neo.lib.node import NodeManager
from neo.event import EventManager from neo.lib.event import EventManager
from neo.connection import ListeningConnection from neo.lib.connection import ListeningConnection
from neo.exception import PrimaryFailure from neo.lib.exception import PrimaryFailure
from neo.admin.handler import AdminEventHandler, MasterEventHandler, \ from neo.admin.handler import AdminEventHandler, MasterEventHandler, \
MasterRequestEventHandler MasterRequestEventHandler
from neo.connector import getConnectorHandler from neo.lib.connector import getConnectorHandler
from neo.bootstrap import BootstrapManager from neo.lib.bootstrap import BootstrapManager
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.protocol import NodeTypes, NodeStates, Packets, Errors from neo.lib.protocol import NodeTypes, NodeStates, Packets, Errors
from neo.live_debug import register as registerLiveDebugger from neo.lib.live_debug import register as registerLiveDebugger
class Dispatcher: class Dispatcher:
"""Dispatcher use to redirect master request to handler""" """Dispatcher use to redirect master request to handler"""
...@@ -68,7 +68,7 @@ class Application(object): ...@@ -68,7 +68,7 @@ class Application(object):
self.server = config.getBind() self.server = config.getBind()
self.master_addresses = config.getMasters() self.master_addresses = config.getMasters()
neo.logging.debug('IP address is %s, port is %d', *(self.server)) neo.lib.logging.debug('IP address is %s, port is %d', *(self.server))
# The partition table is initialized after getting the number of # The partition table is initialized after getting the number of
# partitions. # partitions.
...@@ -105,7 +105,7 @@ class Application(object): ...@@ -105,7 +105,7 @@ class Application(object):
while True: while True:
self.em.poll(1) self.em.poll(1)
except PrimaryFailure: except PrimaryFailure:
neo.logging.error('primary master is down') neo.lib.logging.error('primary master is down')
def connectToPrimary(self): def connectToPrimary(self):
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
import neo import neo
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo import protocol from neo.lib import protocol
from neo.protocol import Packets, Errors from neo.lib.protocol import Packets, Errors
from neo.exception import PrimaryFailure from neo.lib.exception import PrimaryFailure
from neo.util import dump from neo.lib.util import dump
def forward_ask(klass): def forward_ask(klass):
def wrapper(self, conn, *args, **kw): def wrapper(self, conn, *args, **kw):
...@@ -42,7 +42,7 @@ class AdminEventHandler(EventHandler): ...@@ -42,7 +42,7 @@ class AdminEventHandler(EventHandler):
"""This class deals with events for administrating cluster.""" """This class deals with events for administrating cluster."""
def askPartitionList(self, conn, min_offset, max_offset, uuid): def askPartitionList(self, conn, min_offset, max_offset, uuid):
neo.logging.info("ask partition list from %s to %s for %s" % neo.lib.logging.info("ask partition list from %s to %s for %s" %
(min_offset, max_offset, dump(uuid))) (min_offset, max_offset, dump(uuid)))
app = self.app app = self.app
# check we have one pt otherwise ask it to PMN # check we have one pt otherwise ask it to PMN
...@@ -61,7 +61,7 @@ class AdminEventHandler(EventHandler): ...@@ -61,7 +61,7 @@ class AdminEventHandler(EventHandler):
def askNodeList(self, conn, node_type): def askNodeList(self, conn, node_type):
neo.logging.info("ask node list for %s" %(node_type)) neo.lib.logging.info("ask node list for %s" %(node_type))
def node_filter(n): def node_filter(n):
return n.getType() is node_type return n.getType() is node_type
node_list = self.app.nm.getList(node_filter) node_list = self.app.nm.getList(node_filter)
...@@ -70,7 +70,7 @@ class AdminEventHandler(EventHandler): ...@@ -70,7 +70,7 @@ class AdminEventHandler(EventHandler):
conn.answer(p) conn.answer(p)
def setNodeState(self, conn, uuid, state, modify_partition_table): def setNodeState(self, conn, uuid, state, modify_partition_table):
neo.logging.info("set node state for %s-%s" %(dump(uuid), state)) neo.lib.logging.info("set node state for %s-%s" %(dump(uuid), state))
node = self.app.nm.getByUUID(uuid) node = self.app.nm.getByUUID(uuid)
if node is None: if node is None:
raise protocol.ProtocolError('invalid uuid') raise protocol.ProtocolError('invalid uuid')
...@@ -144,7 +144,7 @@ class MasterEventHandler(EventHandler): ...@@ -144,7 +144,7 @@ class MasterEventHandler(EventHandler):
def answerNodeInformation(self, conn): def answerNodeInformation(self, conn):
# XXX: This will no more exists when the initialization module will be # XXX: This will no more exists when the initialization module will be
# implemented for factorize code (as done for bootstrap) # implemented for factorize code (as done for bootstrap)
neo.logging.debug("answerNodeInformation") neo.lib.logging.debug("answerNodeInformation")
def notifyPartitionChanges(self, conn, ptid, cell_list): def notifyPartitionChanges(self, conn, ptid, cell_list):
self.app.pt.update(ptid, cell_list, self.app.nm) self.app.pt.update(ptid, cell_list, self.app.nm)
...@@ -176,12 +176,12 @@ class MasterRequestEventHandler(EventHandler): ...@@ -176,12 +176,12 @@ class MasterRequestEventHandler(EventHandler):
client_conn.answer(packet) client_conn.answer(packet)
def answerClusterState(self, conn, state): def answerClusterState(self, conn, state):
neo.logging.info("answerClusterState for a conn") neo.lib.logging.info("answerClusterState for a conn")
self.app.cluster_state = state self.app.cluster_state = state
self._answerNeoCTL(conn, Packets.AnswerClusterState(state)) self._answerNeoCTL(conn, Packets.AnswerClusterState(state))
def answerPartitionTable(self, conn, ptid, row_list): def answerPartitionTable(self, conn, ptid, row_list):
neo.logging.info("answerPartitionTable for a conn") neo.lib.logging.info("answerPartitionTable for a conn")
client_conn, kw = self.app.dispatcher.pop(conn.getPeerId()) client_conn, kw = self.app.dispatcher.pop(conn.getPeerId())
# sent client the partition table # sent client the partition table
self.app.sendPartitionTable(client_conn) self.app.sendPartitionTable(client_conn)
......
...@@ -19,9 +19,9 @@ from ZODB import BaseStorage, ConflictResolution, POSException ...@@ -19,9 +19,9 @@ from ZODB import BaseStorage, ConflictResolution, POSException
from zope.interface import implements from zope.interface import implements
import ZODB.interfaces import ZODB.interfaces
from neo import setupLog from neo.lib import setupLog
from neo.util import add64 from neo.lib.util import add64
from neo.protocol import ZERO_TID from neo.lib.protocol import ZERO_TID
from neo.client.app import Application from neo.client.app import Application
from neo.client.exception import NEOStorageNotFoundError from neo.client.exception import NEOStorageNotFoundError
from neo.client.exception import NEOStorageDoesNotExistError from neo.client.exception import NEOStorageDoesNotExistError
...@@ -255,7 +255,8 @@ class Storage(BaseStorage.BaseStorage, ...@@ -255,7 +255,8 @@ class Storage(BaseStorage.BaseStorage,
def pack(self, t, referencesf, gc=False): def pack(self, t, referencesf, gc=False):
if gc: if gc:
neo.logging.warning('Garbage Collection is not available in NEO, ' neo.lib.logging.warning(
'Garbage Collection is not available in NEO, '
'please use an external tool. Packing without GC.') 'please use an external tool. Packing without GC.')
self.app.pack(t) self.app.pack(t)
......
This diff is collapsed.
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.protocol import ProtocolError from neo.lib.protocol import ProtocolError
class BaseHandler(EventHandler): class BaseHandler(EventHandler):
"""Base class for client-side EventHandler implementations.""" """Base class for client-side EventHandler implementations."""
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.client.handlers import BaseHandler, AnswerBaseHandler from neo.client.handlers import BaseHandler, AnswerBaseHandler
from neo.pt import MTPartitionTable as PartitionTable from neo.lib.pt import MTPartitionTable as PartitionTable
from neo.protocol import NodeTypes, NodeStates, ProtocolError from neo.lib.protocol import NodeTypes, NodeStates, ProtocolError
from neo.util import dump from neo.lib.util import dump
from neo.client.exception import NEOStorageError from neo.client.exception import NEOStorageError
class PrimaryBootstrapHandler(AnswerBaseHandler): class PrimaryBootstrapHandler(AnswerBaseHandler):
...@@ -43,7 +43,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler): ...@@ -43,7 +43,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
if your_uuid is None: if your_uuid is None:
raise ProtocolError('No UUID supplied') raise ProtocolError('No UUID supplied')
app.uuid = your_uuid app.uuid = your_uuid
neo.logging.info('Got an UUID: %s', dump(app.uuid)) neo.lib.logging.info('Got an UUID: %s', dump(app.uuid))
node = app.nm.getByAddress(conn.getAddress()) node = app.nm.getByAddress(conn.getAddress())
conn.setUUID(uuid) conn.setUUID(uuid)
...@@ -66,7 +66,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler): ...@@ -66,7 +66,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
if primary_node is None: if primary_node is None:
# I don't know such a node. Probably this information # I don't know such a node. Probably this information
# is old. So ignore it. # is old. So ignore it.
neo.logging.warning('Unknown primary master UUID: %s. ' \ neo.lib.logging.warning('Unknown primary master UUID: %s. ' \
'Ignoring.' % dump(primary_uuid)) 'Ignoring.' % dump(primary_uuid))
else: else:
app.primary_master_node = primary_node app.primary_master_node = primary_node
...@@ -94,7 +94,7 @@ class PrimaryNotificationsHandler(BaseHandler): ...@@ -94,7 +94,7 @@ class PrimaryNotificationsHandler(BaseHandler):
def connectionClosed(self, conn): def connectionClosed(self, conn):
app = self.app app = self.app
neo.logging.critical("connection to primary master node closed") neo.lib.logging.critical("connection to primary master node closed")
conn.close() conn.close()
app.master_conn = None app.master_conn = None
app.primary_master_node = None app.primary_master_node = None
...@@ -104,19 +104,19 @@ class PrimaryNotificationsHandler(BaseHandler): ...@@ -104,19 +104,19 @@ class PrimaryNotificationsHandler(BaseHandler):
app = self.app app = self.app
if app.master_conn is not None: if app.master_conn is not None:
assert conn is app.master_conn assert conn is app.master_conn
neo.logging.critical("connection timeout to primary master node " \ neo.lib.logging.critical(
"expired") "connection timeout to primary master node expired")
BaseHandler.timeoutExpired(self, conn) BaseHandler.timeoutExpired(self, conn)
def peerBroken(self, conn): def peerBroken(self, conn):
app = self.app app = self.app
if app.master_conn is not None: if app.master_conn is not None:
assert conn is app.master_conn assert conn is app.master_conn
neo.logging.critical("primary master node is broken") neo.lib.logging.critical("primary master node is broken")
BaseHandler.peerBroken(self, conn) BaseHandler.peerBroken(self, conn)
def stopOperation(self, conn): def stopOperation(self, conn):
neo.logging.critical("master node ask to stop operation") neo.lib.logging.critical("master node ask to stop operation")
def invalidateObjects(self, conn, tid, oid_list): def invalidateObjects(self, conn, tid, oid_list):
app = self.app app = self.app
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
from ZODB.TimeStamp import TimeStamp from ZODB.TimeStamp import TimeStamp
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import neo import neo.lib
from neo.client.handlers import BaseHandler, AnswerBaseHandler from neo.client.handlers import BaseHandler, AnswerBaseHandler
from neo.protocol import NodeTypes, ProtocolError, LockState from neo.lib.protocol import NodeTypes, ProtocolError, LockState
from neo.util import dump from neo.lib.util import dump
from neo.client.exception import NEOStorageError, NEOStorageNotFoundError from neo.client.exception import NEOStorageError, NEOStorageNotFoundError
from neo.client.exception import NEOStorageDoesNotExistError from neo.client.exception import NEOStorageDoesNotExistError
...@@ -74,7 +74,7 @@ class StorageAnswersHandler(AnswerBaseHandler): ...@@ -74,7 +74,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
local_var = self.app.local_var local_var = self.app.local_var
object_stored_counter_dict = local_var.object_stored_counter_dict[oid] object_stored_counter_dict = local_var.object_stored_counter_dict[oid]
if conflicting: if conflicting:
neo.logging.info('%r report a conflict for %r with %r', conn, neo.lib.logging.info('%r report a conflict for %r with %r', conn,
dump(oid), dump(serial)) dump(oid), dump(serial))
conflict_serial_dict = local_var.conflict_serial_dict conflict_serial_dict = local_var.conflict_serial_dict
if serial in object_stored_counter_dict: if serial in object_stored_counter_dict:
...@@ -96,7 +96,7 @@ class StorageAnswersHandler(AnswerBaseHandler): ...@@ -96,7 +96,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
raise NEOStorageError('Wrong TID, transaction not started') raise NEOStorageError('Wrong TID, transaction not started')
def answerTIDsFrom(self, conn, tid_list): def answerTIDsFrom(self, conn, tid_list):
neo.logging.debug('Get %d TIDs from %r', len(tid_list), conn) neo.lib.logging.debug('Get %d TIDs from %r', len(tid_list), conn)
assert not self.app.local_var.tids_from.intersection(set(tid_list)) assert not self.app.local_var.tids_from.intersection(set(tid_list))
self.app.local_var.tids_from.update(tid_list) self.app.local_var.tids_from.update(tid_list)
...@@ -144,7 +144,7 @@ class StorageAnswersHandler(AnswerBaseHandler): ...@@ -144,7 +144,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
raise ConflictError, 'Lock wait timeout for oid %s on %r' % ( raise ConflictError, 'Lock wait timeout for oid %s on %r' % (
dump(oid), conn) dump(oid), conn)
elif status == LockState.GRANTED: elif status == LockState.GRANTED:
neo.logging.info('Store of oid %s was successful, but after ' \ neo.lib.logging.info('Store of oid %s was successful, but after ' \
'timeout.', dump(oid)) 'timeout.', dump(oid))
# XXX: Not sure what to do in this case yet, for now do nothing. # XXX: Not sure what to do in this case yet, for now do nothing.
else: else:
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
from ZODB import BaseStorage from ZODB import BaseStorage
from zope.interface import implements from zope.interface import implements
import ZODB.interfaces import ZODB.interfaces
from neo.util import u64, add64 from neo.lib.util import u64, add64
from neo.client.exception import NEOStorageCreationUndoneError from neo.client.exception import NEOStorageCreationUndoneError
from neo.client.exception import NEOStorageNotFoundError from neo.client.exception import NEOStorageNotFoundError
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from threading import Thread, Event, enumerate as thread_enum from threading import Thread, Event, enumerate as thread_enum
from neo.locking import Lock from neo.lib.locking import Lock
import neo import neo.lib
class _ThreadedPoll(Thread): class _ThreadedPoll(Thread):
"""Polling thread.""" """Polling thread."""
...@@ -34,7 +34,7 @@ class _ThreadedPoll(Thread): ...@@ -34,7 +34,7 @@ class _ThreadedPoll(Thread):
self._stop = Event() self._stop = Event()
def run(self): def run(self):
neo.logging.debug('Started %s', self) neo.lib.logging.debug('Started %s', self)
while not self.stopping(): while not self.stopping():
# First check if we receive any new message from other node # First check if we receive any new message from other node
try: try:
...@@ -42,8 +42,8 @@ class _ThreadedPoll(Thread): ...@@ -42,8 +42,8 @@ class _ThreadedPoll(Thread):
# interrupt this call when stopping. # interrupt this call when stopping.
self.em.poll(1) self.em.poll(1)
except: except:
self.neo.logging.error('poll raised, retrying', exc_info=1) self.neo.lib.logging.error('poll raised, retrying', exc_info=1)
self.neo.logging.debug('Threaded poll stopped') self.neo.lib.logging.debug('Threaded poll stopped')
self._stop.clear() self._stop.clear()
def stop(self): def stop(self):
...@@ -110,7 +110,7 @@ def psThreadedPoll(log=None): ...@@ -110,7 +110,7 @@ def psThreadedPoll(log=None):
Logs alive ThreadedPoll threads. Logs alive ThreadedPoll threads.
""" """
if log is None: if log is None:
log = neo.logging.debug log = neo.lib.logging.debug
for thread in thread_enum(): for thread in thread_enum():
if not isinstance(thread, ThreadedPoll): if not isinstance(thread, ThreadedPoll):
continue continue
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
import time import time
from random import shuffle from random import shuffle
import neo import neo.lib
from neo.locking import RLock from neo.lib.locking import RLock
from neo.protocol import NodeTypes, Packets from neo.lib.protocol import NodeTypes, Packets
from neo.connection import MTClientConnection, ConnectionClosed from neo.lib.connection import MTClientConnection, ConnectionClosed
from neo.client.exception import NEOStorageError from neo.client.exception import NEOStorageError
from neo.profiling import profiler_decorator from neo.lib.profiling import profiler_decorator
# How long before we might retry a connection to a node to which connection # How long before we might retry a connection to a node to which connection
# failed in the past. # failed in the past.
...@@ -61,7 +61,7 @@ class ConnectionPool(object): ...@@ -61,7 +61,7 @@ class ConnectionPool(object):
assert addr is not None assert addr is not None
app = self.app app = self.app
app.setNodeReady() app.setNodeReady()
neo.logging.debug('trying to connect to %s - %s', node, neo.lib.logging.debug('trying to connect to %s - %s', node,
node.getState()) node.getState())
conn = MTClientConnection(app.em, app.storage_event_handler, addr, conn = MTClientConnection(app.em, app.storage_event_handler, addr,
connector=app.connector_handler(), dispatcher=app.dispatcher) connector=app.connector_handler(), dispatcher=app.dispatcher)
...@@ -70,7 +70,7 @@ class ConnectionPool(object): ...@@ -70,7 +70,7 @@ class ConnectionPool(object):
try: try:
if conn.getConnector() is None: if conn.getConnector() is None:
# This happens, if a connection could not be established. # This happens, if a connection could not be established.
neo.logging.error('Connection to %r failed', node) neo.lib.logging.error('Connection to %r failed', node)
self.notifyFailure(node) self.notifyFailure(node)
return None return None
...@@ -84,15 +84,15 @@ class ConnectionPool(object): ...@@ -84,15 +84,15 @@ class ConnectionPool(object):
app._waitMessage(conn, msg_id, app._waitMessage(conn, msg_id,
handler=app.storage_bootstrap_handler) handler=app.storage_bootstrap_handler)
except ConnectionClosed: except ConnectionClosed:
neo.logging.error('Connection to %r failed', node) neo.lib.logging.error('Connection to %r failed', node)
self.notifyFailure(node) self.notifyFailure(node)
return None return None
if app.isNodeReady(): if app.isNodeReady():
neo.logging.info('Connected %r', node) neo.lib.logging.info('Connected %r', node)
return conn return conn
else: else:
neo.logging.info('%r not ready', node) neo.lib.logging.info('%r not ready', node)
self.notifyFailure(node) self.notifyFailure(node)
return NOT_READY return NOT_READY
...@@ -107,7 +107,7 @@ class ConnectionPool(object): ...@@ -107,7 +107,7 @@ class ConnectionPool(object):
not self.app.dispatcher.registered(conn): not self.app.dispatcher.registered(conn):
del self.connection_dict[conn.getUUID()] del self.connection_dict[conn.getUUID()]
conn.close() conn.close()
neo.logging.debug('_dropConnections : connection to ' \ neo.lib.logging.debug('_dropConnections : connection to ' \
'storage node %s:%d closed', *(conn.getAddress())) 'storage node %s:%d closed', *(conn.getAddress()))
if len(self.connection_dict) <= self.max_pool_size: if len(self.connection_dict) <= self.max_pool_size:
break break
......
#
# Copyright (C) 2006-2010 Nexedi SA
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging as logging_std
PREFIX = '%(asctime)s %(levelname)-9s %(name)-10s'
SUFFIX = ' [%(module)14s:%(lineno)3d] %(message)s'
def setupLog(name='NEO', filename=None, verbose=False):
global logging
if verbose:
level = logging_std.DEBUG
else:
level = logging_std.INFO
fmt = PREFIX + SUFFIX
logging = logging_std.getLogger(name.upper())
for handler in logging.handlers[:]:
logging.removeHandler(handler)
if filename is None:
handler = logging_std.StreamHandler()
else:
handler = logging_std.FileHandler(filename)
handler.setFormatter(logging_std.Formatter(fmt))
logging.setLevel(level)
logging.addHandler(handler)
logging.propagate = 0
# Create default logger
setupLog()
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
ATTRIBUTE_TRACKER_ENABLED = False ATTRIBUTE_TRACKER_ENABLED = False
from neo.locking import LockUser from neo.lib.locking import LockUser
""" """
Usage example: Usage example:
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
import neo import neo
from time import sleep from time import sleep
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.protocol import Packets from neo.lib.protocol import Packets
from neo.util import dump from neo.lib.util import dump
from neo.connection import ClientConnection from neo.lib.connection import ClientConnection
NO_SERVER = ('0.0.0.0', 0) NO_SERVER = ('0.0.0.0', 0)
...@@ -106,7 +106,7 @@ class BootstrapManager(EventHandler): ...@@ -106,7 +106,7 @@ class BootstrapManager(EventHandler):
conn.close() conn.close()
return return
neo.logging.info('connected to a primary master node') neo.lib.logging.info('connected to a primary master node')
conn.ask(Packets.RequestIdentification(self.node_type, conn.ask(Packets.RequestIdentification(self.node_type,
self.uuid, self.server, self.name)) self.uuid, self.server, self.name))
...@@ -120,7 +120,7 @@ class BootstrapManager(EventHandler): ...@@ -120,7 +120,7 @@ class BootstrapManager(EventHandler):
if self.uuid != your_uuid: if self.uuid != your_uuid:
# got an uuid from the primary master # got an uuid from the primary master
self.uuid = your_uuid self.uuid = your_uuid
neo.logging.info('Got a new UUID : %s' % dump(self.uuid)) neo.lib.logging.info('Got a new UUID : %s' % dump(self.uuid))
conn.setUUID(uuid) conn.setUUID(uuid)
def getPrimaryConnection(self, connector_handler): def getPrimaryConnection(self, connector_handler):
...@@ -128,7 +128,7 @@ class BootstrapManager(EventHandler): ...@@ -128,7 +128,7 @@ class BootstrapManager(EventHandler):
Primary lookup/connection process. Primary lookup/connection process.
Returns when the connection is made. Returns when the connection is made.
""" """
neo.logging.info('connecting to a primary master node') neo.lib.logging.info('connecting to a primary master node')
em, nm = self.app.em, self.app.nm em, nm = self.app.em, self.app.nm
index = 0 index = 0
self.current = nm.getMasterList()[0] self.current = nm.getMasterList()[0]
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from ConfigParser import SafeConfigParser from ConfigParser import SafeConfigParser
from neo import util from neo.lib import util
class ConfigurationManager(object): class ConfigurationManager(object):
......
...@@ -17,19 +17,19 @@ ...@@ -17,19 +17,19 @@
from time import time from time import time
import neo import neo.lib
from neo.locking import RLock from neo.lib.locking import RLock
from neo.protocol import PacketMalformedError, Packets, ParserState from neo.lib.protocol import PacketMalformedError, Packets, ParserState
from neo.connector import ConnectorException, ConnectorTryAgainException, \ from neo.lib.connector import ConnectorException, ConnectorTryAgainException, \
ConnectorInProgressException, ConnectorConnectionRefusedException, \ ConnectorInProgressException, ConnectorConnectionRefusedException, \
ConnectorConnectionClosedException ConnectorConnectionClosedException
from neo.util import dump from neo.lib.util import dump
from neo.logger import PACKET_LOGGER from neo.lib.logger import PACKET_LOGGER
from neo import attributeTracker from neo.lib import attributeTracker
from neo.util import ReadBuffer from neo.lib.util import ReadBuffer
from neo.profiling import profiler_decorator from neo.lib.profiling import profiler_decorator
PING_DELAY = 6 PING_DELAY = 6
PING_TIMEOUT = 5 PING_TIMEOUT = 5
...@@ -62,7 +62,7 @@ def lockCheckWrapper(func): ...@@ -62,7 +62,7 @@ def lockCheckWrapper(func):
def wrapper(self, *args, **kw): def wrapper(self, *args, **kw):
if not self._lock._is_owned(): if not self._lock._is_owned():
import traceback import traceback
neo.logging.warning('%s called on %s instance without being ' \ neo.lib.logging.warning('%s called on %s instance without being ' \
'locked. Stack:\n%s', func.func_code.co_name, 'locked. Stack:\n%s', func.func_code.co_name,
self.__class__.__name__, ''.join(traceback.format_stack())) self.__class__.__name__, ''.join(traceback.format_stack()))
# Call anyway # Call anyway
...@@ -163,7 +163,7 @@ class HandlerSwitcher(object): ...@@ -163,7 +163,7 @@ class HandlerSwitcher(object):
assert len(self._pending) == 1 or self._pending[0][0] assert len(self._pending) == 1 or self._pending[0][0]
PACKET_LOGGER.dispatch(connection, packet, 'from') PACKET_LOGGER.dispatch(connection, packet, 'from')
if connection.isClosed() and packet.ignoreOnClosedConnection(): if connection.isClosed() and packet.ignoreOnClosedConnection():
neo.logging.debug('Ignoring packet %r on closed connection %r', neo.lib.logging.debug('Ignoring packet %r on closed connection %r',
packet, connection) packet, connection)
return return
msg_id = packet.getId() msg_id = packet.getId()
...@@ -177,7 +177,8 @@ class HandlerSwitcher(object): ...@@ -177,7 +177,8 @@ class HandlerSwitcher(object):
if klass and isinstance(packet, klass) or packet.isError(): if klass and isinstance(packet, klass) or packet.isError():
handler.packetReceived(connection, packet) handler.packetReceived(connection, packet)
else: else:
neo.logging.error('Unexpected answer %r in %r', packet, connection) neo.lib.logging.error(
'Unexpected answer %r in %r', packet, connection)
notification = Packets.Notify('Unexpected answer: %r' % packet) notification = Packets.Notify('Unexpected answer: %r' % packet)
try: try:
connection.notify(notification) connection.notify(notification)
...@@ -188,7 +189,8 @@ class HandlerSwitcher(object): ...@@ -188,7 +189,8 @@ class HandlerSwitcher(object):
# apply a pending handler if no more answers are pending # apply a pending handler if no more answers are pending
while len(self._pending) > 1 and not self._pending[0][0]: while len(self._pending) > 1 and not self._pending[0][0]:
del self._pending[0] del self._pending[0]
neo.logging.debug('Apply handler %r on %r', self._pending[0][1], neo.lib.logging.debug(
'Apply handler %r on %r', self._pending[0][1],
connection) connection)
if timeout == self._next_timeout: if timeout == self._next_timeout:
self._updateNextTimeout() self._updateNextTimeout()
...@@ -286,12 +288,13 @@ class BaseConnection(object): ...@@ -286,12 +288,13 @@ class BaseConnection(object):
if handlers.isPending(): if handlers.isPending():
msg_id = handlers.checkTimeout(self, t) msg_id = handlers.checkTimeout(self, t)
if msg_id is not None: if msg_id is not None:
neo.logging.info('timeout for #0x%08x with %r', msg_id, self) neo.lib.logging.info(
'timeout for #0x%08x with %r', msg_id, self)
self.close() self.close()
self.getHandler().timeoutExpired(self) self.getHandler().timeoutExpired(self)
elif self._timeout.hardExpired(t): elif self._timeout.hardExpired(t):
# critical time reach or pong not received, abort # critical time reach or pong not received, abort
neo.logging.info('timeout with %r', self) neo.lib.logging.info('timeout with %r', self)
self.notify(Packets.Notify('Timeout')) self.notify(Packets.Notify('Timeout'))
self.abort() self.abort()
self.getHandler().timeoutExpired(self) self.getHandler().timeoutExpired(self)
...@@ -345,9 +348,9 @@ class BaseConnection(object): ...@@ -345,9 +348,9 @@ class BaseConnection(object):
def setHandler(self, handler): def setHandler(self, handler):
if self._handlers.setHandler(handler): if self._handlers.setHandler(handler):
neo.logging.debug('Set handler %r on %r', handler, self) neo.lib.logging.debug('Set handler %r on %r', handler, self)
else: else:
neo.logging.debug('Delay handler %r on %r', handler, self) neo.lib.logging.debug('Delay handler %r on %r', handler, self)
def getEventManager(self): def getEventManager(self):
return self.em return self.em
...@@ -386,7 +389,7 @@ class ListeningConnection(BaseConnection): ...@@ -386,7 +389,7 @@ class ListeningConnection(BaseConnection):
"""A listen connection.""" """A listen connection."""
def __init__(self, event_manager, handler, addr, connector, **kw): def __init__(self, event_manager, handler, addr, connector, **kw):
neo.logging.debug('listening to %s:%d', *addr) neo.lib.logging.debug('listening to %s:%d', *addr)
BaseConnection.__init__(self, event_manager, handler, BaseConnection.__init__(self, event_manager, handler,
addr=addr, connector=connector) addr=addr, connector=connector)
self.connector.makeListeningConnection(addr) self.connector.makeListeningConnection(addr)
...@@ -395,7 +398,7 @@ class ListeningConnection(BaseConnection): ...@@ -395,7 +398,7 @@ class ListeningConnection(BaseConnection):
def readable(self): def readable(self):
try: try:
new_s, addr = self.connector.getNewConnection() new_s, addr = self.connector.getNewConnection()
neo.logging.debug('accepted a connection from %s:%d', *addr) neo.lib.logging.debug('accepted a connection from %s:%d', *addr)
handler = self.getHandler() handler = self.getHandler()
new_conn = ServerConnection(self.getEventManager(), handler, new_conn = ServerConnection(self.getEventManager(), handler,
connector=new_s, addr=addr) connector=new_s, addr=addr)
...@@ -458,7 +461,7 @@ class Connection(BaseConnection): ...@@ -458,7 +461,7 @@ class Connection(BaseConnection):
return next_id return next_id
def close(self): def close(self):
neo.logging.debug('closing a connector for %r', self) neo.lib.logging.debug('closing a connector for %r', self)
BaseConnection.close(self) BaseConnection.close(self)
if self._on_close is not None: if self._on_close is not None:
self._on_close() self._on_close()
...@@ -469,7 +472,7 @@ class Connection(BaseConnection): ...@@ -469,7 +472,7 @@ class Connection(BaseConnection):
def abort(self): def abort(self):
"""Abort dealing with this connection.""" """Abort dealing with this connection."""
neo.logging.debug('aborting a connector for %r', self) neo.lib.logging.debug('aborting a connector for %r', self)
self.aborted = True self.aborted = True
def writable(self): def writable(self):
...@@ -556,17 +559,19 @@ class Connection(BaseConnection): ...@@ -556,17 +559,19 @@ class Connection(BaseConnection):
except ConnectorConnectionClosedException: except ConnectorConnectionClosedException:
# connection resetted by peer, according to the man, this error # connection resetted by peer, according to the man, this error
# should not occurs but it seems it's false # should not occurs but it seems it's false
neo.logging.debug('Connection reset by peer: %r', self.connector) neo.lib.logging.debug(
'Connection reset by peer: %r', self.connector)
self._closure() self._closure()
except: except:
neo.logging.debug('Unknown connection error: %r', self.connector) neo.lib.logging.debug(
'Unknown connection error: %r', self.connector)
self._closure() self._closure()
# unhandled connector exception # unhandled connector exception
raise raise
else: else:
if not data: if not data:
neo.logging.debug('Connection %r closed in recv', neo.lib.logging.debug(
self.connector) 'Connection %r closed in recv', self.connector)
self._closure() self._closure()
return return
self.read_buf.append(data) self.read_buf.append(data)
...@@ -583,16 +588,18 @@ class Connection(BaseConnection): ...@@ -583,16 +588,18 @@ class Connection(BaseConnection):
pass pass
except ConnectorConnectionClosedException: except ConnectorConnectionClosedException:
# connection resetted by peer # connection resetted by peer
neo.logging.debug('Connection reset by peer: %r', self.connector) neo.lib.logging.debug(
'Connection reset by peer: %r', self.connector)
self._closure() self._closure()
except: except:
neo.logging.debug('Unknown connection error: %r', self.connector) neo.lib.logging.debug(
'Unknown connection error: %r', self.connector)
# unhandled connector exception # unhandled connector exception
self._closure() self._closure()
raise raise
else: else:
if not n: if not n:
neo.logging.debug('Connection %r closed in send', neo.lib.logging.debug('Connection %r closed in send',
self.connector) self.connector)
self._closure() self._closure()
return return
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.locking import Lock from neo.lib.locking import Lock
from neo.profiling import profiler_decorator from neo.lib.profiling import profiler_decorator
EMPTY = {} EMPTY = {}
NOBODY = [] NOBODY = []
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from time import time from time import time
import neo import neo.lib
from neo.epoll import Epoll from neo.lib.epoll import Epoll
from neo.profiling import profiler_decorator from neo.lib.profiling import profiler_decorator
class EpollEventManager(object): class EpollEventManager(object):
"""This class manages connections and events based on epoll(5).""" """This class manages connections and events based on epoll(5)."""
...@@ -190,13 +190,13 @@ class EpollEventManager(object): ...@@ -190,13 +190,13 @@ class EpollEventManager(object):
self.epoll.modify(fd, fd in self.reader_set, 0) self.epoll.modify(fd, fd in self.reader_set, 0)
def log(self): def log(self):
neo.logging.info('Event Manager:') neo.lib.logging.info('Event Manager:')
neo.logging.info(' Readers: %r', [x for x in self.reader_set]) neo.lib.logging.info(' Readers: %r', [x for x in self.reader_set])
neo.logging.info(' Writers: %r', [x for x in self.writer_set]) neo.lib.logging.info(' Writers: %r', [x for x in self.writer_set])
neo.logging.info(' Connections:') neo.lib.logging.info(' Connections:')
pending_set = set(self._pending_processing) pending_set = set(self._pending_processing)
for fd, conn in self.connection_dict.items(): for fd, conn in self.connection_dict.items():
neo.logging.info(' %r: %r (pending=%r)', fd, conn, neo.lib.logging.info(' %r: %r (pending=%r)', fd, conn,
conn in pending_set) conn in pending_set)
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.protocol import NodeStates, ErrorCodes, Packets, Errors from neo.lib.protocol import NodeStates, ErrorCodes, Packets, Errors
from neo.protocol import PacketMalformedError, UnexpectedPacketError, \ from neo.lib.protocol import PacketMalformedError, UnexpectedPacketError, \
BrokenNodeDisallowedError, NotReadyError, ProtocolError BrokenNodeDisallowedError, NotReadyError, ProtocolError
...@@ -40,7 +40,7 @@ class EventHandler(object): ...@@ -40,7 +40,7 @@ class EventHandler(object):
else: else:
message = 'unexpected packet: %s in %s' % (message, message = 'unexpected packet: %s in %s' % (message,
self.__class__.__name__) self.__class__.__name__)
neo.logging.error(message) neo.lib.logging.error(message)
conn.answer(Errors.ProtocolError(message)) conn.answer(Errors.ProtocolError(message))
conn.abort() conn.abort()
self.peerBroken(conn) self.peerBroken(conn)
...@@ -58,7 +58,7 @@ class EventHandler(object): ...@@ -58,7 +58,7 @@ class EventHandler(object):
except UnexpectedPacketError, e: except UnexpectedPacketError, e:
self.__unexpectedPacket(conn, packet, *e.args) self.__unexpectedPacket(conn, packet, *e.args)
except PacketMalformedError: except PacketMalformedError:
neo.logging.error('malformed packet from %r', conn) neo.lib.logging.error('malformed packet from %r', conn)
conn.notify(Packets.Notify('Malformed packet: %r' % (packet, ))) conn.notify(Packets.Notify('Malformed packet: %r' % (packet, )))
conn.abort() conn.abort()
self.peerBroken(conn) self.peerBroken(conn)
...@@ -82,7 +82,7 @@ class EventHandler(object): ...@@ -82,7 +82,7 @@ class EventHandler(object):
def checkClusterName(self, name): def checkClusterName(self, name):
# raise an exception if the fiven name mismatch the current cluster name # raise an exception if the fiven name mismatch the current cluster name
if self.app.name != name: if self.app.name != name:
neo.logging.error('reject an alien cluster') neo.lib.logging.error('reject an alien cluster')
raise ProtocolError('invalid cluster name') raise ProtocolError('invalid cluster name')
...@@ -94,32 +94,32 @@ class EventHandler(object): ...@@ -94,32 +94,32 @@ class EventHandler(object):
def connectionStarted(self, conn): def connectionStarted(self, conn):
"""Called when a connection is started.""" """Called when a connection is started."""
neo.logging.debug('connection started for %r', conn) neo.lib.logging.debug('connection started for %r', conn)
def connectionCompleted(self, conn): def connectionCompleted(self, conn):
"""Called when a connection is completed.""" """Called when a connection is completed."""
neo.logging.debug('connection completed for %r', conn) neo.lib.logging.debug('connection completed for %r', conn)
def connectionFailed(self, conn): def connectionFailed(self, conn):
"""Called when a connection failed.""" """Called when a connection failed."""
neo.logging.debug('connection failed for %r', conn) neo.lib.logging.debug('connection failed for %r', conn)
def connectionAccepted(self, conn): def connectionAccepted(self, conn):
"""Called when a connection is accepted.""" """Called when a connection is accepted."""
def timeoutExpired(self, conn): def timeoutExpired(self, conn):
"""Called when a timeout event occurs.""" """Called when a timeout event occurs."""
neo.logging.debug('timeout expired for %r', conn) neo.lib.logging.debug('timeout expired for %r', conn)
self.connectionLost(conn, NodeStates.TEMPORARILY_DOWN) self.connectionLost(conn, NodeStates.TEMPORARILY_DOWN)
def connectionClosed(self, conn): def connectionClosed(self, conn):
"""Called when a connection is closed by the peer.""" """Called when a connection is closed by the peer."""
neo.logging.debug('connection closed for %r', conn) neo.lib.logging.debug('connection closed for %r', conn)
self.connectionLost(conn, NodeStates.TEMPORARILY_DOWN) self.connectionLost(conn, NodeStates.TEMPORARILY_DOWN)
def peerBroken(self, conn): def peerBroken(self, conn):
"""Called when a peer is broken.""" """Called when a peer is broken."""
neo.logging.error('%r is broken', conn) neo.lib.logging.error('%r is broken', conn)
self.connectionLost(conn, NodeStates.BROKEN) self.connectionLost(conn, NodeStates.BROKEN)
def connectionLost(self, conn, new_state): def connectionLost(self, conn, new_state):
...@@ -131,7 +131,7 @@ class EventHandler(object): ...@@ -131,7 +131,7 @@ class EventHandler(object):
# Packet handlers. # Packet handlers.
def notify(self, conn, message): def notify(self, conn, message):
neo.logging.info('notification from %r: %s', conn, message) neo.lib.logging.info('notification from %r: %s', conn, message)
def requestIdentification(self, conn, node_type, def requestIdentification(self, conn, node_type,
uuid, address, name): uuid, address, name):
...@@ -403,19 +403,19 @@ class EventHandler(object): ...@@ -403,19 +403,19 @@ class EventHandler(object):
def protocolError(self, conn, message): def protocolError(self, conn, message):
# the connection should have been closed by the remote peer # the connection should have been closed by the remote peer
neo.logging.error('protocol error: %s' % (message,)) neo.lib.logging.error('protocol error: %s' % (message,))
def timeoutError(self, conn, message): def timeoutError(self, conn, message):
neo.logging.error('timeout error: %s' % (message,)) neo.lib.logging.error('timeout error: %s' % (message,))
def brokenNodeDisallowedError(self, conn, message): def brokenNodeDisallowedError(self, conn, message):
raise RuntimeError, 'broken node disallowed error: %s' % (message,) raise RuntimeError, 'broken node disallowed error: %s' % (message,)
def alreadyPendingError(self, conn, message): def alreadyPendingError(self, conn, message):
neo.logging.error('already pending error: %s' % (message, )) neo.lib.logging.error('already pending error: %s' % (message, ))
def ack(self, conn, message): def ack(self, conn, message):
neo.logging.debug("no error message : %s" % (message)) neo.lib.logging.debug("no error message : %s" % (message))
# Fetch tables initialization # Fetch tables initialization
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo
from neo.protocol import PacketMalformedError from neo.lib.protocol import PacketMalformedError
from neo.util import dump from neo.lib.util import dump
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.profiling import profiler_decorator from neo.lib.profiling import profiler_decorator
LOGGER_ENABLED = False LOGGER_ENABLED = False
...@@ -37,7 +37,7 @@ class PacketLogger(object): ...@@ -37,7 +37,7 @@ class PacketLogger(object):
klass = packet.getType() klass = packet.getType()
uuid = dump(conn.getUUID()) uuid = dump(conn.getUUID())
ip, port = conn.getAddress() ip, port = conn.getAddress()
neo.logging.debug('#0x%08x %-30s %s %s (%s:%d)', packet.getId(), neo.lib.logging.debug('#0x%08x %-30s %s %s (%s:%d)', packet.getId(),
packet.__class__.__name__, direction, uuid, ip, port) packet.__class__.__name__, direction, uuid, ip, port)
# look for custom packet logger # look for custom packet logger
logger = self.packet_dispatch_table.get(klass, None) logger = self.packet_dispatch_table.get(klass, None)
...@@ -48,11 +48,11 @@ class PacketLogger(object): ...@@ -48,11 +48,11 @@ class PacketLogger(object):
try: try:
args = packet.decode() or () args = packet.decode() or ()
except PacketMalformedError: except PacketMalformedError:
neo.logging.warning("Can't decode packet for logging") neo.lib.logging.warning("Can't decode packet for logging")
return return
log_message = logger(conn, *args) log_message = logger(conn, *args)
if log_message is not None: if log_message is not None:
neo.logging.debug('#0x%08x %s', packet.getId(), log_message) neo.lib.logging.debug('#0x%08x %s', packet.getId(), log_message)
def error(self, conn, code, message): def error(self, conn, code, message):
return "%s (%s)" % (code, message) return "%s (%s)" % (code, message)
...@@ -64,7 +64,7 @@ class PacketLogger(object): ...@@ -64,7 +64,7 @@ class PacketLogger(object):
else: else:
address = '?' address = '?'
node = (dump(uuid), node_type, address, state) node = (dump(uuid), node_type, address, state)
neo.logging.debug(' ! %s | %8s | %22s | %s' % node) neo.lib.logging.debug(' ! %s | %8s | %22s | %s' % node)
PACKET_LOGGER = PacketLogger() PACKET_LOGGER = PacketLogger()
if not LOGGER_ENABLED: if not LOGGER_ENABLED:
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
from time import time from time import time
import neo import neo.lib
from neo.util import dump from neo.lib.util import dump
from neo.protocol import NodeTypes, NodeStates from neo.lib.protocol import NodeTypes, NodeStates
from neo import attributeTracker from neo.lib import attributeTracker
class Node(object): class Node(object):
"""This class represents a node.""" """This class represents a node."""
...@@ -263,7 +263,7 @@ class NodeManager(object): ...@@ -263,7 +263,7 @@ class NodeManager(object):
def add(self, node): def add(self, node):
if node in self._node_set: if node in self._node_set:
neo.logging.warning('adding a known node %r, ignoring', node) neo.lib.logging.warning('adding a known node %r, ignoring', node)
return return
self._node_set.add(node) self._node_set.add(node)
self._updateAddress(node, None) self._updateAddress(node, None)
...@@ -274,7 +274,7 @@ class NodeManager(object): ...@@ -274,7 +274,7 @@ class NodeManager(object):
def remove(self, node): def remove(self, node):
if node not in self._node_set: if node not in self._node_set:
neo.logging.warning('removing unknown node %r, ignoring', node) neo.lib.logging.warning('removing unknown node %r, ignoring', node)
return return
self._node_set.remove(node) self._node_set.remove(node)
self.__drop(self._address_dict, node.getAddress()) self.__drop(self._address_dict, node.getAddress())
...@@ -446,12 +446,12 @@ class NodeManager(object): ...@@ -446,12 +446,12 @@ class NodeManager(object):
log_args = (node_type, dump(uuid), addr, state) log_args = (node_type, dump(uuid), addr, state)
if node is None: if node is None:
if state == NodeStates.DOWN: if state == NodeStates.DOWN:
neo.logging.debug('NOT creating node %s %s %s %s', neo.lib.logging.debug('NOT creating node %s %s %s %s',
*log_args) *log_args)
else: else:
node = self._createNode(klass, address=addr, uuid=uuid, node = self._createNode(klass, address=addr, uuid=uuid,
state=state) state=state)
neo.logging.debug('creating node %r', node) neo.lib.logging.debug('creating node %r', node)
else: else:
assert isinstance(node, klass), 'node %r is not ' \ assert isinstance(node, klass), 'node %r is not ' \
'of expected type: %r' % (node, klass) 'of expected type: %r' % (node, klass)
...@@ -460,14 +460,15 @@ class NodeManager(object): ...@@ -460,14 +460,15 @@ class NodeManager(object):
'Discrepancy between node_by_uuid (%r) and ' \ 'Discrepancy between node_by_uuid (%r) and ' \
'node_by_addr (%r)' % (node_by_uuid, node_by_addr) 'node_by_addr (%r)' % (node_by_uuid, node_by_addr)
if state == NodeStates.DOWN: if state == NodeStates.DOWN:
neo.logging.debug('droping node %r (%r), found with %s ' \ neo.lib.logging.debug(
'droping node %r (%r), found with %s ' \
'%s %s %s', node, node.isConnected(), *log_args) '%s %s %s', node, node.isConnected(), *log_args)
if node.isConnected(): if node.isConnected():
# cut this connection, node removed by handler # cut this connection, node removed by handler
node.getConnection().close() node.getConnection().close()
self.remove(node) self.remove(node)
else: else:
neo.logging.debug('updating node %r to %s %s %s %s', neo.lib.logging.debug('updating node %r to %s %s %s %s',
node, *log_args) node, *log_args)
node.setUUID(uuid) node.setUUID(uuid)
node.setAddress(addr) node.setAddress(addr)
...@@ -475,12 +476,12 @@ class NodeManager(object): ...@@ -475,12 +476,12 @@ class NodeManager(object):
self.log() self.log()
def log(self): def log(self):
neo.logging.info('Node manager : %d nodes' % len(self._node_set)) neo.lib.logging.info('Node manager : %d nodes' % len(self._node_set))
for node in sorted(list(self._node_set)): for node in sorted(list(self._node_set)):
uuid = dump(node.getUUID()) or '-' * 32 uuid = dump(node.getUUID()) or '-' * 32
address = node.getAddress() or '' address = node.getAddress() or ''
if address: if address:
address = '%s:%d' % address address = '%s:%d' % address
neo.logging.info(' * %32s | %8s | %22s | %s' % ( neo.lib.logging.info(' * %32s | %8s | %22s | %s' % (
uuid, node.getType(), address, node.getState())) uuid, node.getType(), address, node.getState()))
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
from struct import pack, unpack, error, calcsize from struct import pack, unpack, error, calcsize
from socket import inet_ntoa, inet_aton from socket import inet_ntoa, inet_aton
from neo.profiling import profiler_decorator from neo.lib.profiling import profiler_decorator
from cStringIO import StringIO from cStringIO import StringIO
from neo.util import Enum from neo.lib.util import Enum
# The protocol version (major, minor). # The protocol version (major, minor).
PROTOCOL_VERSION = (4, 1) PROTOCOL_VERSION = (4, 1)
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
import neo import neo
from neo import protocol from neo.lib import protocol
from neo.protocol import CellStates from neo.lib.protocol import CellStates
from neo.util import dump, u64 from neo.lib.util import dump, u64
from neo.locking import RLock from neo.lib.locking import RLock
class PartitionTableException(Exception): class PartitionTableException(Exception):
""" """
...@@ -218,7 +218,7 @@ class PartitionTable(object): ...@@ -218,7 +218,7 @@ class PartitionTable(object):
# the node must be known by the node manager # the node must be known by the node manager
assert node is not None assert node is not None
self.setCell(offset, node, state) self.setCell(offset, node, state)
neo.logging.debug('partition table loaded') neo.lib.logging.debug('partition table loaded')
self.log() self.log()
def update(self, ptid, cell_list, nm): def update(self, ptid, cell_list, nm):
...@@ -228,14 +228,14 @@ class PartitionTable(object): ...@@ -228,14 +228,14 @@ class PartitionTable(object):
is not known, it is created in the node manager and set as unavailable is not known, it is created in the node manager and set as unavailable
""" """
if ptid <= self._id: if ptid <= self._id:
neo.logging.warning('ignoring older partition changes') neo.lib.logging.warning('ignoring older partition changes')
return return
self._id = ptid self._id = ptid
for offset, uuid, state in cell_list: for offset, uuid, state in cell_list:
node = nm.getByUUID(uuid) node = nm.getByUUID(uuid)
assert node is not None, 'No node found for uuid %r' % (dump(uuid), ) assert node is not None, 'No node found for uuid %r' % (dump(uuid), )
self.setCell(offset, node, state) self.setCell(offset, node, state)
neo.logging.debug('partition table updated') neo.lib.logging.debug('partition table updated')
self.log() self.log()
def filled(self): def filled(self):
...@@ -243,7 +243,7 @@ class PartitionTable(object): ...@@ -243,7 +243,7 @@ class PartitionTable(object):
def log(self): def log(self):
for line in self._format(): for line in self._format():
neo.logging.debug(line) neo.lib.logging.debug(line)
def format(self): def format(self):
return '\n'.join(self._format()) return '\n'.join(self._format())
......
...@@ -19,13 +19,13 @@ import neo ...@@ -19,13 +19,13 @@ import neo
import os, sys import os, sys
from time import time from time import time
from neo import protocol from neo.lib import protocol
from neo.protocol import UUID_NAMESPACES, ZERO_TID from neo.lib.protocol import UUID_NAMESPACES, ZERO_TID
from neo.protocol import ClusterStates, NodeStates, NodeTypes, Packets from neo.lib.protocol import ClusterStates, NodeStates, NodeTypes, Packets
from neo.node import NodeManager from neo.lib.node import NodeManager
from neo.event import EventManager from neo.lib.event import EventManager
from neo.connection import ListeningConnection, ClientConnection from neo.lib.connection import ListeningConnection, ClientConnection
from neo.exception import ElectionFailure, PrimaryFailure, OperationFailure from neo.lib.exception import ElectionFailure, PrimaryFailure, OperationFailure
from neo.master.handlers import election, identification, secondary from neo.master.handlers import election, identification, secondary
from neo.master.handlers import storage, client, shutdown from neo.master.handlers import storage, client, shutdown
from neo.master.handlers import administration from neo.master.handlers import administration
...@@ -33,10 +33,10 @@ from neo.master.pt import PartitionTable ...@@ -33,10 +33,10 @@ from neo.master.pt import PartitionTable
from neo.master.transactions import TransactionManager from neo.master.transactions import TransactionManager
from neo.master.verification import VerificationManager from neo.master.verification import VerificationManager
from neo.master.recovery import RecoveryManager from neo.master.recovery import RecoveryManager
from neo.util import dump from neo.lib.util import dump
from neo.connector import getConnectorHandler from neo.lib.connector import getConnectorHandler
from neo.live_debug import register as registerLiveDebugger from neo.lib.live_debug import register as registerLiveDebugger
class Application(object): class Application(object):
"""The master node application.""" """The master node application."""
...@@ -61,7 +61,7 @@ class Application(object): ...@@ -61,7 +61,7 @@ class Application(object):
for address in config.getMasters(): for address in config.getMasters():
self.nm.createMaster(address=address) self.nm.createMaster(address=address)
neo.logging.debug('IP address is %s, port is %d', *(self.server)) neo.lib.logging.debug('IP address is %s, port is %d', *(self.server))
# Partition table # Partition table
replicas, partitions = config.getReplicas(), config.getPartitions() replicas, partitions = config.getReplicas(), config.getPartitions()
...@@ -70,10 +70,10 @@ class Application(object): ...@@ -70,10 +70,10 @@ class Application(object):
if partitions <= 0: if partitions <= 0:
raise RuntimeError, 'partitions must be more than zero' raise RuntimeError, 'partitions must be more than zero'
self.pt = PartitionTable(partitions, replicas) self.pt = PartitionTable(partitions, replicas)
neo.logging.info('Configuration:') neo.lib.logging.info('Configuration:')
neo.logging.info('Partitions: %d', partitions) neo.lib.logging.info('Partitions: %d', partitions)
neo.logging.info('Replicas : %d', replicas) neo.lib.logging.info('Replicas : %d', replicas)
neo.logging.info('Name : %s', self.name) neo.lib.logging.info('Name : %s', self.name)
self.listening_conn = None self.listening_conn = None
self.primary = None self.primary = None
...@@ -86,7 +86,7 @@ class Application(object): ...@@ -86,7 +86,7 @@ class Application(object):
if uuid is None or uuid == '': if uuid is None or uuid == '':
uuid = self.getNewUUID(NodeTypes.MASTER) uuid = self.getNewUUID(NodeTypes.MASTER)
self.uuid = uuid self.uuid = uuid
neo.logging.info('UUID : %s', dump(uuid)) neo.lib.logging.info('UUID : %s', dump(uuid))
# election related data # election related data
self.unconnected_master_node_set = set() self.unconnected_master_node_set = set()
...@@ -107,7 +107,7 @@ class Application(object): ...@@ -107,7 +107,7 @@ class Application(object):
try: try:
self._run() self._run()
except: except:
neo.logging.info('\nPre-mortem informations:') neo.lib.logging.info('\nPre-mortem informations:')
self.log() self.log()
raise raise
...@@ -145,7 +145,7 @@ class Application(object): ...@@ -145,7 +145,7 @@ class Application(object):
others while attempting to connect to other master nodes at the others while attempting to connect to other master nodes at the
same time. Note that storage nodes and client nodes may connect same time. Note that storage nodes and client nodes may connect
to self as well as master nodes.""" to self as well as master nodes."""
neo.logging.info('begin the election of a primary master') neo.lib.logging.info('begin the election of a primary master')
self.unconnected_master_node_set.clear() self.unconnected_master_node_set.clear()
self.negotiating_master_node_set.clear() self.negotiating_master_node_set.clear()
...@@ -199,7 +199,7 @@ class Application(object): ...@@ -199,7 +199,7 @@ class Application(object):
for node in self.nm.getMasterList(): for node in self.nm.getMasterList():
if not node.isRunning() and node.getLastStateChange() + \ if not node.isRunning() and node.getLastStateChange() + \
expiration < current_time: expiration < current_time:
neo.logging.info('%s is down' % (node, )) neo.lib.logging.info('%s is down' % (node, ))
node.setDown() node.setDown()
self.unconnected_master_node_set.discard( self.unconnected_master_node_set.discard(
node.getAddress()) node.getAddress())
...@@ -222,7 +222,7 @@ class Application(object): ...@@ -222,7 +222,7 @@ class Application(object):
Broadcast the announce that I'm the primary Broadcast the announce that I'm the primary
""" """
# I am the primary. # I am the primary.
neo.logging.debug('I am the primary, sending an announcement') neo.lib.logging.debug('I am the primary, sending an announcement')
for conn in self.em.getClientList(): for conn in self.em.getClientList():
conn.notify(Packets.AnnouncePrimary()) conn.notify(Packets.AnnouncePrimary())
conn.abort() conn.abort()
...@@ -239,7 +239,7 @@ class Application(object): ...@@ -239,7 +239,7 @@ class Application(object):
""" """
Ask other masters to reelect a primary after an election failure. Ask other masters to reelect a primary after an election failure.
""" """
neo.logging.error('election failed: %s', (m, )) neo.lib.logging.error('election failed: %s', (m, ))
# Ask all connected nodes to reelect a single primary master. # Ask all connected nodes to reelect a single primary master.
for conn in self.em.getClientList(): for conn in self.em.getClientList():
...@@ -288,7 +288,7 @@ class Application(object): ...@@ -288,7 +288,7 @@ class Application(object):
def broadcastPartitionChanges(self, cell_list, selector=None): def broadcastPartitionChanges(self, cell_list, selector=None):
"""Broadcast a Notify Partition Changes packet.""" """Broadcast a Notify Partition Changes packet."""
neo.logging.debug('broadcastPartitionChanges') neo.lib.logging.debug('broadcastPartitionChanges')
if not cell_list: if not cell_list:
return return
if not selector: if not selector:
...@@ -308,7 +308,8 @@ class Application(object): ...@@ -308,7 +308,8 @@ class Application(object):
def broadcastLastOID(self): def broadcastLastOID(self):
oid = self.tm.getLastOID() oid = self.tm.getLastOID()
neo.logging.debug('Broadcast last OID to storages : %s' % dump(oid)) neo.lib.logging.debug(
'Broadcast last OID to storages : %s' % dump(oid))
packet = Packets.NotifyLastOID(oid) packet = Packets.NotifyLastOID(oid)
for node in self.nm.getStorageList(only_identified=True): for node in self.nm.getStorageList(only_identified=True):
node.notify(packet) node.notify(packet)
...@@ -319,7 +320,7 @@ class Application(object): ...@@ -319,7 +320,7 @@ class Application(object):
and stop the service only if a catastrophy happens or the user commits and stop the service only if a catastrophy happens or the user commits
a shutdown. a shutdown.
""" """
neo.logging.info('provide service') neo.lib.logging.info('provide service')
em = self.em em = self.em
self.tm.reset() self.tm.reset()
...@@ -332,7 +333,7 @@ class Application(object): ...@@ -332,7 +333,7 @@ class Application(object):
except OperationFailure: except OperationFailure:
# If not operational, send Stop Operation packets to storage # If not operational, send Stop Operation packets to storage
# nodes and client nodes. Abort connections to client nodes. # nodes and client nodes. Abort connections to client nodes.
neo.logging.critical('No longer operational') neo.lib.logging.critical('No longer operational')
for node in self.nm.getIdentifiedList(): for node in self.nm.getIdentifiedList():
if node.isStorage() or node.isClient(): if node.isStorage() or node.isClient():
node.notify(Packets.StopOperation()) node.notify(Packets.StopOperation())
...@@ -345,7 +346,8 @@ class Application(object): ...@@ -345,7 +346,8 @@ class Application(object):
return return
def playPrimaryRole(self): def playPrimaryRole(self):
neo.logging.info('play the primary role with %r', self.listening_conn) neo.lib.logging.info(
'play the primary role with %r', self.listening_conn)
# i'm the primary, send the announcement # i'm the primary, send the announcement
self._announcePrimary() self._announcePrimary()
...@@ -382,7 +384,7 @@ class Application(object): ...@@ -382,7 +384,7 @@ class Application(object):
""" """
I play a secondary role, thus only wait for a primary master to fail. I play a secondary role, thus only wait for a primary master to fail.
""" """
neo.logging.info('play the secondary role with %r', neo.lib.logging.info('play the secondary role with %r',
self.listening_conn) self.listening_conn)
# Wait for an announcement. If this is too long, probably # Wait for an announcement. If this is too long, probably
...@@ -496,7 +498,7 @@ class Application(object): ...@@ -496,7 +498,7 @@ class Application(object):
self.em.poll(1) self.em.poll(1)
if self.cluster_state != ClusterStates.RUNNING: if self.cluster_state != ClusterStates.RUNNING:
neo.logging.info("asking all nodes to shutdown") neo.lib.logging.info("asking all nodes to shutdown")
# This code sends packets but never polls, so they never reach # This code sends packets but never polls, so they never reach
# network. # network.
for node in self.nm.getIdentifiedList(): for node in self.nm.getIdentifiedList():
...@@ -533,7 +535,7 @@ class Application(object): ...@@ -533,7 +535,7 @@ class Application(object):
# always accept admin nodes # always accept admin nodes
node_ctor = self.nm.createAdmin node_ctor = self.nm.createAdmin
handler = administration.AdministrationHandler(self) handler = administration.AdministrationHandler(self)
neo.logging.info('Accept an admin %s' % (dump(uuid), )) neo.lib.logging.info('Accept an admin %s' % (dump(uuid), ))
elif node_type == NodeTypes.MASTER: elif node_type == NodeTypes.MASTER:
if node is None: if node is None:
# unknown master, rejected # unknown master, rejected
...@@ -541,15 +543,15 @@ class Application(object): ...@@ -541,15 +543,15 @@ class Application(object):
# always put other master in waiting state # always put other master in waiting state
node_ctor = self.nm.createMaster node_ctor = self.nm.createMaster
handler = secondary.SecondaryMasterHandler(self) handler = secondary.SecondaryMasterHandler(self)
neo.logging.info('Accept a master %s' % (dump(uuid), )) neo.lib.logging.info('Accept a master %s' % (dump(uuid), ))
elif node_type == NodeTypes.CLIENT: elif node_type == NodeTypes.CLIENT:
# refuse any client before running # refuse any client before running
if self.cluster_state != ClusterStates.RUNNING: if self.cluster_state != ClusterStates.RUNNING:
neo.logging.info('Reject a connection from a client') neo.lib.logging.info('Reject a connection from a client')
raise protocol.NotReadyError raise protocol.NotReadyError
node_ctor = self.nm.createClient node_ctor = self.nm.createClient
handler = client.ClientServiceHandler(self) handler = client.ClientServiceHandler(self)
neo.logging.info('Accept a client %s' % (dump(uuid), )) neo.lib.logging.info('Accept a client %s' % (dump(uuid), ))
elif node_type == NodeTypes.STORAGE: elif node_type == NodeTypes.STORAGE:
node_ctor = self.nm.createStorage node_ctor = self.nm.createStorage
if self._current_manager is not None: if self._current_manager is not None:
...@@ -557,7 +559,8 @@ class Application(object): ...@@ -557,7 +559,8 @@ class Application(object):
(uuid, state, handler) = identify(uuid, node) (uuid, state, handler) = identify(uuid, node)
else: else:
(uuid, state, handler) = self.identifyStorageNode(uuid, node) (uuid, state, handler) = self.identifyStorageNode(uuid, node)
neo.logging.info('Accept a storage %s (%s)' % (dump(uuid), state)) neo.lib.logging.info('Accept a storage %s (%s)' %
(dump(uuid), state))
return (uuid, node, state, handler, node_ctor) return (uuid, node, state, handler, node_ctor)
def onTransactionCommitted(self, txn): def onTransactionCommitted(self, txn):
......
...@@ -17,15 +17,16 @@ ...@@ -17,15 +17,16 @@
import neo import neo
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.protocol import NodeTypes, NodeStates, Packets from neo.lib.protocol import NodeTypes, NodeStates, Packets
from neo.util import dump from neo.lib.util import dump
class MasterHandler(EventHandler): class MasterHandler(EventHandler):
"""This class implements a generic part of the event handlers.""" """This class implements a generic part of the event handlers."""
def protocolError(self, conn, message): def protocolError(self, conn, message):
neo.logging.error('Protocol error %s %s', message, conn.getAddress()) neo.lib.logging.error(
'Protocol error %s %s', message, conn.getAddress())
def askPrimary(self, conn): def askPrimary(self, conn):
app = self.app app = self.app
...@@ -94,7 +95,7 @@ class BaseServiceHandler(MasterHandler): ...@@ -94,7 +95,7 @@ class BaseServiceHandler(MasterHandler):
if new_state != NodeStates.BROKEN and was_pending: if new_state != NodeStates.BROKEN and was_pending:
# was in pending state, so drop it from the node manager to forget # was in pending state, so drop it from the node manager to forget
# it and do not set in running state when it comes back # it and do not set in running state when it comes back
neo.logging.info('drop a pending node from the node manager') neo.lib.logging.info('drop a pending node from the node manager')
self.app.nm.remove(node) self.app.nm.remove(node)
self.app.broadcastNodesInformation([node]) self.app.broadcastNodesInformation([node])
# clean node related data in specialized handlers # clean node related data in specialized handlers
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
import neo import neo
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.protocol import ClusterStates, NodeStates, Packets, ProtocolError from neo.lib.protocol import ClusterStates, NodeStates, Packets, ProtocolError
from neo.protocol import Errors from neo.lib.protocol import Errors
from neo.util import dump from neo.lib.util import dump
CLUSTER_STATE_WORKFLOW = { CLUSTER_STATE_WORKFLOW = {
# destination: sources # destination: sources
...@@ -63,7 +63,7 @@ class AdministrationHandler(MasterHandler): ...@@ -63,7 +63,7 @@ class AdministrationHandler(MasterHandler):
self.app.shutdown() self.app.shutdown()
def setNodeState(self, conn, uuid, state, modify_partition_table): def setNodeState(self, conn, uuid, state, modify_partition_table):
neo.logging.info("set node state for %s-%s : %s" % neo.lib.logging.info("set node state for %s-%s : %s" %
(dump(uuid), state, modify_partition_table)) (dump(uuid), state, modify_partition_table))
app = self.app app = self.app
node = app.nm.getByUUID(uuid) node = app.nm.getByUUID(uuid)
...@@ -119,7 +119,7 @@ class AdministrationHandler(MasterHandler): ...@@ -119,7 +119,7 @@ class AdministrationHandler(MasterHandler):
def addPendingNodes(self, conn, uuid_list): def addPendingNodes(self, conn, uuid_list):
uuids = ', '.join([dump(uuid) for uuid in uuid_list]) uuids = ', '.join([dump(uuid) for uuid in uuid_list])
neo.logging.debug('Add nodes %s' % uuids) neo.lib.logging.debug('Add nodes %s' % uuids)
app = self.app app = self.app
nm = app.nm nm = app.nm
em = app.em em = app.em
...@@ -136,11 +136,11 @@ class AdministrationHandler(MasterHandler): ...@@ -136,11 +136,11 @@ class AdministrationHandler(MasterHandler):
uuid_set = uuid_set.intersection(set(uuid_list)) uuid_set = uuid_set.intersection(set(uuid_list))
# nothing to do # nothing to do
if not uuid_set: if not uuid_set:
neo.logging.warning('No nodes added') neo.lib.logging.warning('No nodes added')
conn.answer(Errors.Ack('No nodes added')) conn.answer(Errors.Ack('No nodes added'))
return return
uuids = ', '.join([dump(uuid) for uuid in uuid_set]) uuids = ', '.join([dump(uuid) for uuid in uuid_set])
neo.logging.info('Adding nodes %s' % uuids) neo.lib.logging.info('Adding nodes %s' % uuids)
# switch nodes to running state # switch nodes to running state
node_list = [nm.getByUUID(uuid) for uuid in uuid_set] node_list = [nm.getByUUID(uuid) for uuid in uuid_set]
for node in node_list: for node in node_list:
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.protocol import NodeStates, Packets, ProtocolError from neo.lib.protocol import NodeStates, Packets, ProtocolError
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.util import dump from neo.lib.util import dump
from neo.master.transactions import DelayedError from neo.master.transactions import DelayedError
class ClientServiceHandler(MasterHandler): class ClientServiceHandler(MasterHandler):
......
...@@ -15,14 +15,15 @@ ...@@ -15,14 +15,15 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.protocol import NodeTypes, Packets from neo.lib.protocol import NodeTypes, Packets
from neo.protocol import NotReadyError, ProtocolError, UnexpectedPacketError from neo.lib.protocol import NotReadyError, ProtocolError,
from neo.protocol import BrokenNodeDisallowedError UnexpectedPacketError
from neo.lib.protocol import BrokenNodeDisallowedError
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.exception import ElectionFailure from neo.lib.exception import ElectionFailure
from neo.util import dump from neo.lib.util import dump
class ClientElectionHandler(MasterHandler): class ClientElectionHandler(MasterHandler):
...@@ -90,7 +91,7 @@ class ClientElectionHandler(MasterHandler): ...@@ -90,7 +91,7 @@ class ClientElectionHandler(MasterHandler):
node = app.nm.getByAddress(conn.getAddress()) node = app.nm.getByAddress(conn.getAddress())
if node_type != NodeTypes.MASTER: if node_type != NodeTypes.MASTER:
# The peer is not a master node! # The peer is not a master node!
neo.logging.error('%r is not a master node', conn) neo.lib.logging.error('%r is not a master node', conn)
app.nm.remove(node) app.nm.remove(node)
app.negotiating_master_node_set.discard(node.getAddress()) app.negotiating_master_node_set.discard(node.getAddress())
conn.close() conn.close()
...@@ -99,7 +100,8 @@ class ClientElectionHandler(MasterHandler): ...@@ -99,7 +100,8 @@ class ClientElectionHandler(MasterHandler):
if your_uuid != app.uuid: if your_uuid != app.uuid:
# uuid conflict happened, accept the new one and restart election # uuid conflict happened, accept the new one and restart election
app.uuid = your_uuid app.uuid = your_uuid
neo.logging.info('UUID conflict, new UUID: %s', dump(your_uuid)) neo.lib.logging.info('UUID conflict, new UUID: %s',
dump(your_uuid))
raise ElectionFailure, 'new uuid supplied' raise ElectionFailure, 'new uuid supplied'
conn.setUUID(uuid) conn.setUUID(uuid)
...@@ -138,7 +140,8 @@ class ClientElectionHandler(MasterHandler): ...@@ -138,7 +140,8 @@ class ClientElectionHandler(MasterHandler):
if primary_node is None: if primary_node is None:
# I don't know such a node. Probably this information # I don't know such a node. Probably this information
# is old. So ignore it. # is old. So ignore it.
neo.logging.warning('received an unknown primary node UUID') neo.lib.logging.warning(
'received an unknown primary node UUID')
else: else:
# Whatever the situation is, I trust this master. # Whatever the situation is, I trust this master.
app.primary = False app.primary = False
...@@ -196,11 +199,11 @@ class ServerElectionHandler(MasterHandler): ...@@ -196,11 +199,11 @@ class ServerElectionHandler(MasterHandler):
self.checkClusterName(name) self.checkClusterName(name)
app = self.app app = self.app
if node_type != NodeTypes.MASTER: if node_type != NodeTypes.MASTER:
neo.logging.info('reject a connection from a non-master') neo.lib.logging.info('reject a connection from a non-master')
raise NotReadyError raise NotReadyError
node = app.nm.getByAddress(address) node = app.nm.getByAddress(address)
if node is None: if node is None:
neo.logging.error('unknown master node: %s' % (address, )) neo.lib.logging.error('unknown master node: %s' % (address, ))
raise ProtocolError('unknown master node') raise ProtocolError('unknown master node')
# If this node is broken, reject it. # If this node is broken, reject it.
if node.getUUID() == uuid: if node.getUUID() == uuid:
...@@ -236,5 +239,5 @@ class ServerElectionHandler(MasterHandler): ...@@ -236,5 +239,5 @@ class ServerElectionHandler(MasterHandler):
app.primary_master_node = node app.primary_master_node = node
app.unconnected_master_node_set.clear() app.unconnected_master_node_set.clear()
app.negotiating_master_node_set.clear() app.negotiating_master_node_set.clear()
neo.logging.info('%s is the primary', node) neo.lib.logging.info('%s is the primary', node)
...@@ -17,15 +17,16 @@ ...@@ -17,15 +17,16 @@
import neo import neo
from neo.protocol import NodeTypes, Packets from neo.lib.protocol import NodeTypes, Packets
from neo.protocol import BrokenNodeDisallowedError, ProtocolError from neo.lib.protocol import BrokenNodeDisallowedError, ProtocolError
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
class IdentificationHandler(MasterHandler): class IdentificationHandler(MasterHandler):
"""This class deals with messages from the admin node only""" """This class deals with messages from the admin node only"""
def nodeLost(self, conn, node): def nodeLost(self, conn, node):
neo.logging.warning('lost a node in IdentificationHandler : %s' % node) neo.lib.logging.warning('
lost a node in IdentificationHandler : %s' % node)
def requestIdentification(self, conn, node_type, uuid, address, name): def requestIdentification(self, conn, node_type, uuid, address, name):
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.exception import ElectionFailure, PrimaryFailure from neo.lib.exception import ElectionFailure, PrimaryFailure
from neo.protocol import NodeTypes, Packets from neo.lib.protocol import NodeTypes, Packets
class SecondaryMasterHandler(MasterHandler): class SecondaryMasterHandler(MasterHandler):
""" Handler used by primary to handle secondary masters""" """ Handler used by primary to handle secondary masters"""
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo import protocol from neo.lib import protocol
from neo.master.handlers import BaseServiceHandler from neo.master.handlers import BaseServiceHandler
class ShutdownHandler(BaseServiceHandler): class ShutdownHandler(BaseServiceHandler):
...@@ -24,15 +24,15 @@ class ShutdownHandler(BaseServiceHandler): ...@@ -24,15 +24,15 @@ class ShutdownHandler(BaseServiceHandler):
def requestIdentification(self, conn, node_type, def requestIdentification(self, conn, node_type,
uuid, address, name): uuid, address, name):
neo.logging.error('reject any new connection') neo.lib.logging.error('reject any new connection')
raise protocol.ProtocolError('cluster is shutting down') raise protocol.ProtocolError('cluster is shutting down')
def askPrimary(self, conn): def askPrimary(self, conn):
neo.logging.error('reject any new demand for primary master') neo.lib.logging.error('reject any new demand for primary master')
raise protocol.ProtocolError('cluster is shutting down') raise protocol.ProtocolError('cluster is shutting down')
def askBeginTransaction(self, conn, tid): def askBeginTransaction(self, conn, tid):
neo.logging.error('reject any new demand for new tid') neo.lib.logging.error('reject any new demand for new tid')
raise protocol.ProtocolError('cluster is shutting down') raise protocol.ProtocolError('cluster is shutting down')
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.protocol import ProtocolError from neo.lib.protocol import ProtocolError
from neo.protocol import Packets from neo.lib.protocol import Packets
from neo.master.handlers import BaseServiceHandler from neo.master.handlers import BaseServiceHandler
from neo.exception import OperationFailure from neo.lib.exception import OperationFailure
from neo.util import dump from neo.lib.util import dump
from neo.connector import ConnectorConnectionClosedException from neo.lib.connector import ConnectorConnectionClosedException
from neo.pt import PartitionTableException from neo.lib.pt import PartitionTableException
class StorageServiceHandler(BaseServiceHandler): class StorageServiceHandler(BaseServiceHandler):
...@@ -40,7 +40,7 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -40,7 +40,7 @@ class StorageServiceHandler(BaseServiceHandler):
conn.notify(Packets.StartOperation()) conn.notify(Packets.StartOperation())
def nodeLost(self, conn, node): def nodeLost(self, conn, node):
neo.logging.info('storage node lost') neo.lib.logging.info('storage node lost')
assert not node.isRunning(), node.getState() assert not node.isRunning(), node.getState()
if not self.app.pt.operational(): if not self.app.pt.operational():
...@@ -71,7 +71,7 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -71,7 +71,7 @@ class StorageServiceHandler(BaseServiceHandler):
def notifyReplicationDone(self, conn, offset): def notifyReplicationDone(self, conn, offset):
node = self.app.nm.getByUUID(conn.getUUID()) node = self.app.nm.getByUUID(conn.getUUID())
neo.logging.debug("%s is up for offset %s" % (node, offset)) neo.lib.logging.debug("%s is up for offset %s" % (node, offset))
try: try:
cell_list = self.app.pt.setUpToDate(node, offset) cell_list = self.app.pt.setUpToDate(node, offset)
except PartitionTableException, e: except PartitionTableException, e:
......
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo.pt import neo.lib.pt
from struct import pack, unpack from struct import pack, unpack
from neo.protocol import CellStates from neo.lib.protocol import CellStates
from neo.pt import PartitionTableException from neo.lib.pt import PartitionTableException
from neo.lib.pt import PartitionTable
class PartitionTable(neo.pt.PartitionTable): class PartitionTable(PartitionTable):
"""This class manages a partition table for the primary master node""" """This class manages a partition table for the primary master node"""
def setID(self, id): def setID(self, id):
...@@ -53,7 +54,7 @@ class PartitionTable(neo.pt.PartitionTable): ...@@ -53,7 +54,7 @@ class PartitionTable(neo.pt.PartitionTable):
row = [] row = []
for _ in xrange(repeats): for _ in xrange(repeats):
node = node_list[index] node = node_list[index]
row.append(neo.pt.Cell(node)) row.append(neo.lib.pt.Cell(node))
self.count_dict[node] = self.count_dict.get(node, 0) + 1 self.count_dict[node] = self.count_dict.get(node, 0) + 1
index += 1 index += 1
if index == len(node_list): if index == len(node_list):
...@@ -87,7 +88,8 @@ class PartitionTable(neo.pt.PartitionTable): ...@@ -87,7 +88,8 @@ class PartitionTable(neo.pt.PartitionTable):
node_list = [c.getNode() for c in row] node_list = [c.getNode() for c in row]
n = self.findLeastUsedNode(node_list) n = self.findLeastUsedNode(node_list)
if n is not None: if n is not None:
row.append(neo.pt.Cell(n, CellStates.OUT_OF_DATE)) row.append(neo.lib.pt.Cell(n,
CellStates.OUT_OF_DATE))
self.count_dict[n] += 1 self.count_dict[n] += 1
cell_list.append((offset, n.getUUID(), cell_list.append((offset, n.getUUID(),
CellStates.OUT_OF_DATE)) CellStates.OUT_OF_DATE))
...@@ -180,7 +182,7 @@ class PartitionTable(neo.pt.PartitionTable): ...@@ -180,7 +182,7 @@ class PartitionTable(neo.pt.PartitionTable):
continue continue
if num_cells <= self.nr: if num_cells <= self.nr:
row.append(neo.pt.Cell(node, CellStates.OUT_OF_DATE)) row.append(neo.lib.pt.Cell(node, CellStates.OUT_OF_DATE))
cell_list.append((offset, node.getUUID(), cell_list.append((offset, node.getUUID(),
CellStates.OUT_OF_DATE)) CellStates.OUT_OF_DATE))
node_count += 1 node_count += 1
...@@ -200,7 +202,7 @@ class PartitionTable(neo.pt.PartitionTable): ...@@ -200,7 +202,7 @@ class PartitionTable(neo.pt.PartitionTable):
CellStates.FEEDING)) CellStates.FEEDING))
# Don't count a feeding cell. # Don't count a feeding cell.
self.count_dict[max_cell.getNode()] -= 1 self.count_dict[max_cell.getNode()] -= 1
row.append(neo.pt.Cell(node, CellStates.OUT_OF_DATE)) row.append(neo.lib.pt.Cell(node, CellStates.OUT_OF_DATE))
cell_list.append((offset, node.getUUID(), cell_list.append((offset, node.getUUID(),
CellStates.OUT_OF_DATE)) CellStates.OUT_OF_DATE))
node_count += 1 node_count += 1
...@@ -281,7 +283,7 @@ class PartitionTable(neo.pt.PartitionTable): ...@@ -281,7 +283,7 @@ class PartitionTable(neo.pt.PartitionTable):
node = self.findLeastUsedNode([cell.getNode() for cell in row]) node = self.findLeastUsedNode([cell.getNode() for cell in row])
if node is None: if node is None:
break break
row.append(neo.pt.Cell(node, CellStates.OUT_OF_DATE)) row.append(neo.lib.pt.Cell(node, CellStates.OUT_OF_DATE))
changed_cell_list.append((offset, node.getUUID(), changed_cell_list.append((offset, node.getUUID(),
CellStates.OUT_OF_DATE)) CellStates.OUT_OF_DATE))
self.count_dict[node] += 1 self.count_dict[node] += 1
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
from struct import pack from struct import pack
import neo import neo
from neo.util import dump from neo.lib.util import dump
from neo.protocol import Packets, ProtocolError, ClusterStates, NodeStates from neo.lib.protocol import Packets, ProtocolError, ClusterStates, NodeStates
from neo.protocol import NotReadyError, ZERO_OID, ZERO_TID from neo.lib.protocol import NotReadyError, ZERO_OID, ZERO_TID
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
REQUIRED_NODE_NUMBER = 1 REQUIRED_NODE_NUMBER = 1
...@@ -43,7 +43,7 @@ class RecoveryManager(MasterHandler): ...@@ -43,7 +43,7 @@ class RecoveryManager(MasterHandler):
Returns the handler for storage nodes Returns the handler for storage nodes
""" """
if uuid is None and not self.app._startup_allowed: if uuid is None and not self.app._startup_allowed:
neo.logging.info('reject empty storage node') neo.lib.logging.info('reject empty storage node')
raise NotReadyError raise NotReadyError
return (uuid, NodeStates.RUNNING, self) return (uuid, NodeStates.RUNNING, self)
...@@ -54,7 +54,7 @@ class RecoveryManager(MasterHandler): ...@@ -54,7 +54,7 @@ class RecoveryManager(MasterHandler):
back the latest partition table or make a new table from scratch, back the latest partition table or make a new table from scratch,
if this is the first time. if this is the first time.
""" """
neo.logging.info('begin the recovery of the status') neo.lib.logging.info('begin the recovery of the status')
self.app.changeClusterState(ClusterStates.RECOVERING) self.app.changeClusterState(ClusterStates.RECOVERING)
em = self.app.em em = self.app.em
...@@ -66,7 +66,7 @@ class RecoveryManager(MasterHandler): ...@@ -66,7 +66,7 @@ class RecoveryManager(MasterHandler):
while not self.app._startup_allowed: while not self.app._startup_allowed:
em.poll(1) em.poll(1)
neo.logging.info('startup allowed') neo.lib.logging.info('startup allowed')
# build a new partition table # build a new partition table
if self.app.pt.getID() is None: if self.app.pt.getID() is None:
...@@ -81,13 +81,14 @@ class RecoveryManager(MasterHandler): ...@@ -81,13 +81,14 @@ class RecoveryManager(MasterHandler):
self.app.broadcastNodesInformation(refused_node_set) self.app.broadcastNodesInformation(refused_node_set)
self.app.setLastTransaction(self.app.tm.getLastTID()) self.app.setLastTransaction(self.app.tm.getLastTID())
neo.logging.debug('cluster starts with loid=%s and this partition ' \ neo.lib.logging.debug(
'table :', dump(self.app.tm.getLastOID())) 'cluster starts with loid=%s and this partition ' \
'table :', dump(self.app.tm.getLastOID()))
self.app.pt.log() self.app.pt.log()
def buildFromScratch(self): def buildFromScratch(self):
nm, em, pt = self.app.nm, self.app.em, self.app.pt nm, em, pt = self.app.nm, self.app.em, self.app.pt
neo.logging.debug('creating a new partition table, wait for a ' \ neo.lib.logging.debug('creating a new partition table, wait for a ' \
'storage node') 'storage node')
# wait for some empty storage nodes, their are accepted # wait for some empty storage nodes, their are accepted
while len(nm.getStorageList()) < REQUIRED_NODE_NUMBER: while len(nm.getStorageList()) < REQUIRED_NODE_NUMBER:
...@@ -131,7 +132,7 @@ class RecoveryManager(MasterHandler): ...@@ -131,7 +132,7 @@ class RecoveryManager(MasterHandler):
def answerPartitionTable(self, conn, ptid, row_list): def answerPartitionTable(self, conn, ptid, row_list):
if ptid != self.target_ptid: if ptid != self.target_ptid:
# If this is not from a target node, ignore it. # If this is not from a target node, ignore it.
neo.logging.warn('Got %s while waiting %s', dump(ptid), neo.lib.logging.warn('Got %s while waiting %s', dump(ptid),
dump(self.target_ptid)) dump(self.target_ptid))
return return
try: try:
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
from time import time, gmtime from time import time, gmtime
from struct import pack, unpack from struct import pack, unpack
from neo.protocol import ZERO_TID from neo.lib.protocol import ZERO_TID
from datetime import timedelta, datetime from datetime import timedelta, datetime
from neo.util import dump, u64, p64 from neo.lib.util import dump, u64, p64
import neo import neo.lib
TID_LOW_OVERFLOW = 2**32 TID_LOW_OVERFLOW = 2**32
TID_LOW_MAX = TID_LOW_OVERFLOW - 1 TID_LOW_MAX = TID_LOW_OVERFLOW - 1
...@@ -347,7 +347,8 @@ class TransactionManager(object): ...@@ -347,7 +347,8 @@ class TransactionManager(object):
else: else:
tid = self._nextTID(ttid, divisor) tid = self._nextTID(ttid, divisor)
self._queue.append((node.getUUID(), ttid)) self._queue.append((node.getUUID(), ttid))
neo.logging.debug('Finish TXN %s for %s (was %s)', dump(tid), node, dump(ttid)) neo.lib.logging.debug('Finish TXN %s for %s (was %s)',
dump(tid), node, dump(ttid))
txn = Transaction(node, ttid, tid, oid_list, uuid_list, msg_id) txn = Transaction(node, ttid, tid, oid_list, uuid_list, msg_id)
self._ttid_dict[ttid] = txn self._ttid_dict[ttid] = txn
self._node_dict.setdefault(node, {})[ttid] = txn self._node_dict.setdefault(node, {})[ttid] = txn
...@@ -418,7 +419,7 @@ class TransactionManager(object): ...@@ -418,7 +419,7 @@ class TransactionManager(object):
""" """
Abort pending transactions initiated by a node Abort pending transactions initiated by a node
""" """
neo.logging.debug('Abort TXN for %s', node) neo.lib.logging.debug('Abort TXN for %s', node)
uuid = node.getUUID() uuid = node.getUUID()
# XXX: this loop is usefull only during an import # XXX: this loop is usefull only during an import
for nuuid, ntid in list(self._queue): for nuuid, ntid in list(self._queue):
...@@ -433,7 +434,7 @@ class TransactionManager(object): ...@@ -433,7 +434,7 @@ class TransactionManager(object):
del self._node_dict[node] del self._node_dict[node]
def log(self): def log(self):
neo.logging.info('Transactions:') neo.lib.logging.info('Transactions:')
for txn in self._ttid_dict.itervalues(): for txn in self._ttid_dict.itervalues():
neo.logging.info(' %r', txn) neo.lib.logging.info(' %r', txn)
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo
from neo.util import dump from neo.lib.util import dump
from neo.protocol import ClusterStates, Packets, NodeStates from neo.lib.protocol import ClusterStates, Packets, NodeStates
from neo.master.handlers import BaseServiceHandler from neo.master.handlers import BaseServiceHandler
...@@ -117,11 +117,11 @@ class VerificationManager(BaseServiceHandler): ...@@ -117,11 +117,11 @@ class VerificationManager(BaseServiceHandler):
em, nm = self.app.em, self.app.nm em, nm = self.app.em, self.app.nm
# wait for any missing node # wait for any missing node
neo.logging.debug('waiting for the cluster to be operational') neo.lib.logging.debug('waiting for the cluster to be operational')
while not self.app.pt.operational(): while not self.app.pt.operational():
em.poll(1) em.poll(1)
neo.logging.info('start to verify data') neo.lib.logging.info('start to verify data')
# Gather all unfinished transactions. # Gather all unfinished transactions.
self._askStorageNodesAndWait(Packets.AskUnfinishedTransactions(), self._askStorageNodesAndWait(Packets.AskUnfinishedTransactions(),
...@@ -197,7 +197,7 @@ class VerificationManager(BaseServiceHandler): ...@@ -197,7 +197,7 @@ class VerificationManager(BaseServiceHandler):
def answerUnfinishedTransactions(self, conn, tid_list): def answerUnfinishedTransactions(self, conn, tid_list):
uuid = conn.getUUID() uuid = conn.getUUID()
neo.logging.info('got unfinished transactions %s from %r', neo.lib.logging.info('got unfinished transactions %s from %r',
[dump(tid) for tid in tid_list], conn) [dump(tid) for tid in tid_list], conn)
if not self._gotAnswerFrom(uuid): if not self._gotAnswerFrom(uuid):
return return
...@@ -222,19 +222,19 @@ class VerificationManager(BaseServiceHandler): ...@@ -222,19 +222,19 @@ class VerificationManager(BaseServiceHandler):
def tidNotFound(self, conn, message): def tidNotFound(self, conn, message):
uuid = conn.getUUID() uuid = conn.getUUID()
neo.logging.info('TID not found: %s', message) neo.lib.logging.info('TID not found: %s', message)
if not self._gotAnswerFrom(uuid): if not self._gotAnswerFrom(uuid):
return return
self._oid_set = None self._oid_set = None
def answerObjectPresent(self, conn, oid, tid): def answerObjectPresent(self, conn, oid, tid):
uuid = conn.getUUID() uuid = conn.getUUID()
neo.logging.info('object %s:%s found', dump(oid), dump(tid)) neo.lib.logging.info('object %s:%s found', dump(oid), dump(tid))
self._gotAnswerFrom(uuid) self._gotAnswerFrom(uuid)
def oidNotFound(self, conn, message): def oidNotFound(self, conn, message):
uuid = conn.getUUID() uuid = conn.getUUID()
neo.logging.info('OID not found: %s', message) neo.lib.logging.info('OID not found: %s', message)
app = self.app app = self.app
if not self._gotAnswerFrom(uuid): if not self._gotAnswerFrom(uuid):
return return
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.neoctl.neoctl import NeoCTL, NotReadyException from neo.neoctl.neoctl import NeoCTL, NotReadyException
from neo.util import bin, dump from neo.lib.util import bin, dump
from neo.protocol import ClusterStates, NodeStates, NodeTypes from neo.lib.protocol import ClusterStates, NodeStates, NodeTypes
action_dict = { action_dict = {
'print': { 'print': {
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.protocol import ErrorCodes, Packets from neo.lib.protocol import ErrorCodes, Packets
class CommandEventHandler(EventHandler): class CommandEventHandler(EventHandler):
""" Base handler for command """ """ Base handler for command """
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.connector import getConnectorHandler from neo.lib.connector import getConnectorHandler
from neo.connection import ClientConnection from neo.lib.connection import ClientConnection
from neo.event import EventManager from neo.lib.event import EventManager
from neo.neoctl.handler import CommandEventHandler from neo.neoctl.handler import CommandEventHandler
from neo.protocol import ClusterStates, NodeStates, ErrorCodes, Packets from neo.lib.protocol import ClusterStates, NodeStates, ErrorCodes, Packets
class NotReadyException(Exception): class NotReadyException(Exception):
pass pass
......
import pkg_resources
pkg_resources.declare_namespace(__name__)
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from optparse import OptionParser from optparse import OptionParser
from neo import setupLog from neo.lib import setupLog
from neo.config import ConfigurationManager from neo.lib.config import ConfigurationManager
parser = OptionParser() parser = OptionParser()
parser.add_option('-u', '--uuid', help='specify an UUID to use for this ' \ parser.add_option('-u', '--uuid', help='specify an UUID to use for this ' \
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import sys import sys
from optparse import OptionParser from optparse import OptionParser
from neo import setupLog from neo.lib import setupLog
parser = OptionParser() parser = OptionParser()
parser.add_option('-v', '--verbose', action = 'store_true', parser.add_option('-v', '--verbose', action = 'store_true',
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from optparse import OptionParser from optparse import OptionParser
from neo import setupLog from neo.lib import setupLog
from neo.config import ConfigurationManager from neo.lib.config import ConfigurationManager
parser = OptionParser() parser = OptionParser()
parser.add_option('-v', '--verbose', action = 'store_true', parser.add_option('-v', '--verbose', action = 'store_true',
......
...@@ -23,7 +23,7 @@ import logging ...@@ -23,7 +23,7 @@ import logging
import time import time
import os import os
from neo import setupLog from neo.lib import setupLog
# register options # register options
parser = OptionParser() parser = OptionParser()
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from optparse import OptionParser from optparse import OptionParser
from neo import setupLog from neo.lib import setupLog
from neo.config import ConfigurationManager from neo.lib.config import ConfigurationManager
parser = OptionParser() parser = OptionParser()
......
...@@ -19,23 +19,23 @@ import neo ...@@ -19,23 +19,23 @@ import neo
import sys import sys
from collections import deque from collections import deque
from neo.protocol import NodeTypes, CellStates, Packets from neo.lib.protocol import NodeTypes, CellStates, Packets
from neo.node import NodeManager from neo.lib.node import NodeManager
from neo.event import EventManager from neo.lib.event import EventManager
from neo.connection import ListeningConnection from neo.lib.connection import ListeningConnection
from neo.exception import OperationFailure, PrimaryFailure from neo.lib.exception import OperationFailure, PrimaryFailure
from neo.storage.handlers import identification, verification, initialization from neo.storage.handlers import identification, verification, initialization
from neo.storage.handlers import master, hidden from neo.storage.handlers import master, hidden
from neo.storage.replicator import Replicator from neo.storage.replicator import Replicator
from neo.storage.database import buildDatabaseManager from neo.storage.database import buildDatabaseManager
from neo.storage.transactions import TransactionManager from neo.storage.transactions import TransactionManager
from neo.storage.exception import AlreadyPendingError from neo.storage.exception import AlreadyPendingError
from neo.connector import getConnectorHandler from neo.lib.connector import getConnectorHandler
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.util import dump from neo.lib.util import dump
from neo.bootstrap import BootstrapManager from neo.lib.bootstrap import BootstrapManager
from neo.live_debug import register as registerLiveDebugger from neo.lib.live_debug import register as registerLiveDebugger
class Application(object): class Application(object):
"""The storage node application.""" """The storage node application."""
...@@ -59,7 +59,7 @@ class Application(object): ...@@ -59,7 +59,7 @@ class Application(object):
# set the bind address # set the bind address
self.server = config.getBind() self.server = config.getBind()
neo.logging.debug('IP address is %s, port is %d', *(self.server)) neo.lib.logging.debug('IP address is %s, port is %d', *(self.server))
# The partition table is initialized after getting the number of # The partition table is initialized after getting the number of
# partitions. # partitions.
...@@ -131,12 +131,12 @@ class Application(object): ...@@ -131,12 +131,12 @@ class Application(object):
# create a partition table # create a partition table
self.pt = PartitionTable(num_partitions, num_replicas) self.pt = PartitionTable(num_partitions, num_replicas)
neo.logging.info('Configuration loaded:') neo.lib.logging.info('Configuration loaded:')
neo.logging.info('UUID : %s', dump(self.uuid)) neo.lib.logging.info('UUID : %s', dump(self.uuid))
neo.logging.info('PTID : %s', dump(ptid)) neo.lib.logging.info('PTID : %s', dump(ptid))
neo.logging.info('Name : %s', self.name) neo.lib.logging.info('Name : %s', self.name)
neo.logging.info('Partitions: %s', num_partitions) neo.lib.logging.info('Partitions: %s', num_partitions)
neo.logging.info('Replicas : %s', num_replicas) neo.lib.logging.info('Replicas : %s', num_replicas)
def loadPartitionTable(self): def loadPartitionTable(self):
"""Load a partition table from the database.""" """Load a partition table from the database."""
...@@ -161,7 +161,7 @@ class Application(object): ...@@ -161,7 +161,7 @@ class Application(object):
try: try:
self._run() self._run()
except: except:
neo.logging.info('\nPre-mortem informations:') neo.lib.logging.info('\nPre-mortem informations:')
self.log() self.log()
raise raise
...@@ -202,10 +202,10 @@ class Application(object): ...@@ -202,10 +202,10 @@ class Application(object):
self.doOperation() self.doOperation()
raise RuntimeError, 'should not reach here' raise RuntimeError, 'should not reach here'
except OperationFailure, msg: except OperationFailure, msg:
neo.logging.error('operation stopped: %s', msg) neo.lib.logging.error('operation stopped: %s', msg)
except PrimaryFailure, msg: except PrimaryFailure, msg:
self.replicator.masterLost() self.replicator.masterLost()
neo.logging.error('primary master is down: %s', msg) neo.lib.logging.error('primary master is down: %s', msg)
self.master_node = None self.master_node = None
def connectToPrimary(self): def connectToPrimary(self):
...@@ -230,7 +230,7 @@ class Application(object): ...@@ -230,7 +230,7 @@ class Application(object):
(node, conn, uuid, num_partitions, num_replicas) = data (node, conn, uuid, num_partitions, num_replicas) = data
self.master_node = node self.master_node = node
self.master_conn = conn self.master_conn = conn
neo.logging.info('I am %s', dump(uuid)) neo.lib.logging.info('I am %s', dump(uuid))
self.uuid = uuid self.uuid = uuid
self.dm.setUUID(uuid) self.dm.setUUID(uuid)
...@@ -252,7 +252,7 @@ class Application(object): ...@@ -252,7 +252,7 @@ class Application(object):
def verifyData(self): def verifyData(self):
"""Verify data under the control by a primary master node. """Verify data under the control by a primary master node.
Connections from client nodes may not be accepted at this stage.""" Connections from client nodes may not be accepted at this stage."""
neo.logging.info('verifying data') neo.lib.logging.info('verifying data')
handler = verification.VerificationHandler(self) handler = verification.VerificationHandler(self)
self.master_conn.setHandler(handler) self.master_conn.setHandler(handler)
...@@ -263,7 +263,7 @@ class Application(object): ...@@ -263,7 +263,7 @@ class Application(object):
def initialize(self): def initialize(self):
""" Retreive partition table and node informations from the primary """ """ Retreive partition table and node informations from the primary """
neo.logging.debug('initializing...') neo.lib.logging.debug('initializing...')
_poll = self._poll _poll = self._poll
handler = initialization.InitializationHandler(self) handler = initialization.InitializationHandler(self)
self.master_conn.setHandler(handler) self.master_conn.setHandler(handler)
...@@ -285,7 +285,7 @@ class Application(object): ...@@ -285,7 +285,7 @@ class Application(object):
def doOperation(self): def doOperation(self):
"""Handle everything, including replications and transactions.""" """Handle everything, including replications and transactions."""
neo.logging.info('doing operation') neo.lib.logging.info('doing operation')
_poll = self._poll _poll = self._poll
...@@ -309,7 +309,7 @@ class Application(object): ...@@ -309,7 +309,7 @@ class Application(object):
def wait(self): def wait(self):
# change handler # change handler
neo.logging.info("waiting in hidden state") neo.lib.logging.info("waiting in hidden state")
_poll = self._poll _poll = self._poll
handler = hidden.HiddenHandler(self) handler = hidden.HiddenHandler(self)
for conn in self.em.getConnectionList(): for conn in self.em.getConnectionList():
...@@ -355,9 +355,9 @@ class Application(object): ...@@ -355,9 +355,9 @@ class Application(object):
def logQueuedEvents(self): def logQueuedEvents(self):
if self.event_queue is None: if self.event_queue is None:
return return
neo.logging.info("Pending events:") neo.lib.logging.info("Pending events:")
for key, event, _msg_id, _conn, args in self.event_queue: for key, event, _msg_id, _conn, args in self.event_queue:
neo.logging.info(' %r:%r: %r:%r %r %r', key, event.__name__, neo.lib.logging.info(' %r:%r: %r:%r %r %r', key, event.__name__,
_msg_id, _conn, args) _msg_id, _conn, args)
def shutdown(self, erase=False): def shutdown(self, erase=False):
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.exception import DatabaseFailure from neo.lib.exception import DatabaseFailure
from neo.storage.database.manager import DatabaseManager from neo.storage.database.manager import DatabaseManager
DATABASE_MANAGER_DICT = {} DATABASE_MANAGER_DICT = {}
......
...@@ -21,11 +21,11 @@ Not persistent ! (no data retained after process exit) ...@@ -21,11 +21,11 @@ Not persistent ! (no data retained after process exit)
""" """
from BTrees.OOBTree import OOBTree as _OOBTree from BTrees.OOBTree import OOBTree as _OOBTree
import neo import neo.lib
from neo.storage.database import DatabaseManager from neo.storage.database import DatabaseManager
from neo.protocol import CellStates from neo.lib.protocol import CellStates
from neo import util from neo.lib import util
# The only purpose of this value (and code using it) is to avoid creating # The only purpose of this value (and code using it) is to avoid creating
# arbitrarily-long lists of values when cleaning up dictionaries. # arbitrarily-long lists of values when cleaning up dictionaries.
...@@ -266,7 +266,7 @@ class BTreeDatabaseManager(DatabaseManager): ...@@ -266,7 +266,7 @@ class BTreeDatabaseManager(DatabaseManager):
except KeyError: except KeyError:
raise IndexError(value_serial) raise IndexError(value_serial)
if value is None: if value is None:
neo.logging.info("Multiple levels of indirection when " \ neo.lib.logging.info("Multiple levels of indirection when " \
"searching for object data for oid %d at tid %d. This " \ "searching for object data for oid %d at tid %d. This " \
"causes suboptimal performance." % (oid, value_serial)) "causes suboptimal performance." % (oid, value_serial))
value_serial, compression, checksum, value = self._getObjectData( value_serial, compression, checksum, value = self._getObjectData(
...@@ -522,7 +522,7 @@ class BTreeDatabaseManager(DatabaseManager): ...@@ -522,7 +522,7 @@ class BTreeDatabaseManager(DatabaseManager):
raise CreationUndone raise CreationUndone
_, _, value, value_serial = self._obj[oid][value_serial] _, _, value, value_serial = self._obj[oid][value_serial]
if value is None: if value is None:
neo.logging.info("Multiple levels of indirection when " \ neo.lib.logging.info("Multiple levels of indirection when " \
"searching for object data for oid %d at tid %d. This " \ "searching for object data for oid %d at tid %d. This " \
"causes suboptimal performance." % (oid, value_serial)) "causes suboptimal performance." % (oid, value_serial))
length = self._getObjectLength(oid, value_serial) length = self._getObjectLength(oid, value_serial)
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo import util from neo.lib import util
from neo.exception import DatabaseFailure from neo.lib.exception import DatabaseFailure
class CreationUndone(Exception): class CreationUndone(Exception):
pass pass
......
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
import MySQLdb import MySQLdb
from MySQLdb import OperationalError from MySQLdb import OperationalError
from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST from MySQLdb.constants.CR import SERVER_GONE_ERROR, SERVER_LOST
import neo import neo.lib
from array import array from array import array
import string import string
from neo.storage.database import DatabaseManager from neo.storage.database import DatabaseManager
from neo.storage.database.manager import CreationUndone from neo.storage.database.manager import CreationUndone
from neo.exception import DatabaseFailure from neo.lib.exception import DatabaseFailure
from neo.protocol import CellStates, ZERO_OID, ZERO_TID from neo.lib.protocol import CellStates, ZERO_OID, ZERO_TID
from neo import util from neo.lib import util
LOG_QUERIES = False LOG_QUERIES = False
...@@ -68,7 +68,8 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -68,7 +68,8 @@ class MySQLDatabaseManager(DatabaseManager):
kwd = {'db' : self.db, 'user' : self.user} kwd = {'db' : self.db, 'user' : self.user}
if self.passwd is not None: if self.passwd is not None:
kwd['passwd'] = self.passwd kwd['passwd'] = self.passwd
neo.logging.info('connecting to MySQL on the database %s with user %s', neo.lib.logging.info(
'connecting to MySQL on the database %s with user %s',
self.db, self.user) self.db, self.user)
self.conn = MySQLdb.connect(**kwd) self.conn = MySQLdb.connect(**kwd)
self.conn.autocommit(False) self.conn.autocommit(False)
...@@ -78,12 +79,12 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -78,12 +79,12 @@ class MySQLDatabaseManager(DatabaseManager):
def _commit(self): def _commit(self):
if LOG_QUERIES: if LOG_QUERIES:
neo.logging.debug('committing...') neo.lib.logging.debug('committing...')
self.conn.commit() self.conn.commit()
def _rollback(self): def _rollback(self):
if LOG_QUERIES: if LOG_QUERIES:
neo.logging.debug('aborting...') neo.lib.logging.debug('aborting...')
self.conn.rollback() self.conn.rollback()
def query(self, query): def query(self, query):
...@@ -97,7 +98,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -97,7 +98,7 @@ class MySQLDatabaseManager(DatabaseManager):
c = '\\x%02x' % ord(c) c = '\\x%02x' % ord(c)
printable_char_list.append(c) printable_char_list.append(c)
query_part = ''.join(printable_char_list) query_part = ''.join(printable_char_list)
neo.logging.debug('querying %s...', query_part) neo.lib.logging.debug('querying %s...', query_part)
conn.query(query) conn.query(query)
r = conn.store_result() r = conn.store_result()
...@@ -114,7 +115,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -114,7 +115,7 @@ class MySQLDatabaseManager(DatabaseManager):
except OperationalError, m: except OperationalError, m:
if m[0] in (SERVER_GONE_ERROR, SERVER_LOST): if m[0] in (SERVER_GONE_ERROR, SERVER_LOST):
neo.logging.info('the MySQL server is gone; reconnecting') neo.lib.logging.info('the MySQL server is gone; reconnecting')
self._connect() self._connect()
return self.query(query) return self.query(query)
raise DatabaseFailure('MySQL error %d: %s' % (m[0], m[1])) raise DatabaseFailure('MySQL error %d: %s' % (m[0], m[1]))
...@@ -324,7 +325,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -324,7 +325,7 @@ class MySQLDatabaseManager(DatabaseManager):
}) })
compression, checksum, value, next_value_serial = r[0] compression, checksum, value, next_value_serial = r[0]
if value is None: if value is None:
neo.logging.info("Multiple levels of indirection when " \ neo.lib.logging.info("Multiple levels of indirection when " \
"searching for object data for oid %d at tid %d. This " \ "searching for object data for oid %d at tid %d. This " \
"causes suboptimal performance." % (oid, value_serial)) "causes suboptimal performance." % (oid, value_serial))
value_serial, compression, checksum, value = self._getObjectData( value_serial, compression, checksum, value = self._getObjectData(
...@@ -634,7 +635,7 @@ class MySQLDatabaseManager(DatabaseManager): ...@@ -634,7 +635,7 @@ class MySQLDatabaseManager(DatabaseManager):
(self._getPartition(oid), oid, value_serial)) (self._getPartition(oid), oid, value_serial))
length, value_serial = r[0] length, value_serial = r[0]
if length is None: if length is None:
neo.logging.info("Multiple levels of indirection when " \ neo.lib.logging.info("Multiple levels of indirection when " \
"searching for object data for oid %d at tid %d. This " \ "searching for object data for oid %d at tid %d. This " \
"causes suboptimal performance." % (oid, value_serial)) "causes suboptimal performance." % (oid, value_serial))
length = self._getObjectLength(oid, value_serial) length = self._getObjectLength(oid, value_serial)
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
import neo import neo
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo import protocol from neo.lib import protocol
from neo.util import dump from neo.lib.util import dump
from neo.exception import PrimaryFailure, OperationFailure from neo.lib.exception import PrimaryFailure, OperationFailure
from neo.protocol import NodeStates, NodeTypes, Packets, Errors from neo.lib.protocol import NodeStates, NodeTypes, Packets, Errors
class BaseMasterHandler(EventHandler): class BaseMasterHandler(EventHandler):
...@@ -35,7 +35,7 @@ class BaseMasterHandler(EventHandler): ...@@ -35,7 +35,7 @@ class BaseMasterHandler(EventHandler):
raise PrimaryFailure('re-election occurs') raise PrimaryFailure('re-election occurs')
def notifyClusterInformation(self, conn, state): def notifyClusterInformation(self, conn, state):
neo.logging.warning('ignoring notify cluster information in %s' % neo.lib.logging.warning('ignoring notify cluster information in %s' %
self.__class__.__name__) self.__class__.__name__)
def notifyLastOID(self, conn, oid): def notifyLastOID(self, conn, oid):
...@@ -48,7 +48,7 @@ class BaseMasterHandler(EventHandler): ...@@ -48,7 +48,7 @@ class BaseMasterHandler(EventHandler):
for node_type, addr, uuid, state in node_list: for node_type, addr, uuid, state in node_list:
if uuid == self.app.uuid: if uuid == self.app.uuid:
# This is me, do what the master tell me # This is me, do what the master tell me
neo.logging.info("I was told I'm %s" %(state)) neo.lib.logging.info("I was told I'm %s" %(state))
if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN, if state in (NodeStates.DOWN, NodeStates.TEMPORARILY_DOWN,
NodeStates.BROKEN): NodeStates.BROKEN):
conn.close() conn.close()
...@@ -57,7 +57,8 @@ class BaseMasterHandler(EventHandler): ...@@ -57,7 +57,8 @@ class BaseMasterHandler(EventHandler):
elif state == NodeStates.HIDDEN: elif state == NodeStates.HIDDEN:
raise OperationFailure raise OperationFailure
elif node_type == NodeTypes.CLIENT and state != NodeStates.RUNNING: elif node_type == NodeTypes.CLIENT and state != NodeStates.RUNNING:
neo.logging.info('Notified of non-running client, abort (%r)', neo.lib.logging.info(
'Notified of non-running client, abort (%r)',
dump(uuid)) dump(uuid))
self.app.tm.abortFor(uuid) self.app.tm.abortFor(uuid)
...@@ -86,14 +87,14 @@ class BaseClientAndStorageOperationHandler(EventHandler): ...@@ -86,14 +87,14 @@ class BaseClientAndStorageOperationHandler(EventHandler):
return return
o = self._askObject(oid, serial, tid) o = self._askObject(oid, serial, tid)
if o is None: if o is None:
neo.logging.debug('oid = %s does not exist', dump(oid)) neo.lib.logging.debug('oid = %s does not exist', dump(oid))
p = Errors.OidDoesNotExist(dump(oid)) p = Errors.OidDoesNotExist(dump(oid))
elif o is False: elif o is False:
neo.logging.debug('oid = %s not found', dump(oid)) neo.lib.logging.debug('oid = %s not found', dump(oid))
p = Errors.OidNotFound(dump(oid)) p = Errors.OidNotFound(dump(oid))
else: else:
serial, next_serial, compression, checksum, data, data_serial = o serial, next_serial, compression, checksum, data, data_serial = o
neo.logging.debug('oid = %s, serial = %s, next_serial = %s', neo.lib.logging.debug('oid = %s, serial = %s, next_serial = %s',
dump(oid), dump(serial), dump(next_serial)) dump(oid), dump(serial), dump(next_serial))
p = Packets.AnswerObject(oid, serial, next_serial, p = Packets.AnswerObject(oid, serial, next_serial,
compression, checksum, data, data_serial) compression, checksum, data, data_serial)
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo import protocol from neo.lib import protocol
from neo.util import dump from neo.lib.util import dump
from neo.protocol import Packets, LockState, Errors from neo.lib.protocol import Packets, LockState, Errors
from neo.storage.handlers import BaseClientAndStorageOperationHandler from neo.storage.handlers import BaseClientAndStorageOperationHandler
from neo.storage.transactions import ConflictError, DelayedError from neo.storage.transactions import ConflictError, DelayedError
from neo.storage.exception import AlreadyPendingError from neo.storage.exception import AlreadyPendingError
...@@ -51,7 +51,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -51,7 +51,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
data_serial, ttid, unlock, request_time): data_serial, ttid, unlock, request_time):
if ttid not in self.app.tm: if ttid not in self.app.tm:
# transaction was aborted, cancel this event # transaction was aborted, cancel this event
neo.logging.info('Forget store of %s:%s by %s delayed by %s', neo.lib.logging.info('Forget store of %s:%s by %s delayed by %s',
dump(oid), dump(serial), dump(ttid), dump(oid), dump(serial), dump(ttid),
dump(self.app.tm.getLockingTID(oid))) dump(self.app.tm.getLockingTID(oid)))
# send an answer as the client side is waiting for it # send an answer as the client side is waiting for it
...@@ -80,7 +80,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -80,7 +80,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
if SLOW_STORE is not None: if SLOW_STORE is not None:
duration = time.time() - request_time duration = time.time() - request_time
if duration > SLOW_STORE: if duration > SLOW_STORE:
neo.logging.info('StoreObject delay: %.02fs', duration) neo.lib.logging.info('StoreObject delay: %.02fs', duration)
conn.answer(Packets.AnswerStoreObject(0, oid, serial)) conn.answer(Packets.AnswerStoreObject(0, oid, serial))
def askStoreObject(self, conn, oid, serial, def askStoreObject(self, conn, oid, serial,
...@@ -140,7 +140,8 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -140,7 +140,8 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
def askHasLock(self, conn, ttid, oid): def askHasLock(self, conn, ttid, oid):
locking_tid = self.app.tm.getLockingTID(oid) locking_tid = self.app.tm.getLockingTID(oid)
neo.logging.info('%r check lock of %r:%r', conn, dump(ttid), dump(oid)) neo.lib.logging.info('%r check lock of %r:%r', conn,
dump(ttid), dump(oid))
if locking_tid is None: if locking_tid is None:
state = LockState.NOT_LOCKED state = LockState.NOT_LOCKED
elif locking_tid is ttid: elif locking_tid is ttid:
...@@ -167,7 +168,8 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -167,7 +168,8 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
def _askCheckCurrentSerial(self, conn, ttid, serial, oid, request_time): def _askCheckCurrentSerial(self, conn, ttid, serial, oid, request_time):
if ttid not in self.app.tm: if ttid not in self.app.tm:
# transaction was aborted, cancel this event # transaction was aborted, cancel this event
neo.logging.info('Forget serial check of %s:%s by %s delayed by ' neo.lib.logging.info(
'Forget serial check of %s:%s by %s delayed by '
'%s', dump(oid), dump(serial), dump(ttid), '%s', dump(oid), dump(serial), dump(ttid),
dump(self.app.tm.getLockingTID(oid))) dump(self.app.tm.getLockingTID(oid)))
# send an answer as the client side is waiting for it # send an answer as the client side is waiting for it
...@@ -190,7 +192,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -190,7 +192,7 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
if SLOW_STORE is not None: if SLOW_STORE is not None:
duration = time.time() - request_time duration = time.time() - request_time
if duration > SLOW_STORE: if duration > SLOW_STORE:
neo.logging.info('CheckCurrentSerial delay: %.02fs', neo.lib.logging.info('CheckCurrentSerial delay: %.02fs',
duration) duration)
conn.answer(Packets.AnswerCheckCurrentSerial(0, oid, serial)) conn.answer(Packets.AnswerCheckCurrentSerial(0, oid, serial))
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
from neo.protocol import CellStates from neo.lib.protocol import CellStates
class HiddenHandler(BaseMasterHandler): class HiddenHandler(BaseMasterHandler):
"""This class implements a generic part of the event handlers.""" """This class implements a generic part of the event handlers."""
...@@ -29,7 +29,7 @@ class HiddenHandler(BaseMasterHandler): ...@@ -29,7 +29,7 @@ class HiddenHandler(BaseMasterHandler):
app = self.app app = self.app
if ptid <= app.pt.getID(): if ptid <= app.pt.getID():
# Ignore this packet. # Ignore this packet.
neo.logging.debug('ignoring older partition changes') neo.lib.logging.debug('ignoring older partition changes')
return return
# update partition table in memory and the database # update partition table in memory and the database
......
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.protocol import NodeTypes, Packets, NotReadyError from neo.lib.protocol import NodeTypes, Packets, NotReadyError
from neo.protocol import ProtocolError, BrokenNodeDisallowedError from neo.lib.protocol import ProtocolError, BrokenNodeDisallowedError
from neo.util import dump from neo.lib.util import dump
class IdentificationHandler(EventHandler): class IdentificationHandler(EventHandler):
""" Handler used for incoming connections during operation state """ """ Handler used for incoming connections during operation state """
def connectionLost(self, conn, new_state): def connectionLost(self, conn, new_state):
neo.logging.warning('A connection was lost during identification') neo.lib.logging.warning('A connection was lost during identification')
def requestIdentification(self, conn, node_type, def requestIdentification(self, conn, node_type,
uuid, address, name): uuid, address, name):
...@@ -54,7 +54,7 @@ class IdentificationHandler(EventHandler): ...@@ -54,7 +54,7 @@ class IdentificationHandler(EventHandler):
from neo.storage.handlers.storage import StorageOperationHandler from neo.storage.handlers.storage import StorageOperationHandler
handler = StorageOperationHandler handler = StorageOperationHandler
if node is None: if node is None:
neo.logging.error('reject an unknown storage node %s', neo.lib.logging.error('reject an unknown storage node %s',
dump(uuid)) dump(uuid))
raise NotReadyError raise NotReadyError
else: else:
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
from neo import protocol from neo.lib import protocol
class InitializationHandler(BaseMasterHandler): class InitializationHandler(BaseMasterHandler):
...@@ -35,7 +35,7 @@ class InitializationHandler(BaseMasterHandler): ...@@ -35,7 +35,7 @@ class InitializationHandler(BaseMasterHandler):
pt.load(ptid, row_list, self.app.nm) pt.load(ptid, row_list, self.app.nm)
if not pt.filled(): if not pt.filled():
raise protocol.ProtocolError('Partial partition table received') raise protocol.ProtocolError('Partial partition table received')
neo.logging.debug('Got the partition table :') neo.lib.logging.debug('Got the partition table :')
self.app.pt.log() self.app.pt.log()
# Install the partition table into the database for persistency. # Install the partition table into the database for persistency.
cell_list = [] cell_list = []
...@@ -48,7 +48,8 @@ class InitializationHandler(BaseMasterHandler): ...@@ -48,7 +48,8 @@ class InitializationHandler(BaseMasterHandler):
unassigned_set.remove(offset) unassigned_set.remove(offset)
# delete objects database # delete objects database
if unassigned_set: if unassigned_set:
neo.logging.debug('drop data for partitions %r' % unassigned_set) neo.lib.logging.debug(
'drop data for partitions %r' % unassigned_set)
app.dm.dropPartitions(num_partitions, unassigned_set) app.dm.dropPartitions(num_partitions, unassigned_set)
app.dm.setPartitionTable(ptid, cell_list) app.dm.setPartitionTable(ptid, cell_list)
...@@ -66,5 +67,5 @@ class InitializationHandler(BaseMasterHandler): ...@@ -66,5 +67,5 @@ class InitializationHandler(BaseMasterHandler):
# packets in between (or even before asking for node information). # packets in between (or even before asking for node information).
# - this handler will be changed after receiving answerPartitionTable # - this handler will be changed after receiving answerPartitionTable
# and before handling the next packet # and before handling the next packet
neo.logging.debug('ignoring notifyPartitionChanges during '\ neo.lib.logging.debug('ignoring notifyPartitionChanges during '\
'initialization') 'initialization')
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.util import dump from neo.lib.util import dump
from neo.protocol import CellStates, Packets, ProtocolError from neo.lib.protocol import CellStates, Packets, ProtocolError
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
...@@ -36,7 +36,7 @@ class MasterOperationHandler(BaseMasterHandler): ...@@ -36,7 +36,7 @@ class MasterOperationHandler(BaseMasterHandler):
app = self.app app = self.app
if ptid <= app.pt.getID(): if ptid <= app.pt.getID():
# Ignore this packet. # Ignore this packet.
neo.logging.debug('ignoring older partition changes') neo.lib.logging.debug('ignoring older partition changes')
return return
# update partition table in memory and the database # update partition table in memory and the database
...@@ -68,9 +68,9 @@ class MasterOperationHandler(BaseMasterHandler): ...@@ -68,9 +68,9 @@ class MasterOperationHandler(BaseMasterHandler):
def askPack(self, conn, tid): def askPack(self, conn, tid):
app = self.app app = self.app
neo.logging.info('Pack started, up to %s...', dump(tid)) neo.lib.logging.info('Pack started, up to %s...', dump(tid))
app.dm.pack(tid, app.tm.updateObjectDataForPack) app.dm.pack(tid, app.tm.updateObjectDataForPack)
neo.logging.info('Pack finished.') neo.lib.logging.info('Pack finished.')
if not conn.isClosed(): if not conn.isClosed():
conn.answer(Packets.AnswerPack(True)) conn.answer(Packets.AnswerPack(True))
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from neo.handler import EventHandler from neo.lib.handler import EventHandler
from neo.protocol import Packets, ZERO_TID, ZERO_OID from neo.lib.protocol import Packets, ZERO_TID, ZERO_OID
from neo.util import add64 from neo.lib.util import add64
# TODO: benchmark how different values behave # TODO: benchmark how different values behave
RANGE_LENGTH = 4000 RANGE_LENGTH = 4000
...@@ -82,11 +82,13 @@ class ReplicationHandler(EventHandler): ...@@ -82,11 +82,13 @@ class ReplicationHandler(EventHandler):
"""This class handles events for replications.""" """This class handles events for replications."""
def connectionLost(self, conn, new_state): def connectionLost(self, conn, new_state):
neo.logging.error('replication is stopped due to a connection lost') neo.lib.logging.error(
'replication is stopped due to a connection lost')
self.app.replicator.storageLost() self.app.replicator.storageLost()
def connectionFailed(self, conn): def connectionFailed(self, conn):
neo.logging.error('replication is stopped due to connection failure') neo.lib.logging.error(
'replication is stopped due to connection failure')
self.app.replicator.storageLost() self.app.replicator.storageLost()
def acceptIdentification(self, conn, node_type, def acceptIdentification(self, conn, node_type,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from neo.storage.handlers import BaseClientAndStorageOperationHandler from neo.storage.handlers import BaseClientAndStorageOperationHandler
from neo.protocol import Packets from neo.lib.protocol import Packets
class StorageOperationHandler(BaseClientAndStorageOperationHandler): class StorageOperationHandler(BaseClientAndStorageOperationHandler):
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
import neo import neo
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
from neo.protocol import Packets, Errors, ProtocolError from neo.lib.protocol import Packets, Errors, ProtocolError
from neo.util import dump from neo.lib.util import dump
from neo.exception import OperationFailure from neo.lib.exception import OperationFailure
class VerificationHandler(BaseMasterHandler): class VerificationHandler(BaseMasterHandler):
"""This class deals with events for a verification phase.""" """This class deals with events for a verification phase."""
...@@ -48,7 +48,7 @@ class VerificationHandler(BaseMasterHandler): ...@@ -48,7 +48,7 @@ class VerificationHandler(BaseMasterHandler):
app = self.app app = self.app
if ptid <= app.pt.getID(): if ptid <= app.pt.getID():
# Ignore this packet. # Ignore this packet.
neo.logging.debug('ignoring older partition changes') neo.lib.logging.debug('ignoring older partition changes')
return return
# update partition table in memory and the database # update partition table in memory and the database
app.pt.update(ptid, cell_list, app.nm) app.pt.update(ptid, cell_list, app.nm)
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import neo import neo.lib
from random import choice from random import choice
from neo.storage.handlers import replication from neo.storage.handlers import replication
from neo.protocol import NodeTypes, NodeStates, Packets from neo.lib.protocol import NodeTypes, NodeStates, Packets
from neo.connection import ClientConnection from neo.lib.connection import ClientConnection
from neo.util import dump from neo.lib.util import dump
class Partition(object): class Partition(object):
"""This class abstracts the state of a partition.""" """This class abstracts the state of a partition."""
...@@ -210,7 +210,7 @@ class Replicator(object): ...@@ -210,7 +210,7 @@ class Replicator(object):
def setCriticalTID(self, tid): def setCriticalTID(self, tid):
"""This is a callback from MasterOperationHandler.""" """This is a callback from MasterOperationHandler."""
neo.logging.debug('setting critical TID %s to %s', dump(tid), neo.lib.logging.debug('setting critical TID %s to %s', dump(tid),
', '.join([str(p.getRID()) for p in self.critical_tid_list])) ', '.join([str(p.getRID()) for p in self.critical_tid_list]))
for partition in self.critical_tid_list: for partition in self.critical_tid_list:
partition.setCriticalTID(tid) partition.setCriticalTID(tid)
...@@ -224,7 +224,7 @@ class Replicator(object): ...@@ -224,7 +224,7 @@ class Replicator(object):
def setUnfinishedTIDList(self, tid_list): def setUnfinishedTIDList(self, tid_list):
"""This is a callback from MasterOperationHandler.""" """This is a callback from MasterOperationHandler."""
neo.logging.debug('setting unfinished TIDs %s', neo.lib.logging.debug('setting unfinished TIDs %s',
','.join([dump(tid) for tid in tid_list])) ','.join([dump(tid) for tid in tid_list]))
self.waiting_for_unfinished_tids = False self.waiting_for_unfinished_tids = False
self.unfinished_tid_list = tid_list self.unfinished_tid_list = tid_list
...@@ -245,13 +245,13 @@ class Replicator(object): ...@@ -245,13 +245,13 @@ class Replicator(object):
node = choice(node_list) node = choice(node_list)
except IndexError: except IndexError:
# Not operational. # Not operational.
neo.logging.error('not operational', exc_info = 1) neo.lib.logging.error('not operational', exc_info = 1)
self.current_partition = None self.current_partition = None
return return
addr = node.getAddress() addr = node.getAddress()
if addr is None: if addr is None:
neo.logging.error("no address known for the selected node %s" % neo.lib.logging.error("no address known for the selected node %s" %
(dump(node.getUUID()), )) (dump(node.getUUID()), ))
return return
if self.current_connection is not None: if self.current_connection is not None:
...@@ -299,19 +299,19 @@ class Replicator(object): ...@@ -299,19 +299,19 @@ class Replicator(object):
if self.replication_done and \ if self.replication_done and \
not self.current_connection.isPending(): not self.current_connection.isPending():
# finish a replication # finish a replication
neo.logging.info('replication is done for %s' % neo.lib.logging.info('replication is done for %s' %
(self.current_partition.getRID(), )) (self.current_partition.getRID(), ))
self._finishReplication() self._finishReplication()
return return
if self.waiting_for_unfinished_tids: if self.waiting_for_unfinished_tids:
# Still waiting. # Still waiting.
neo.logging.debug('waiting for unfinished tids') neo.lib.logging.debug('waiting for unfinished tids')
return return
if self.unfinished_tid_list is None: if self.unfinished_tid_list is None:
# Ask pending transactions. # Ask pending transactions.
neo.logging.debug('asking unfinished tids') neo.lib.logging.debug('asking unfinished tids')
self._askUnfinishedTIDs() self._askUnfinishedTIDs()
return return
...@@ -327,7 +327,7 @@ class Replicator(object): ...@@ -327,7 +327,7 @@ class Replicator(object):
else: else:
# Not yet. # Not yet.
self.unfinished_tid_list = None self.unfinished_tid_list = None
neo.logging.debug('not ready yet') neo.lib.logging.debug('not ready yet')
return return
self._startReplication() self._startReplication()
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from time import time from time import time
import neo import neo.lib
from neo.util import dump from neo.lib.util import dump
from neo.protocol import ZERO_TID from neo.lib.protocol import ZERO_TID
class ConflictError(Exception): class ConflictError(Exception):
""" """
...@@ -228,7 +228,7 @@ class TransactionManager(object): ...@@ -228,7 +228,7 @@ class TransactionManager(object):
# check if the object if locked # check if the object if locked
locking_tid = self._store_lock_dict.get(oid) locking_tid = self._store_lock_dict.get(oid)
if locking_tid == ttid and unlock: if locking_tid == ttid and unlock:
neo.logging.info('Deadlock resolution on %r:%r', dump(oid), neo.lib.logging.info('Deadlock resolution on %r:%r', dump(oid),
dump(ttid)) dump(ttid))
# A duplicate store means client is resolving a deadlock, so # A duplicate store means client is resolving a deadlock, so
# drop the lock it held on this object, and drop object data for # drop the lock it held on this object, and drop object data for
...@@ -249,7 +249,7 @@ class TransactionManager(object): ...@@ -249,7 +249,7 @@ class TransactionManager(object):
if previous_serial is None: if previous_serial is None:
# XXX: use some special serial when previous store was not # XXX: use some special serial when previous store was not
# an undo ? Maybe it should just not happen. # an undo ? Maybe it should just not happen.
neo.logging.info('Transaction %s storing %s more than ' neo.lib.logging.info('Transaction %s storing %s more than '
'once', dump(ttid), dump(oid)) 'once', dump(ttid), dump(oid))
else: else:
previous_serial = None previous_serial = None
...@@ -258,15 +258,16 @@ class TransactionManager(object): ...@@ -258,15 +258,16 @@ class TransactionManager(object):
if history_list: if history_list:
previous_serial = history_list[0][0] previous_serial = history_list[0][0]
if previous_serial is not None and previous_serial != serial: if previous_serial is not None and previous_serial != serial:
neo.logging.info('Resolvable conflict on %r:%r', dump(oid), neo.lib.logging.info('Resolvable conflict on %r:%r',
dump(ttid)) dump(oid), dump(ttid))
raise ConflictError(previous_serial) raise ConflictError(previous_serial)
neo.logging.info('Transaction %s storing %s', dump(ttid), dump(oid)) neo.lib.logging.info('Transaction %s storing %s',
dump(ttid), dump(oid))
self._store_lock_dict[oid] = ttid self._store_lock_dict[oid] = ttid
elif locking_tid > ttid: elif locking_tid > ttid:
# We have a smaller TID than locking transaction, so we are older: # We have a smaller TID than locking transaction, so we are older:
# enter waiting queue so we are handled when lock gets released. # enter waiting queue so we are handled when lock gets released.
neo.logging.info('Store delayed for %r:%r by %r', dump(oid), neo.lib.logging.info('Store delayed for %r:%r by %r', dump(oid),
dump(ttid), dump(locking_tid)) dump(ttid), dump(locking_tid))
raise DelayedError raise DelayedError
else: else:
...@@ -275,7 +276,7 @@ class TransactionManager(object): ...@@ -275,7 +276,7 @@ class TransactionManager(object):
# hold locks that older transaction is waiting upon. Make client # hold locks that older transaction is waiting upon. Make client
# release locks & reacquire them by notifying it of the possible # release locks & reacquire them by notifying it of the possible
# deadlock. # deadlock.
neo.logging.info('Possible deadlock on %r:%r with %r', neo.lib.logging.info('Possible deadlock on %r:%r with %r',
dump(oid), dump(ttid), dump(locking_tid)) dump(oid), dump(ttid), dump(locking_tid))
raise ConflictError(ZERO_TID) raise ConflictError(ZERO_TID)
...@@ -324,7 +325,7 @@ class TransactionManager(object): ...@@ -324,7 +325,7 @@ class TransactionManager(object):
del self._store_lock_dict[oid] del self._store_lock_dict[oid]
except KeyError: except KeyError:
# all locks might not have been acquiredwhen aborting # all locks might not have been acquiredwhen aborting
neo.logging.warning('%s write lock was not held by %s', neo.lib.logging.warning('%s write lock was not held by %s',
dump(oid), dump(ttid)) dump(oid), dump(ttid))
# remove the transaction # remove the transaction
uuid = transaction.getUUID() uuid = transaction.getUUID()
...@@ -352,15 +353,15 @@ class TransactionManager(object): ...@@ -352,15 +353,15 @@ class TransactionManager(object):
return oid in self._load_lock_dict return oid in self._load_lock_dict
def log(self): def log(self):
neo.logging.info("Transactions:") neo.lib.logging.info("Transactions:")
for txn in self._transaction_dict.values(): for txn in self._transaction_dict.values():
neo.logging.info(' %r', txn) neo.lib.logging.info(' %r', txn)
neo.logging.info(' Read locks:') neo.lib.logging.info(' Read locks:')
for oid, ttid in self._load_lock_dict.items(): for oid, ttid in self._load_lock_dict.items():
neo.logging.info(' %r by %r', dump(oid), dump(ttid)) neo.lib.logging.info(' %r by %r', dump(oid), dump(ttid))
neo.logging.info(' Write locks:') neo.lib.logging.info(' Write locks:')
for oid, ttid in self._store_lock_dict.items(): for oid, ttid in self._store_lock_dict.items():
neo.logging.info(' %r by %r', dump(oid), dump(ttid)) neo.lib.logging.info(' %r by %r', dump(oid), dump(ttid))
def updateObjectDataForPack(self, oid, orig_serial, new_serial, def updateObjectDataForPack(self, oid, orig_serial, new_serial,
getObjectData): getObjectData):
......
...@@ -23,8 +23,8 @@ import tempfile ...@@ -23,8 +23,8 @@ import tempfile
import MySQLdb import MySQLdb
import neo import neo
from mock import Mock from mock import Mock
from neo import protocol from neo.lib import protocol
from neo.protocol import Packets from neo.lib.protocol import Packets
from time import time, gmtime from time import time, gmtime
from struct import pack, unpack from struct import pack, unpack
...@@ -409,7 +409,7 @@ connector_cpt = 0 ...@@ -409,7 +409,7 @@ connector_cpt = 0
class DoNothingConnector(Mock): class DoNothingConnector(Mock):
def __init__(self, s=None): def __init__(self, s=None):
neo.logging.info("initializing connector") neo.lib.logging.info("initializing connector")
self.desc = globals()['connector_cpt'] self.desc = globals()['connector_cpt']
globals()['connector_cpt'] = globals()['connector_cpt']+ 1 globals()['connector_cpt'] = globals()['connector_cpt']+ 1
self.packet_cpt = 0 self.packet_cpt = 0
......
...@@ -24,8 +24,8 @@ from neo.tests import NeoUnitTestBase ...@@ -24,8 +24,8 @@ from neo.tests import NeoUnitTestBase
from neo.client.app import Application, RevisionIndex from neo.client.app import Application, RevisionIndex
from neo.client.exception import NEOStorageError, NEOStorageNotFoundError from neo.client.exception import NEOStorageError, NEOStorageNotFoundError
from neo.client.exception import NEOStorageDoesNotExistError from neo.client.exception import NEOStorageDoesNotExistError
from neo.protocol import Packet, Packets, Errors, INVALID_TID from neo.lib.protocol import Packet, Packets, Errors, INVALID_TID
from neo.util import makeChecksum from neo.lib.util import makeChecksum
import time import time
def _getMasterConnection(self): def _getMasterConnection(self):
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
import unittest import unittest
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.protocol import NodeTypes, NodeStates from neo.lib.protocol import NodeTypes, NodeStates
from neo.client.handlers.master import PrimaryBootstrapHandler from neo.client.handlers.master import PrimaryBootstrapHandler
from neo.client.handlers.master import PrimaryNotificationsHandler, \ from neo.client.handlers.master import PrimaryNotificationsHandler, \
PrimaryAnswersHandler PrimaryAnswersHandler
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, LockState from neo.lib.protocol import NodeTypes, LockState
from neo.client.handlers.storage import StorageBootstrapHandler, \ from neo.client.handlers.storage import StorageBootstrapHandler, \
StorageAnswersHandler StorageAnswersHandler
from neo.client.exception import NEOStorageError, NEOStorageNotFoundError from neo.client.exception import NEOStorageError, NEOStorageNotFoundError
......
...@@ -29,8 +29,8 @@ import traceback ...@@ -29,8 +29,8 @@ import traceback
import threading import threading
from neo.neoctl.neoctl import NeoCTL, NotReadyException from neo.neoctl.neoctl import NeoCTL, NotReadyException
from neo.protocol import ClusterStates, NodeTypes, CellStates, NodeStates from neo.lib.protocol import ClusterStates, NodeTypes, CellStates, NodeStates
from neo.util import dump from neo.lib.util import dump
from neo.tests import DB_ADMIN, DB_PASSWD, NeoTestBase from neo.tests import DB_ADMIN, DB_PASSWD, NeoTestBase
from neo.client.Storage import Storage from neo.client.Storage import Storage
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import unittest import unittest
from neo.tests.functional import NEOCluster, NEOFunctionalTest from neo.tests.functional import NEOCluster, NEOFunctionalTest
from neo.protocol import NodeStates from neo.lib.protocol import NodeStates
MASTER_NODE_COUNT = 3 MASTER_NODE_COUNT = 3
......
...@@ -20,7 +20,7 @@ import transaction ...@@ -20,7 +20,7 @@ import transaction
from persistent import Persistent from persistent import Persistent
from neo.tests.functional import NEOCluster, NEOFunctionalTest from neo.tests.functional import NEOCluster, NEOFunctionalTest
from neo.protocol import ClusterStates, NodeStates from neo.lib.protocol import ClusterStates, NodeStates
from MySQLdb import ProgrammingError from MySQLdb import ProgrammingError
from MySQLdb.constants.ER import NO_SUCH_TABLE from MySQLdb.constants.ER import NO_SUCH_TABLE
......
...@@ -19,7 +19,7 @@ import unittest ...@@ -19,7 +19,7 @@ import unittest
from mock import Mock from mock import Mock
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates, Packets from neo.lib.protocol import NodeTypes, NodeStates, Packets
from neo.master.handlers.client import ClientServiceHandler from neo.master.handlers.client import ClientServiceHandler
from neo.master.app import Application from neo.master.app import Application
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo import protocol from neo.lib import protocol
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import Packet, NodeTypes, NodeStates from neo.lib.protocol import Packet, NodeTypes, NodeStates
from neo.master.handlers.election import ClientElectionHandler, ServerElectionHandler from neo.master.handlers.election import ClientElectionHandler, ServerElectionHandler
from neo.master.app import Application from neo.master.app import Application
from neo.exception import ElectionFailure from neo.lib.exception import ElectionFailure
from neo.connection import ClientConnection from neo.lib.connection import ClientConnection
# patch connection so that we can register _addPacket messages # patch connection so that we can register _addPacket messages
# in mock object # in mock object
......
...@@ -19,7 +19,7 @@ import unittest ...@@ -19,7 +19,7 @@ import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.master.app import Application from neo.master.app import Application
from neo.util import p64, u64 from neo.lib.util import p64, u64
class MasterAppTests(NeoUnitTestBase): class MasterAppTests(NeoUnitTestBase):
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeStates, CellStates from neo.lib.protocol import NodeStates, CellStates
from neo.master.pt import PartitionTable from neo.master.pt import PartitionTable
from neo.node import StorageNode from neo.lib.node import StorageNode
class MasterPartitionTableTests(NeoUnitTestBase): class MasterPartitionTableTests(NeoUnitTestBase):
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates, CellStates from neo.lib.protocol import NodeTypes, NodeStates, CellStates
from neo.master.recovery import RecoveryManager from neo.master.recovery import RecoveryManager
from neo.master.app import Application from neo.master.app import Application
......
...@@ -19,11 +19,11 @@ import unittest ...@@ -19,11 +19,11 @@ import unittest
from mock import Mock from mock import Mock
from struct import pack from struct import pack
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates, Packets from neo.lib.protocol import NodeTypes, NodeStates, Packets
from neo.master.handlers.storage import StorageServiceHandler from neo.master.handlers.storage import StorageServiceHandler
from neo.master.handlers.client import ClientServiceHandler from neo.master.handlers.client import ClientServiceHandler
from neo.master.app import Application from neo.master.app import Application
from neo.exception import OperationFailure from neo.lib.exception import OperationFailure
class MasterStorageHandlerTests(NeoUnitTestBase): class MasterStorageHandlerTests(NeoUnitTestBase):
......
...@@ -19,7 +19,7 @@ import unittest ...@@ -19,7 +19,7 @@ import unittest
from mock import Mock from mock import Mock
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import ZERO_TID from neo.lib.protocol import ZERO_TID
from neo.master.transactions import Transaction, TransactionManager from neo.master.transactions import Transaction, TransactionManager
from neo.master.transactions import packTID, unpackTID, addTID, DelayedError from neo.master.transactions import packTID, unpackTID, addTID, DelayedError
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
from struct import pack, unpack from struct import pack, unpack
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NodeStates from neo.lib.protocol import NodeTypes, NodeStates
from neo.master.verification import VerificationManager, VerificationFailure from neo.master.verification import VerificationManager, VerificationFailure
from neo.master.app import Application from neo.master.app import Application
......
...@@ -22,9 +22,9 @@ from neo.tests import NeoUnitTestBase ...@@ -22,9 +22,9 @@ from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.transactions import ConflictError, DelayedError from neo.storage.transactions import ConflictError, DelayedError
from neo.storage.handlers.client import ClientOperationHandler from neo.storage.handlers.client import ClientOperationHandler
from neo.protocol import INVALID_PARTITION from neo.lib.protocol import INVALID_PARTITION
from neo.protocol import INVALID_TID, INVALID_OID from neo.lib.protocol import INVALID_TID, INVALID_OID
from neo.protocol import Packets, LockState from neo.lib.protocol import Packets, LockState
class StorageClientHandlerTests(NeoUnitTestBase): class StorageClientHandlerTests(NeoUnitTestBase):
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import NodeTypes, NotReadyError, BrokenNodeDisallowedError from neo.lib.protocol import NodeTypes, NotReadyError,
from neo.pt import PartitionTable BrokenNodeDisallowedError
from neo.lib.pt import PartitionTable
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.identification import IdentificationHandler from neo.storage.handlers.identification import IdentificationHandler
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.initialization import InitializationHandler from neo.storage.handlers.initialization import InitializationHandler
from neo.protocol import CellStates, ProtocolError from neo.lib.protocol import CellStates, ProtocolError
from neo.exception import PrimaryFailure from neo.lib.exception import PrimaryFailure
class StorageInitializationHandlerTests(NeoUnitTestBase): class StorageInitializationHandlerTests(NeoUnitTestBase):
......
...@@ -21,10 +21,10 @@ from collections import deque ...@@ -21,10 +21,10 @@ from collections import deque
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.master import MasterOperationHandler from neo.storage.handlers.master import MasterOperationHandler
from neo.exception import PrimaryFailure, OperationFailure from neo.lib.exception import PrimaryFailure, OperationFailure
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.protocol import CellStates, ProtocolError, Packets from neo.lib.protocol import CellStates, ProtocolError, Packets
from neo.protocol import INVALID_TID, INVALID_OID from neo.lib.protocol import INVALID_TID, INVALID_OID
class StorageMasterHandlerTests(NeoUnitTestBase): class StorageMasterHandlerTests(NeoUnitTestBase):
......
...@@ -26,7 +26,7 @@ from neo.storage.handlers.replication import ReplicationHandler ...@@ -26,7 +26,7 @@ from neo.storage.handlers.replication import ReplicationHandler
from neo.storage.handlers.replication import RANGE_LENGTH from neo.storage.handlers.replication import RANGE_LENGTH
from neo.storage.handlers.storage import StorageOperationHandler from neo.storage.handlers.storage import StorageOperationHandler
from neo.storage.replicator import Replicator from neo.storage.replicator import Replicator
from neo.protocol import ZERO_OID, ZERO_TID from neo.lib.protocol import ZERO_OID, ZERO_TID
MAX_TRANSACTIONS = 10000 MAX_TRANSACTIONS = 10000
MAX_OBJECTS = 100000 MAX_OBJECTS = 100000
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.util import add64 from neo.lib.util import add64
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.protocol import Packets, ZERO_OID, ZERO_TID from neo.lib.protocol import Packets, ZERO_OID, ZERO_TID
from neo.storage.handlers.replication import ReplicationHandler from neo.storage.handlers.replication import ReplicationHandler
from neo.storage.handlers.replication import RANGE_LENGTH, MIN_RANGE_LENGTH from neo.storage.handlers.replication import RANGE_LENGTH, MIN_RANGE_LENGTH
......
...@@ -19,7 +19,7 @@ import unittest ...@@ -19,7 +19,7 @@ import unittest
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.storage.replicator import Replicator, Partition, Task from neo.storage.replicator import Replicator, Partition, Task
from neo.protocol import CellStates, NodeStates, Packets from neo.lib.protocol import CellStates, NodeStates, Packets
class StorageReplicatorTests(NeoUnitTestBase): class StorageReplicatorTests(NeoUnitTestBase):
......
...@@ -19,10 +19,10 @@ import unittest ...@@ -19,10 +19,10 @@ import unittest
from mock import Mock, ReturnValues from mock import Mock, ReturnValues
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.protocol import CellStates from neo.lib.protocol import CellStates
from collections import deque from collections import deque
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.util import dump from neo.lib.util import dump
from neo.storage.exception import AlreadyPendingError from neo.storage.exception import AlreadyPendingError
class StorageAppTests(NeoUnitTestBase): class StorageAppTests(NeoUnitTestBase):
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.util import dump, p64, u64 from neo.lib.util import dump, p64, u64
from neo.protocol import CellStates, ZERO_OID, ZERO_TID from neo.lib.protocol import CellStates, ZERO_OID, ZERO_TID
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.exception import DatabaseFailure from neo.lib.exception import DatabaseFailure
from neo.storage.database.mysqldb import MySQLDatabaseManager from neo.storage.database.mysqldb import MySQLDatabaseManager
MAX_TID = '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE' # != INVALID_TID MAX_TID = '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE' # != INVALID_TID
......
...@@ -21,8 +21,8 @@ from collections import deque ...@@ -21,8 +21,8 @@ from collections import deque
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.storage import StorageOperationHandler from neo.storage.handlers.storage import StorageOperationHandler
from neo.protocol import INVALID_PARTITION, Packets from neo.lib.protocol import INVALID_PARTITION, Packets
from neo.protocol import INVALID_TID, INVALID_OID from neo.lib.protocol import INVALID_TID, INVALID_OID
class StorageStorageHandlerTests(NeoUnitTestBase): class StorageStorageHandlerTests(NeoUnitTestBase):
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import unittest import unittest
import MySQLdb import MySQLdb
from mock import Mock from mock import Mock
from neo.exception import DatabaseFailure from neo.lib.exception import DatabaseFailure
from neo.tests.storage.testStorageDBTests import StorageDBTests from neo.tests.storage.testStorageDBTests import StorageDBTests
from neo.storage.database.mysqldb import MySQLDatabaseManager from neo.storage.database.mysqldb import MySQLDatabaseManager
......
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
import unittest import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.pt import PartitionTable from neo.lib.pt import PartitionTable
from neo.storage.app import Application from neo.storage.app import Application
from neo.storage.handlers.verification import VerificationHandler from neo.storage.handlers.verification import VerificationHandler
from neo.protocol import CellStates, ErrorCodes from neo.lib.protocol import CellStates, ErrorCodes
from neo.exception import PrimaryFailure, OperationFailure from neo.lib.exception import PrimaryFailure, OperationFailure
from neo.util import p64, u64 from neo.lib.util import p64, u64
class StorageVerificationHandlerTests(NeoUnitTestBase): class StorageVerificationHandlerTests(NeoUnitTestBase):
......
...@@ -19,8 +19,8 @@ import unittest ...@@ -19,8 +19,8 @@ import unittest
from mock import Mock from mock import Mock
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.storage.app import Application from neo.storage.app import Application
from neo.bootstrap import BootstrapManager from neo.lib.bootstrap import BootstrapManager
from neo.protocol import NodeTypes from neo.lib.protocol import NodeTypes
class BootstrapManagerTests(NeoUnitTestBase): class BootstrapManagerTests(NeoUnitTestBase):
......
...@@ -17,17 +17,17 @@ ...@@ -17,17 +17,17 @@
import unittest import unittest
from time import time from time import time
from mock import Mock from mock import Mock
from neo.connection import ListeningConnection, Connection, \ from neo.lib.connection import ListeningConnection, Connection, \
ClientConnection, ServerConnection, MTClientConnection, \ ClientConnection, ServerConnection, MTClientConnection, \
HandlerSwitcher, Timeout, PING_DELAY, PING_TIMEOUT, OnTimeout HandlerSwitcher, Timeout, PING_DELAY, PING_TIMEOUT, OnTimeout
from neo.connector import getConnectorHandler, registerConnectorHandler from neo.lib.connector import getConnectorHandler, registerConnectorHandler
from neo.tests import DoNothingConnector from neo.tests import DoNothingConnector
from neo.connector import ConnectorException, ConnectorTryAgainException, \ from neo.lib.connector import ConnectorException, ConnectorTryAgainException, \
ConnectorInProgressException, ConnectorConnectionRefusedException ConnectorInProgressException, ConnectorConnectionRefusedException
from neo.protocol import Packets, ParserState from neo.lib.protocol import Packets, ParserState
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.util import ReadBuffer from neo.lib.util import ReadBuffer
from neo.locking import Queue from neo.lib.locking import Queue
class ConnectionTests(NeoUnitTestBase): class ConnectionTests(NeoUnitTestBase):
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
from mock import Mock from mock import Mock
from neo.tests import NeoTestBase from neo.tests import NeoTestBase
from neo.dispatcher import Dispatcher, ForgottenPacket from neo.lib.dispatcher import Dispatcher, ForgottenPacket
from Queue import Queue from Queue import Queue
import unittest import unittest
......
...@@ -18,8 +18,8 @@ import unittest ...@@ -18,8 +18,8 @@ import unittest
from mock import Mock from mock import Mock
from time import time from time import time
from neo.tests import NeoUnitTestBase from neo.tests import NeoUnitTestBase
from neo.epoll import Epoll from neo.lib.epoll import Epoll
from neo.event import EpollEventManager from neo.lib.event import EpollEventManager
class EventTests(NeoUnitTestBase): class EventTests(NeoUnitTestBase):
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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