Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
ZEO
Commits
7ae774af
Commit
7ae774af
authored
May 17, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The Refresh product.
parent
bc0b6cca
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
10 deletions
+43
-10
src/ZODB/Connection.py
src/ZODB/Connection.py
+31
-4
src/ZODB/DB.py
src/ZODB/DB.py
+6
-5
src/ZODB/ZApplication.py
src/ZODB/ZApplication.py
+6
-1
No files found.
src/ZODB/Connection.py
View file @
7ae774af
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
##############################################################################
##############################################################################
"""Database connection support
"""Database connection support
$Id: Connection.py,v 1.5
2 2001/05/16 20:47:38 jeremy
Exp $"""
$Id: Connection.py,v 1.5
3 2001/05/17 18:35:10 shane
Exp $"""
__version__
=
'$Revision: 1.5
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
3
$'
[
11
:
-
2
]
from
cPickleCache
import
PickleCache
from
cPickleCache
import
PickleCache
from
POSException
import
ConflictError
,
ExportError
from
POSException
import
ConflictError
,
ExportError
...
@@ -99,6 +99,17 @@ from coptimizations import new_persistent_id
...
@@ -99,6 +99,17 @@ from coptimizations import new_persistent_id
from
ConflictResolution
import
ResolvedSerial
from
ConflictResolution
import
ResolvedSerial
from
types
import
StringType
from
types
import
StringType
global_code_timestamp
=
0
def
updateCodeTimestamp
():
'''
Called after changes are made to persistence-based classes.
Causes all connection caches to be re-created as the
connections are reopened.
'''
global
global_code_timestamp
global_code_timestamp
=
time
()
ExtensionKlass
=
Base
.
__class__
ExtensionKlass
=
Base
.
__class__
class
HelperClass
:
pass
class
HelperClass
:
pass
...
@@ -116,6 +127,7 @@ class Connection(ExportImport.ExportImport):
...
@@ -116,6 +127,7 @@ class Connection(ExportImport.ExportImport):
_tmp
=
None
_tmp
=
None
_debug_info
=
()
_debug_info
=
()
_opened
=
None
_opened
=
None
_code_timestamp
=
0
# Experimental. Other connections can register to be closed
# Experimental. Other connections can register to be closed
# when we close by putting something here.
# when we close by putting something here.
...
@@ -129,6 +141,7 @@ class Connection(ExportImport.ExportImport):
...
@@ -129,6 +141,7 @@ class Connection(ExportImport.ExportImport):
self
.
_invalidated
=
d
=
{}
self
.
_invalidated
=
d
=
{}
self
.
_invalid
=
d
.
has_key
self
.
_invalid
=
d
.
has_key
self
.
_committed
=
[]
self
.
_committed
=
[]
self
.
_code_timestamp
=
global_code_timestamp
def
_breakcr
(
self
):
def
_breakcr
(
self
):
try
:
del
self
.
_cache
try
:
del
self
.
_cache
...
@@ -222,11 +235,25 @@ class Connection(ExportImport.ExportImport):
...
@@ -222,11 +235,25 @@ class Connection(ExportImport.ExportImport):
self
.
_db
=
odb
self
.
_db
=
odb
self
.
_storage
=
s
=
odb
.
_storage
self
.
_storage
=
s
=
odb
.
_storage
self
.
new_oid
=
s
.
new_oid
self
.
new_oid
=
s
.
new_oid
if
self
.
_code_timestamp
!=
global_code_timestamp
:
# New code is in place. Start a new cache.
self
.
_resetCache
()
else
:
self
.
_cache
.
invalidate
(
self
.
_invalidated
)
self
.
_cache
.
invalidate
(
self
.
_invalidated
)
self
.
_opened
=
time
()
self
.
_opened
=
time
()
return
self
return
self
def
_resetCache
(
self
):
'''
Creates a new cache, discarding the old.
'''
self
.
_code_timestamp
=
global_code_timestamp
self
.
_invalidated
.
clear
()
orig_cache
=
self
.
_cache
self
.
_cache
=
PickleCache
(
self
,
orig_cache
.
cache_size
,
orig_cache
.
cache_age
)
def
abort
(
self
,
object
,
transaction
):
def
abort
(
self
,
object
,
transaction
):
"""Abort the object in the transaction.
"""Abort the object in the transaction.
...
...
src/ZODB/DB.py
View file @
7ae774af
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
##############################################################################
##############################################################################
"""Database objects
"""Database objects
$Id: DB.py,v 1.2
8 2001/04/19 16:06:25 jeremy
Exp $"""
$Id: DB.py,v 1.2
9 2001/05/17 18:35:10 shane
Exp $"""
__version__
=
'$Revision: 1.2
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
9
$'
[
11
:
-
2
]
import
cPickle
,
cStringIO
,
sys
,
POSException
,
UndoLogCompatible
import
cPickle
,
cStringIO
,
sys
,
POSException
,
UndoLogCompatible
from
Connection
import
Connection
from
Connection
import
Connection
...
@@ -104,6 +104,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -104,6 +104,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
or more connections, which manage object spaces. Most of the actual work
or more connections, which manage object spaces. Most of the actual work
of managing objects is done by the connections.
of managing objects is done by the connections.
"""
"""
klass
=
Connection
def
__init__
(
self
,
storage
,
def
__init__
(
self
,
storage
,
pool_size
=
7
,
pool_size
=
7
,
...
@@ -404,7 +405,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -404,7 +405,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
# This is a temporary connection.
# This is a temporary connection.
# We won't bother with the pools. This will be
# We won't bother with the pools. This will be
# a one-use connection.
# a one-use connection.
c
=
Connection
(
c
=
self
.
klass
(
version
=
version
,
version
=
version
,
cache_size
=
self
.
_version_cache_size
,
cache_size
=
self
.
_version_cache_size
,
cache_deactivate_after
=
cache_deactivate_after
=
...
@@ -455,7 +456,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -455,7 +456,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
c
=
None
c
=
None
if
version
:
if
version
:
if
self
.
_version_pool_size
>
len
(
allocated
)
or
force
:
if
self
.
_version_pool_size
>
len
(
allocated
)
or
force
:
c
=
Connection
(
c
=
self
.
klass
(
version
=
version
,
version
=
version
,
cache_size
=
self
.
_version_cache_size
,
cache_size
=
self
.
_version_cache_size
,
cache_deactivate_after
=
cache_deactivate_after
=
...
@@ -463,7 +464,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
...
@@ -463,7 +464,7 @@ class DB(UndoLogCompatible.UndoLogCompatible):
allocated
.
append
(
c
)
allocated
.
append
(
c
)
pool
.
append
(
c
)
pool
.
append
(
c
)
elif
self
.
_pool_size
>
len
(
allocated
)
or
force
:
elif
self
.
_pool_size
>
len
(
allocated
)
or
force
:
c
=
Connection
(
c
=
self
.
klass
(
version
=
version
,
version
=
version
,
cache_size
=
self
.
_cache_size
,
cache_size
=
self
.
_cache_size
,
cache_deactivate_after
=
cache_deactivate_after
=
...
...
src/ZODB/ZApplication.py
View file @
7ae774af
...
@@ -87,9 +87,10 @@
...
@@ -87,9 +87,10 @@
This module provides a wrapper that causes a database connection to be created
This module provides a wrapper that causes a database connection to be created
and used when bobo publishes a bobo_application object.
and used when bobo publishes a bobo_application object.
"""
"""
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
StringType
=
type
(
''
)
StringType
=
type
(
''
)
connection_open_hooks
=
[]
class
ZApplicationWrapper
:
class
ZApplicationWrapper
:
...
@@ -117,6 +118,10 @@ class ZApplicationWrapper:
...
@@ -117,6 +118,10 @@ class ZApplicationWrapper:
else
:
version
=
''
else
:
version
=
''
conn
=
db
.
open
(
version
)
conn
=
db
.
open
(
version
)
if
connection_open_hooks
:
for
hook
in
connection_open_hooks
:
hook
(
conn
)
# arrange for the connection to be closed when the request goes away
# arrange for the connection to be closed when the request goes away
cleanup
=
Cleanup
()
cleanup
=
Cleanup
()
cleanup
.
__del__
=
conn
.
close
cleanup
.
__del__
=
conn
.
close
...
...
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