Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
f1715aa2
Commit
f1715aa2
authored
Jan 18, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't require a Cluster instance to instantiate a ServerNode.
parent
61d37895
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+19
-13
No files found.
neo/tests/threaded/__init__.py
View file @
f1715aa2
...
@@ -203,17 +203,23 @@ class ServerNode(Node):
...
@@ -203,17 +203,23 @@ class ServerNode(Node):
return
cls
.
_node_list
[
address
[
1
]].
getListeningAddress
()
return
cls
.
_node_list
[
address
[
1
]].
getListeningAddress
()
@
SerializedEventManager
.
decorate
@
SerializedEventManager
.
decorate
def
__init__
(
self
,
cluster
,
address
=
None
,
**
kw
):
def
__init__
(
self
,
cluster
=
None
,
address
=
None
,
**
kw
):
if
not
address
:
if
not
address
:
address
=
self
.
newAddress
()
address
=
self
.
newAddress
()
if
cluster
is
None
:
master_nodes
=
kw
[
'master_nodes'
]
name
=
kw
[
'name'
]
else
:
master_nodes
=
kw
.
get
(
'master_nodes'
,
cluster
.
master_nodes
)
name
=
kw
.
get
(
'name'
,
cluster
.
name
)
port
=
address
[
1
]
port
=
address
[
1
]
self
.
_node_list
[
port
]
=
weakref
.
proxy
(
self
)
self
.
_node_list
[
port
]
=
weakref
.
proxy
(
self
)
self
.
_init_args
=
(
cluster
,
address
),
kw
.
copy
()
self
.
_init_args
=
(
cluster
,
address
),
kw
.
copy
()
threading
.
Thread
.
__init__
(
self
)
threading
.
Thread
.
__init__
(
self
)
self
.
daemon
=
True
self
.
daemon
=
True
self
.
node_name
=
'%s_%u'
%
(
self
.
node_type
,
port
)
self
.
node_name
=
'%s_%u'
%
(
self
.
node_type
,
port
)
kw
.
update
(
getCluster
=
cluster
.
name
,
getBind
=
address
,
kw
.
update
(
getCluster
=
name
,
getBind
=
address
,
getMasters
=
parseMasterList
(
cluster
.
master_nodes
,
address
))
getMasters
=
parseMasterList
(
master_nodes
,
address
))
super
(
ServerNode
,
self
).
__init__
(
Mock
(
kw
))
super
(
ServerNode
,
self
).
__init__
(
Mock
(
kw
))
def
getVirtualAddress
(
self
):
def
getVirtualAddress
(
self
):
...
@@ -321,9 +327,8 @@ class StorageApplication(ServerNode, neo.storage.app.Application):
...
@@ -321,9 +327,8 @@ class StorageApplication(ServerNode, neo.storage.app.Application):
class
ClientApplication
(
Node
,
neo
.
client
.
app
.
Application
):
class
ClientApplication
(
Node
,
neo
.
client
.
app
.
Application
):
@
SerializedEventManager
.
decorate
@
SerializedEventManager
.
decorate
def
__init__
(
self
,
cluster
):
def
__init__
(
self
,
master_nodes
,
name
):
super
(
ClientApplication
,
self
).
__init__
(
super
(
ClientApplication
,
self
).
__init__
(
master_nodes
,
name
)
cluster
.
master_nodes
,
cluster
.
name
)
self
.
em
.
_lock
=
threading
.
Lock
()
self
.
em
.
_lock
=
threading
.
Lock
()
def
setPoll
(
self
,
master
=
False
):
def
setPoll
(
self
,
master
=
False
):
...
@@ -357,9 +362,8 @@ class ClientApplication(Node, neo.client.app.Application):
...
@@ -357,9 +362,8 @@ class ClientApplication(Node, neo.client.app.Application):
class
NeoCTL
(
neo
.
neoctl
.
app
.
NeoCTL
):
class
NeoCTL
(
neo
.
neoctl
.
app
.
NeoCTL
):
@
SerializedEventManager
.
decorate
@
SerializedEventManager
.
decorate
def
__init__
(
self
,
cluster
):
def
__init__
(
self
,
*
args
,
**
kw
):
self
.
_cluster
=
cluster
super
(
NeoCTL
,
self
).
__init__
(
*
args
,
**
kw
)
super
(
NeoCTL
,
self
).
__init__
(
cluster
.
admin
.
getVirtualAddress
())
self
.
em
.
_timeout
=
-
1
self
.
em
.
_timeout
=
-
1
...
@@ -582,8 +586,9 @@ class NEOCluster(object):
...
@@ -582,8 +586,9 @@ class NEOCluster(object):
self
.
storage_list
=
[
StorageApplication
(
getDatabase
=
db
%
x
,
**
kw
)
self
.
storage_list
=
[
StorageApplication
(
getDatabase
=
db
%
x
,
**
kw
)
for
x
in
db_list
]
for
x
in
db_list
]
self
.
admin_list
=
[
AdminApplication
(
**
kw
)]
self
.
admin_list
=
[
AdminApplication
(
**
kw
)]
self
.
client
=
ClientApplication
(
weak_self
)
self
.
client
=
ClientApplication
(
name
=
self
.
name
,
self
.
neoctl
=
NeoCTL
(
weak_self
)
master_nodes
=
self
.
master_nodes
)
self
.
neoctl
=
NeoCTL
(
self
.
admin
.
getVirtualAddress
())
# A few shortcuts that work when there's only 1 master/storage/admin
# A few shortcuts that work when there's only 1 master/storage/admin
@
property
@
property
...
@@ -607,8 +612,9 @@ class NEOCluster(object):
...
@@ -607,8 +612,9 @@ class NEOCluster(object):
kw
[
'clear_database'
]
=
clear_database
kw
[
'clear_database'
]
=
clear_database
for
node
in
getattr
(
self
,
node_type
+
'_list'
):
for
node
in
getattr
(
self
,
node_type
+
'_list'
):
node
.
resetNode
(
**
kw
)
node
.
resetNode
(
**
kw
)
self
.
client
=
ClientApplication
(
self
)
self
.
client
=
ClientApplication
(
name
=
self
.
name
,
self
.
neoctl
=
NeoCTL
(
weakref
.
proxy
(
self
))
master_nodes
=
self
.
master_nodes
)
self
.
neoctl
=
NeoCTL
(
self
.
admin
.
getVirtualAddress
())
def
start
(
self
,
storage_list
=
None
,
fast_startup
=
False
):
def
start
(
self
,
storage_list
=
None
,
fast_startup
=
False
):
self
.
_patch
()
self
.
_patch
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment