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
e1a789c1
Commit
e1a789c1
authored
Dec 30, 2019
by
Jens W. Klein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #292 improve volatile attribute documentation
parent
8e97bd7d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
CHANGES.rst
CHANGES.rst
+2
-0
doc/guide/writing-persistent-objects.rst
doc/guide/writing-persistent-objects.rst
+20
-7
No files found.
CHANGES.rst
View file @
e1a789c1
...
...
@@ -5,6 +5,8 @@
5.6.0 (unreleased)
==================
- Improve volatile attribute ``_v_`` documentation.
- Make repozo's recover mode atomic by recovering the backup in a
temporary file which is then moved to the expected output file.
...
...
doc/guide/writing-persistent-objects.rst
View file @
e1a789c1
...
...
@@ -264,18 +264,31 @@ _p_jar
commonly used by database-aware application code to get hold of an
object'
s
database
connection
.
Attributes
with
names
starting
with
``
_v_
``
are
treated
as
volatile
.
They
aren
't saved to the database. They'
re
useful
for
caching
data
that
can
be
computed
from
saved
data
and
shouldn
't be saved [#cache]_.
They should be treated as though they can disappear between
transactions. Setting a volatile attribute doesn'
t
cause
an
object
to
be
considered
to
be
modified
.
An
object
's ``__dict__`` attribute is treated specially in that
getting it doesn'
t
cause
an
object
's state to be loaded. It may have
the value ``None`` rather than a dictionary for :ref:`ghosts
<ghost-label>`.
Volatile Attributes
-------------------
Attributes with names starting with ``_v_`` are treated as volatile.
They are useful for caching data that can be computed from saved data
and should not be saved [#cache]_.
They are never serialized and not saved to the database.
Volatile attributes are local to a specific active object in memory and
thus to a specific connection.
They should be treated as though they can disappear between transactions:
If an object is removed from the connection cache the volatile attribute is
gone.
Because ZODB connections can be used (in a serial fashion) from one thread
and then another, it is possible to see volatile attributes that were set
in one thread in a process appear in another thread in that process.
Setting a volatile attribute does not cause an object to be considered to
be modified.
Object storage and management
=============================
...
...
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