Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
persistent
Commits
90104c33
Commit
90104c33
authored
Apr 09, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaks suggested by @tseaver
parent
bfd0b7de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
persistent/persistence.py
persistent/persistence.py
+2
-3
persistent/picklecache.py
persistent/picklecache.py
+7
-1
No files found.
persistent/persistence.py
View file @
90104c33
...
...
@@ -74,9 +74,8 @@ class Persistent(object):
# The C implementation only forbids changing the jar
# if we're already in a cache. Match its error message
raise
ValueError
(
'can not change _p_jar of cached object'
)
if
self
.
__jar
==
value
:
return
else
:
if
self
.
__jar
!=
value
:
_OSA
(
self
,
'_Persistent__jar'
,
value
)
_OSA
(
self
,
'_Persistent__flags'
,
0
)
...
...
persistent/picklecache.py
View file @
90104c33
...
...
@@ -11,7 +11,6 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from
__future__
import
print_function
import
gc
import
weakref
...
...
@@ -37,6 +36,10 @@ class RingNode(object):
self
.
prev
=
prev
def
_sweeping_ring
(
f
):
# A decorator for functions in the PickleCache
# that are sweeping the entire ring (mutating it);
# serves as a pseudo-lock to not mutate the ring further
# in other functions
def
locked
(
self
,
*
args
,
**
kwargs
):
self
.
_is_sweeping_ring
=
True
try
:
...
...
@@ -51,6 +54,8 @@ class PickleCache(object):
total_estimated_size
=
0
cache_size_bytes
=
0
# Set by functions that sweep the entire ring (via _sweeping_ring)
# Serves as a pseudo-lock
_is_sweeping_ring
=
False
def
__init__
(
self
,
jar
,
target_size
=
0
,
cache_size_bytes
=
0
):
...
...
@@ -339,6 +344,7 @@ class PickleCache(object):
while
(
node
is
not
self
.
ring
and
(
self
.
non_ghost_count
>
target
or
(
target_size_bytes
and
self
.
total_estimated_size
>
target_size_bytes
))):
if
node
.
object
.
_p_state
==
UPTODATE
:
# The C implementation will only evict things that are specifically
# in the up-to-date state
...
...
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