Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
nexedi
ZODB
Commits
0931919e
Commit
0931919e
authored
Feb 27, 2004
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
markup glitches
parent
22a837d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
1 deletion
+57
-1
src/ZODB/DB.py
src/ZODB/DB.py
+57
-1
No files found.
src/ZODB/DB.py
View file @
0931919e
...
...
@@ -13,7 +13,7 @@
##############################################################################
"""Database objects
$Id: DB.py,v 1.6
5 2004/02/27 16:50:02
jeremy Exp $"""
$Id: DB.py,v 1.6
6 2004/02/27 22:02:47
jeremy Exp $"""
import
cPickle
,
cStringIO
,
sys
from
thread
import
allocate_lock
...
...
@@ -296,6 +296,18 @@ class DB(object):
return
m
def
close
(
self
):
"""Close the database and its underlying storage.
It is important to close the database, because the storage may
flush in-memory data structures to disk when it is closed.
Leaving the storage open with the process exits can cause the
next open to be slow.
What effect does closing the database have on existing
connections? Technically, they remain open, but their storage
is closed, so they stop behaving usefully. Perhaps close()
should also close all the Connections.
"""
self
.
_storage
.
close
()
def
commitVersion
(
self
,
source
,
destination
=
''
,
transaction
=
None
):
...
...
@@ -541,6 +553,20 @@ class DB(object):
return
self
.
_activity_monitor
def
pack
(
self
,
t
=
None
,
days
=
0
):
"""Pack the storage, deleting unused object revisions.
A pack is always performed relative to a particular time, by
default the current time. All object revisions that are not
reachable as of the pack time are deleted from the storage.
The cost of this operation varies by storage, but it is
usually an expensive operation.
@param t: pack time in seconds since the epoch
@type t: C{float}
@param days: days to subtract from C{t} to compute pack time
@type days: C{int}
"""
if
t
is
None
:
t
=
time
()
t
=
t
-
(
days
*
86400
)
try
:
self
.
_storage
.
pack
(
t
,
referencesf
)
...
...
@@ -557,6 +583,20 @@ class DB(object):
c
.
_cache
.
cache_size
=
v
def
setClassFactory
(
self
,
factory
):
"""Override default mechanism for loading object classes.
The database stores objects, but uses Python's standard import
to load the code for those objects. The class factory is used
by the database serialization layer to find the classes. It
uses L{ZODB.broken.find_global<find_global>} by default.
This method can be used to override the default class loading
code. See L{ZODB.broken.find_global<find_global>} for details
about the contract of C{factory}.
@param factory: A class factory for unpickling
@type factory: C{function}
"""
self
.
_classFactory
=
factory
def
setPoolSize
(
self
,
v
):
...
...
@@ -577,6 +617,22 @@ class DB(object):
def
cacheStatistics
(
self
):
return
()
# :(
def
undo
(
self
,
id
,
transaction
=
None
):
"""Undo a transaction identified by C{id}.
A transaction can be undone if all of the objects involved in
the transaction were not modified subsequently, if any
modifications can be resolved by conflict resolution, or if
subsequent changes resulted in the same object state.
The value of C{id} should be generated by calling C{undoLog}
or C{undoInfo}. The value of C{id} is not the same as a
transaction id used by other methods; it is unique to C{undo}.
@param id: a storage-specific transaction identifier
@type id: C{string}
@param transaction: a transaction context to use
@type transaction: C{Transaction}
"""
if
transaction
is
None
:
transaction
=
get_transaction
()
transaction
.
register
(
TransactionalUndo
(
self
,
id
))
...
...
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