Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
neoppod
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,
return
self
.
app
.
importFrom
(
source
,
None
,
None
,
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 """
return
self
.
app
.
importFrom
(
source
,
start
,
stop
,
self
.
tryToResolveConflict
)
self
.
tryToResolveConflict
,
preindex
)
def
restore
(
self
,
oid
,
serial
,
data
,
version
,
prev_txn
,
transaction
):
raise
NotImplementedError
...
...
neo/client/app.py
View file @
9502dd02
...
...
@@ -1000,18 +1000,20 @@ class Application(object):
return
result
@
profiler_decorator
def
importFrom
(
self
,
source
,
start
,
stop
,
tryToResolveConflict
):
serials
=
{}
def
importFrom
(
self
,
source
,
start
,
stop
,
tryToResolveConflict
,
preindex
=
None
):
if
preindex
is
None
:
preindex
=
{}
transaction_iter
=
source
.
iterator
(
start
,
stop
)
for
transaction
in
transaction_iter
:
tid
=
transaction
.
tid
self
.
tpc_begin
(
transaction
,
tid
,
transaction
.
status
)
for
r
in
transaction
:
oid
=
r
.
oid
pre
=
serials
.
get
(
oid
,
None
)
pre
=
preindex
.
get
(
oid
)
# TODO: bypass conflict resolution, locks...
self
.
store
(
oid
,
pre
,
r
.
data
,
r
.
version
,
transaction
)
serials
[
oid
]
=
tid
preindex
[
oid
]
=
tid
conflicted
=
self
.
tpc_vote
(
transaction
,
tryToResolveConflict
)
assert
not
conflicted
,
conflicted
real_tid
=
self
.
tpc_finish
(
transaction
,
tryToResolveConflict
)
...
...
neo/tests/stat_zodb.py
View file @
9502dd02
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
math
,
os
,
random
,
sys
import
math
,
os
,
random
,
sys
,
time
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.FileStorage
import
FileStorage
...
...
@@ -96,8 +97,10 @@ class DummyZODB(object):
size
=
0
def
iterator
(
storage
,
*
args
):
args
=
' '
,
''
,
''
,
{}
tid
=
None
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
yield
t
def
getSize
(
self
):
...
...
neo/tests/threaded/__init__.py
View file @
9502dd02
...
...
@@ -655,6 +655,15 @@ class NEOCluster(object):
self
.
client
.
setPoll
(
True
)
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
):
txn
=
transaction
.
TransactionManager
()
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