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
9502dd02
Commit
9502dd02
authored
Jan 17, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New populate() method for threaded tests
Storage.importFrom is changed for resumable imports.
parent
0a511052
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
neo/client/Storage.py
neo/client/Storage.py
+2
-2
neo/client/app.py
neo/client/app.py
+6
-4
neo/tests/stat_zodb.py
neo/tests/stat_zodb.py
+6
-3
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+9
-0
No files found.
neo/client/Storage.py
View file @
9502dd02
...
@@ -232,10 +232,10 @@ class Storage(BaseStorage.BaseStorage,
...
@@ -232,10 +232,10 @@ class Storage(BaseStorage.BaseStorage,
return
self
.
app
.
importFrom
(
source
,
None
,
None
,
return
self
.
app
.
importFrom
(
source
,
None
,
None
,
self
.
tryToResolveConflict
)
self
.
tryToResolveConflict
)
def
importFrom
(
self
,
source
,
start
=
None
,
stop
=
None
):
def
importFrom
(
self
,
source
,
start
=
None
,
stop
=
None
,
preindex
=
None
):
""" Allow import only a part of the source storage """
""" Allow import only a part of the source storage """
return
self
.
app
.
importFrom
(
source
,
start
,
stop
,
return
self
.
app
.
importFrom
(
source
,
start
,
stop
,
self
.
tryToResolveConflict
)
self
.
tryToResolveConflict
,
preindex
)
def
restore
(
self
,
oid
,
serial
,
data
,
version
,
prev_txn
,
transaction
):
def
restore
(
self
,
oid
,
serial
,
data
,
version
,
prev_txn
,
transaction
):
raise
NotImplementedError
raise
NotImplementedError
...
...
neo/client/app.py
View file @
9502dd02
...
@@ -1000,18 +1000,20 @@ class Application(object):
...
@@ -1000,18 +1000,20 @@ class Application(object):
return
result
return
result
@
profiler_decorator
@
profiler_decorator
def
importFrom
(
self
,
source
,
start
,
stop
,
tryToResolveConflict
):
def
importFrom
(
self
,
source
,
start
,
stop
,
tryToResolveConflict
,
serials
=
{}
preindex
=
None
):
if
preindex
is
None
:
preindex
=
{}
transaction_iter
=
source
.
iterator
(
start
,
stop
)
transaction_iter
=
source
.
iterator
(
start
,
stop
)
for
transaction
in
transaction_iter
:
for
transaction
in
transaction_iter
:
tid
=
transaction
.
tid
tid
=
transaction
.
tid
self
.
tpc_begin
(
transaction
,
tid
,
transaction
.
status
)
self
.
tpc_begin
(
transaction
,
tid
,
transaction
.
status
)
for
r
in
transaction
:
for
r
in
transaction
:
oid
=
r
.
oid
oid
=
r
.
oid
pre
=
serials
.
get
(
oid
,
None
)
pre
=
preindex
.
get
(
oid
)
# TODO: bypass conflict resolution, locks...
# TODO: bypass conflict resolution, locks...
self
.
store
(
oid
,
pre
,
r
.
data
,
r
.
version
,
transaction
)
self
.
store
(
oid
,
pre
,
r
.
data
,
r
.
version
,
transaction
)
serials
[
oid
]
=
tid
preindex
[
oid
]
=
tid
conflicted
=
self
.
tpc_vote
(
transaction
,
tryToResolveConflict
)
conflicted
=
self
.
tpc_vote
(
transaction
,
tryToResolveConflict
)
assert
not
conflicted
,
conflicted
assert
not
conflicted
,
conflicted
real_tid
=
self
.
tpc_finish
(
transaction
,
tryToResolveConflict
)
real_tid
=
self
.
tpc_finish
(
transaction
,
tryToResolveConflict
)
...
...
neo/tests/stat_zodb.py
View file @
9502dd02
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
math
,
os
,
random
,
sys
import
math
,
os
,
random
,
sys
,
time
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
ZODB.utils
import
p64
from
persistent.TimeStamp
import
TimeStamp
from
ZODB.utils
import
p64
,
newTid
from
ZODB.BaseStorage
import
TransactionRecord
from
ZODB.BaseStorage
import
TransactionRecord
from
ZODB.FileStorage
import
FileStorage
from
ZODB.FileStorage
import
FileStorage
...
@@ -96,8 +97,10 @@ class DummyZODB(object):
...
@@ -96,8 +97,10 @@ class DummyZODB(object):
size
=
0
size
=
0
def
iterator
(
storage
,
*
args
):
def
iterator
(
storage
,
*
args
):
args
=
' '
,
''
,
''
,
{}
args
=
' '
,
''
,
''
,
{}
tid
=
None
for
i
in
xrange
(
1
,
transaction_count
+
1
):
for
i
in
xrange
(
1
,
transaction_count
+
1
):
t
=
dummy_transaction
(
p64
(
i
),
*
args
)
tid
=
newTid
(
tid
)
t
=
dummy_transaction
(
tid
,
*
args
)
storage
.
size
+=
t
.
size
storage
.
size
+=
t
.
size
yield
t
yield
t
def
getSize
(
self
):
def
getSize
(
self
):
...
...
neo/tests/threaded/__init__.py
View file @
9502dd02
...
@@ -655,6 +655,15 @@ class NEOCluster(object):
...
@@ -655,6 +655,15 @@ class NEOCluster(object):
self
.
client
.
setPoll
(
True
)
self
.
client
.
setPoll
(
True
)
return
Storage
.
Storage
(
None
,
self
.
name
,
_app
=
self
.
client
,
**
kw
)
return
Storage
.
Storage
(
None
,
self
.
name
,
_app
=
self
.
client
,
**
kw
)
def
populate
(
self
,
dummy_zodb
=
None
):
if
dummy_zodb
is
None
:
from
..stat_zodb
import
PROD1
dummy_zodb
=
PROD1
()
importFrom
=
self
.
getZODBStorage
().
importFrom
preindex
=
{}
as_storage
=
dummy_zodb
.
as_storage
return
lambda
count
:
importFrom
(
as_storage
(
count
),
preindex
=
preindex
)
def
getTransaction
(
self
):
def
getTransaction
(
self
):
txn
=
transaction
.
TransactionManager
()
txn
=
transaction
.
TransactionManager
()
return
txn
,
self
.
db
.
open
(
transaction_manager
=
txn
)
return
txn
,
self
.
db
.
open
(
transaction_manager
=
txn
)
...
...
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