Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
3f8b32df
Commit
3f8b32df
authored
Feb 08, 2009
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull in tempstorage from the new package home
parent
824997f9
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
518 deletions
+0
-518
lib/python/tempstorage/TemporaryStorage.py
lib/python/tempstorage/TemporaryStorage.py
+0
-355
lib/python/tempstorage/__init__.py
lib/python/tempstorage/__init__.py
+0
-1
lib/python/tempstorage/component.xml
lib/python/tempstorage/component.xml
+0
-14
lib/python/tempstorage/config.py
lib/python/tempstorage/config.py
+0
-6
lib/python/tempstorage/tests/__init__.py
lib/python/tempstorage/tests/__init__.py
+0
-15
lib/python/tempstorage/tests/testTemporaryStorage.py
lib/python/tempstorage/tests/testTemporaryStorage.py
+0
-127
No files found.
lib/python/tempstorage/TemporaryStorage.py
deleted
100644 → 0
View file @
824997f9
This diff is collapsed.
Click to expand it.
lib/python/tempstorage/__init__.py
deleted
100644 → 0
View file @
824997f9
""" tempstorage package """
lib/python/tempstorage/component.xml
deleted
100644 → 0
View file @
824997f9
<component
prefix=
"tempstorage.config"
>
<sectiontype
name=
"temporarystorage"
datatype=
".TemporaryStorage"
implements=
"ZODB.storage"
>
<description>
A nonundoing storage which keeps data in RAM and which does
not need to be packed unless cyclic references are kept.
</description>
<key
name=
"name"
default=
"Temporary Storage"
/>
</sectiontype>
</component>
lib/python/tempstorage/config.py
deleted
100644 → 0
View file @
824997f9
from
ZODB.config
import
BaseConfig
class
TemporaryStorage
(
BaseConfig
):
def
open
(
self
):
from
tempstorage.TemporaryStorage
import
TemporaryStorage
return
TemporaryStorage
(
self
.
config
.
name
)
lib/python/tempstorage/tests/__init__.py
deleted
100644 → 0
View file @
824997f9
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
# This file is needed to make this a package.
lib/python/tempstorage/tests/testTemporaryStorage.py
deleted
100644 → 0
View file @
824997f9
import
ZODB
from
ZODB.tests.MinPO
import
MinPO
from
tempstorage
import
TemporaryStorage
import
sys
,
os
,
unittest
,
time
from
ZODB.tests
import
StorageTestBase
,
BasicStorage
,
\
Synchronization
,
ConflictResolution
,
\
Corruption
,
RevisionStorage
,
MTStorage
from
persistent
import
Persistent
import
transaction
from
ZODB.DB
import
DB
from
ZODB.POSException
import
ReadConflictError
class
TemporaryStorageTests
(
StorageTestBase
.
StorageTestBase
,
## RevisionStorage.RevisionStorage, # not a revision storage, but passes
BasicStorage
.
BasicStorage
,
Synchronization
.
SynchronizedStorage
,
ConflictResolution
.
ConflictResolvingStorage
,
MTStorage
.
MTStorage
,
):
def
open
(
self
,
**
kwargs
):
self
.
_storage
=
TemporaryStorage
.
TemporaryStorage
(
'foo'
)
def
setUp
(
self
):
StorageTestBase
.
StorageTestBase
.
setUp
(
self
)
self
.
open
()
def
tearDown
(
self
):
StorageTestBase
.
StorageTestBase
.
tearDown
(
self
)
def
checkConflictCacheIsCleared
(
self
):
old_gcevery
=
TemporaryStorage
.
CONFLICT_CACHE_GCEVERY
old_maxage
=
TemporaryStorage
.
CONFLICT_CACHE_MAXAGE
TemporaryStorage
.
CONFLICT_CACHE_GCEVERY
=
5
TemporaryStorage
.
CONFLICT_CACHE_MAXAGE
=
5
try
:
oid
=
self
.
_storage
.
new_oid
()
self
.
_dostore
(
oid
,
data
=
MinPO
(
5
))
time
.
sleep
(
TemporaryStorage
.
CONFLICT_CACHE_GCEVERY
+
1
)
oid2
=
self
.
_storage
.
new_oid
()
self
.
_dostore
(
oid2
,
data
=
MinPO
(
10
))
oid3
=
self
.
_storage
.
new_oid
()
self
.
_dostore
(
oid3
,
data
=
MinPO
(
9
))
assert
len
(
self
.
_storage
.
_conflict_cache
)
==
2
time
.
sleep
(
TemporaryStorage
.
CONFLICT_CACHE_GCEVERY
+
1
)
oid4
=
self
.
_storage
.
new_oid
()
self
.
_dostore
(
oid4
,
data
=
MinPO
(
11
))
assert
len
(
self
.
_storage
.
_conflict_cache
)
==
1
finally
:
TemporaryStorage
.
CONFLICT_CACHE_GCEVERY
=
old_gcevery
TemporaryStorage
.
CONFLICT_CACHE_MAXAGE
=
old_maxage
def
doreadconflict
(
self
,
db
,
mvcc
):
tm1
=
transaction
.
TransactionManager
()
conn
=
db
.
open
(
transaction_manager
=
tm1
)
r1
=
conn
.
root
()
obj
=
MinPO
(
'root'
)
r1
[
"p"
]
=
obj
obj
=
r1
[
"p"
]
obj
.
child1
=
MinPO
(
'child1'
)
tm1
.
get
().
commit
()
# start a new transaction with a new connection
tm2
=
transaction
.
TransactionManager
()
cn2
=
db
.
open
(
transaction_manager
=
tm2
)
r2
=
cn2
.
root
()
self
.
assertEqual
(
r1
.
_p_serial
,
r2
.
_p_serial
)
obj
.
child2
=
MinPO
(
'child2'
)
tm1
.
get
().
commit
()
# resume the transaction using cn2
obj
=
r2
[
"p"
]
# An attempt to access obj.child1 should fail with an RCE
# below if conn isn't using mvcc, because r2 was read earlier
# in the transaction and obj was modified by the other
# transaction.
obj
.
child1
return
obj
def
checkWithMVCCDoesntRaiseReadConflict
(
self
):
db
=
DB
(
self
.
_storage
)
ob
=
self
.
doreadconflict
(
db
,
True
)
self
.
assertEquals
(
ob
.
__class__
,
MinPO
)
self
.
assertEquals
(
getattr
(
ob
,
'child1'
,
MinPO
()).
value
,
'child1'
)
self
.
failIf
(
getattr
(
ob
,
'child2'
,
None
))
def
checkLoadEx
(
self
):
oid
=
self
.
_storage
.
new_oid
()
self
.
_dostore
(
oid
,
data
=
MinPO
(
1
))
loadp
,
loads
=
self
.
_storage
.
load
(
oid
,
'whatever'
)
exp
,
exs
,
exv
=
self
.
_storage
.
loadEx
(
oid
,
'whatever'
)
self
.
assertEqual
(
loadp
,
exp
)
self
.
assertEqual
(
loads
,
exs
)
self
.
assertEqual
(
exv
,
''
)
def
test_suite
():
suite
=
unittest
.
makeSuite
(
TemporaryStorageTests
,
'check'
)
suite2
=
unittest
.
makeSuite
(
Corruption
.
FileStorageCorruptTests
,
'check'
)
suite
.
addTest
(
suite2
)
return
suite
def
main
():
alltests
=
test_suite
()
runner
=
unittest
.
TextTestRunner
(
verbosity
=
9
)
runner
.
run
(
alltests
)
def
debug
():
test_suite
().
debug
()
def
pdebug
():
import
pdb
pdb
.
run
(
'debug()'
)
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
>
1
:
globals
()[
sys
.
argv
[
1
]]()
else
:
main
()
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