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
51449b3f
Commit
51449b3f
authored
May 14, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added invalidation method to simplify and speed deactivation of
invalidated objects.
parent
259afd59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
207 additions
and
36 deletions
+207
-36
src/Persistence/cPickleCache.c
src/Persistence/cPickleCache.c
+69
-12
src/ZODB/cPickleCache.c
src/ZODB/cPickleCache.c
+69
-12
src/persistent/cPickleCache.c
src/persistent/cPickleCache.c
+69
-12
No files found.
src/Persistence/cPickleCache.c
View file @
51449b3f
...
...
@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file.
****************************************************************************/
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
19 1999/05/12 15:55:44
jim Exp $"
;
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
20 1999/05/14 19:22:38
jim Exp $"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -94,7 +94,7 @@ static char *what_string = "$Id: cPickleCache.c,v 1.19 1999/05/12 15:55:44 jim E
#undef Py_FindMethod
static
PyObject
*
py_reload
,
*
py__p_jar
,
*
py__p_
deactivate
;
static
PyObject
*
py_reload
,
*
py__p_jar
,
*
py__p_
changed
;
typedef
struct
{
PyObject_HEAD
...
...
@@ -164,14 +164,8 @@ gc_item(ccobject *self, PyObject *key, PyObject *v, long now, int dt)
state.
*/
self
->
sum_deac
++
;
if
(
key
=
PyObject_GetAttr
(
v
,
py__p_deactivate
))
{
ASSIGN
(
key
,
PyObject_CallObject
(
key
,
NULL
));
UNLESS
(
key
)
return
-
1
;
Py_DECREF
(
key
);
return
0
;
}
PyErr_Clear
();
if
(
PyObject_SetAttr
(
v
,
py__p_changed
,
Py_None
)
<
0
)
PyErr_Clear
();
}
}
}
...
...
@@ -346,6 +340,67 @@ cc_incrgc(ccobject *self, PyObject *args)
return
Py_None
;
}
static
void
_invalidate
(
ccobject
*
self
,
PyObject
*
key
)
{
PyObject
*
v
;
if
((
v
=
PyDict_GetItem
(
self
->
data
,
key
)))
{
if
((
!
PyExtensionClass_Check
(
v
))
&&
PyObject_DelAttr
(
v
,
py__p_changed
)
<
0
)
PyErr_Clear
();
}
else
PyErr_Clear
();
}
static
PyObject
*
cc_invalidate
(
ccobject
*
self
,
PyObject
*
args
)
{
PyObject
*
inv
,
*
key
,
*
v
;
int
i
,
l
;
if
(
PyArg_ParseTuple
(
args
,
"O!"
,
PyDict_Type
,
&
inv
))
{
for
(
i
=
0
;
PyDict_Next
(
inv
,
&
i
,
&
key
,
&
v
);
)
if
(
key
==
Py_None
)
{
/* Eek some nitwit invalidated everything! */
for
(
i
=
0
;
PyDict_Next
(
self
->
data
,
&
i
,
&
key
,
&
v
);
)
_invalidate
(
self
,
key
);
break
;
}
else
_invalidate
(
self
,
key
);
PyDict_Clear
(
inv
);
}
else
{
PyErr_Clear
();
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
inv
))
return
NULL
;
if
(
PyString_Check
(
inv
))
_invalidate
(
self
,
key
);
else
if
(
inv
==
Py_None
)
/* All */
for
(
i
=
0
;
PyDict_Next
(
self
->
data
,
&
i
,
&
key
,
&
v
);
)
_invalidate
(
self
,
key
);
else
{
int
l
;
PyErr_Clear
();
if
((
l
=
PyObject_Length
(
inv
))
<
0
)
return
NULL
;
for
(
i
=
l
;
--
i
>=
0
;
)
{
UNLESS
(
key
=
PySequence_GetItem
(
inv
,
i
))
return
NULL
;
_invalidate
(
self
,
key
);
Py_DECREF
(
key
);
}
PySequence_DelSlice
(
inv
,
0
,
l
);
}
}
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
struct
PyMethodDef
cc_methods
[]
=
{
{
"full_sweep"
,
(
PyCFunction
)
cc_full_sweep
,
METH_VARARGS
,
"full_sweep([age]) -- Perform a full sweep of the cache
\n\n
"
...
...
@@ -362,6 +417,8 @@ static struct PyMethodDef cc_methods[] = {
},
{
"incrgc"
,
(
PyCFunction
)
cc_incrgc
,
METH_VARARGS
,
"incrgc() -- Perform incremental garbage collection"
},
{
"invalidate"
,
(
PyCFunction
)
cc_invalidate
,
METH_VARARGS
,
"invalidate(oids) -- invalidate one, many, or all ids"
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -566,7 +623,7 @@ void
initcPickleCache
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
19
$"
;
char
*
rev
=
"$Revision: 1.
20
$"
;
Cctype
.
ob_type
=&
PyType_Type
;
...
...
@@ -579,7 +636,7 @@ initcPickleCache()
py_reload
=
PyString_FromString
(
"reload"
);
py__p_jar
=
PyString_FromString
(
"_p_jar"
);
py__p_
deactivate
=
PyString_FromString
(
"_p_deactivate
"
);
py__p_
changed
=
PyString_FromString
(
"_p_changed
"
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromStringAndSize
(
rev
+
11
,
strlen
(
rev
+
11
)
-
2
));
...
...
src/ZODB/cPickleCache.c
View file @
51449b3f
...
...
@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file.
****************************************************************************/
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
19 1999/05/12 15:55:44
jim Exp $"
;
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
20 1999/05/14 19:22:38
jim Exp $"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -94,7 +94,7 @@ static char *what_string = "$Id: cPickleCache.c,v 1.19 1999/05/12 15:55:44 jim E
#undef Py_FindMethod
static
PyObject
*
py_reload
,
*
py__p_jar
,
*
py__p_
deactivate
;
static
PyObject
*
py_reload
,
*
py__p_jar
,
*
py__p_
changed
;
typedef
struct
{
PyObject_HEAD
...
...
@@ -164,14 +164,8 @@ gc_item(ccobject *self, PyObject *key, PyObject *v, long now, int dt)
state.
*/
self
->
sum_deac
++
;
if
(
key
=
PyObject_GetAttr
(
v
,
py__p_deactivate
))
{
ASSIGN
(
key
,
PyObject_CallObject
(
key
,
NULL
));
UNLESS
(
key
)
return
-
1
;
Py_DECREF
(
key
);
return
0
;
}
PyErr_Clear
();
if
(
PyObject_SetAttr
(
v
,
py__p_changed
,
Py_None
)
<
0
)
PyErr_Clear
();
}
}
}
...
...
@@ -346,6 +340,67 @@ cc_incrgc(ccobject *self, PyObject *args)
return
Py_None
;
}
static
void
_invalidate
(
ccobject
*
self
,
PyObject
*
key
)
{
PyObject
*
v
;
if
((
v
=
PyDict_GetItem
(
self
->
data
,
key
)))
{
if
((
!
PyExtensionClass_Check
(
v
))
&&
PyObject_DelAttr
(
v
,
py__p_changed
)
<
0
)
PyErr_Clear
();
}
else
PyErr_Clear
();
}
static
PyObject
*
cc_invalidate
(
ccobject
*
self
,
PyObject
*
args
)
{
PyObject
*
inv
,
*
key
,
*
v
;
int
i
,
l
;
if
(
PyArg_ParseTuple
(
args
,
"O!"
,
PyDict_Type
,
&
inv
))
{
for
(
i
=
0
;
PyDict_Next
(
inv
,
&
i
,
&
key
,
&
v
);
)
if
(
key
==
Py_None
)
{
/* Eek some nitwit invalidated everything! */
for
(
i
=
0
;
PyDict_Next
(
self
->
data
,
&
i
,
&
key
,
&
v
);
)
_invalidate
(
self
,
key
);
break
;
}
else
_invalidate
(
self
,
key
);
PyDict_Clear
(
inv
);
}
else
{
PyErr_Clear
();
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
inv
))
return
NULL
;
if
(
PyString_Check
(
inv
))
_invalidate
(
self
,
key
);
else
if
(
inv
==
Py_None
)
/* All */
for
(
i
=
0
;
PyDict_Next
(
self
->
data
,
&
i
,
&
key
,
&
v
);
)
_invalidate
(
self
,
key
);
else
{
int
l
;
PyErr_Clear
();
if
((
l
=
PyObject_Length
(
inv
))
<
0
)
return
NULL
;
for
(
i
=
l
;
--
i
>=
0
;
)
{
UNLESS
(
key
=
PySequence_GetItem
(
inv
,
i
))
return
NULL
;
_invalidate
(
self
,
key
);
Py_DECREF
(
key
);
}
PySequence_DelSlice
(
inv
,
0
,
l
);
}
}
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
struct
PyMethodDef
cc_methods
[]
=
{
{
"full_sweep"
,
(
PyCFunction
)
cc_full_sweep
,
METH_VARARGS
,
"full_sweep([age]) -- Perform a full sweep of the cache
\n\n
"
...
...
@@ -362,6 +417,8 @@ static struct PyMethodDef cc_methods[] = {
},
{
"incrgc"
,
(
PyCFunction
)
cc_incrgc
,
METH_VARARGS
,
"incrgc() -- Perform incremental garbage collection"
},
{
"invalidate"
,
(
PyCFunction
)
cc_invalidate
,
METH_VARARGS
,
"invalidate(oids) -- invalidate one, many, or all ids"
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -566,7 +623,7 @@ void
initcPickleCache
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
19
$"
;
char
*
rev
=
"$Revision: 1.
20
$"
;
Cctype
.
ob_type
=&
PyType_Type
;
...
...
@@ -579,7 +636,7 @@ initcPickleCache()
py_reload
=
PyString_FromString
(
"reload"
);
py__p_jar
=
PyString_FromString
(
"_p_jar"
);
py__p_
deactivate
=
PyString_FromString
(
"_p_deactivate
"
);
py__p_
changed
=
PyString_FromString
(
"_p_changed
"
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromStringAndSize
(
rev
+
11
,
strlen
(
rev
+
11
)
-
2
));
...
...
src/persistent/cPickleCache.c
View file @
51449b3f
...
...
@@ -82,7 +82,7 @@
attributions are listed in the accompanying credits file.
****************************************************************************/
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
19 1999/05/12 15:55:44
jim Exp $"
;
static
char
*
what_string
=
"$Id: cPickleCache.c,v 1.
20 1999/05/14 19:22:38
jim Exp $"
;
#define ASSIGN(V,E) {PyObject *__e; __e=(E); Py_XDECREF(V); (V)=__e;}
#define UNLESS(E) if(!(E))
...
...
@@ -94,7 +94,7 @@ static char *what_string = "$Id: cPickleCache.c,v 1.19 1999/05/12 15:55:44 jim E
#undef Py_FindMethod
static
PyObject
*
py_reload
,
*
py__p_jar
,
*
py__p_
deactivate
;
static
PyObject
*
py_reload
,
*
py__p_jar
,
*
py__p_
changed
;
typedef
struct
{
PyObject_HEAD
...
...
@@ -164,14 +164,8 @@ gc_item(ccobject *self, PyObject *key, PyObject *v, long now, int dt)
state.
*/
self
->
sum_deac
++
;
if
(
key
=
PyObject_GetAttr
(
v
,
py__p_deactivate
))
{
ASSIGN
(
key
,
PyObject_CallObject
(
key
,
NULL
));
UNLESS
(
key
)
return
-
1
;
Py_DECREF
(
key
);
return
0
;
}
PyErr_Clear
();
if
(
PyObject_SetAttr
(
v
,
py__p_changed
,
Py_None
)
<
0
)
PyErr_Clear
();
}
}
}
...
...
@@ -346,6 +340,67 @@ cc_incrgc(ccobject *self, PyObject *args)
return
Py_None
;
}
static
void
_invalidate
(
ccobject
*
self
,
PyObject
*
key
)
{
PyObject
*
v
;
if
((
v
=
PyDict_GetItem
(
self
->
data
,
key
)))
{
if
((
!
PyExtensionClass_Check
(
v
))
&&
PyObject_DelAttr
(
v
,
py__p_changed
)
<
0
)
PyErr_Clear
();
}
else
PyErr_Clear
();
}
static
PyObject
*
cc_invalidate
(
ccobject
*
self
,
PyObject
*
args
)
{
PyObject
*
inv
,
*
key
,
*
v
;
int
i
,
l
;
if
(
PyArg_ParseTuple
(
args
,
"O!"
,
PyDict_Type
,
&
inv
))
{
for
(
i
=
0
;
PyDict_Next
(
inv
,
&
i
,
&
key
,
&
v
);
)
if
(
key
==
Py_None
)
{
/* Eek some nitwit invalidated everything! */
for
(
i
=
0
;
PyDict_Next
(
self
->
data
,
&
i
,
&
key
,
&
v
);
)
_invalidate
(
self
,
key
);
break
;
}
else
_invalidate
(
self
,
key
);
PyDict_Clear
(
inv
);
}
else
{
PyErr_Clear
();
UNLESS
(
PyArg_ParseTuple
(
args
,
"O"
,
&
inv
))
return
NULL
;
if
(
PyString_Check
(
inv
))
_invalidate
(
self
,
key
);
else
if
(
inv
==
Py_None
)
/* All */
for
(
i
=
0
;
PyDict_Next
(
self
->
data
,
&
i
,
&
key
,
&
v
);
)
_invalidate
(
self
,
key
);
else
{
int
l
;
PyErr_Clear
();
if
((
l
=
PyObject_Length
(
inv
))
<
0
)
return
NULL
;
for
(
i
=
l
;
--
i
>=
0
;
)
{
UNLESS
(
key
=
PySequence_GetItem
(
inv
,
i
))
return
NULL
;
_invalidate
(
self
,
key
);
Py_DECREF
(
key
);
}
PySequence_DelSlice
(
inv
,
0
,
l
);
}
}
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
struct
PyMethodDef
cc_methods
[]
=
{
{
"full_sweep"
,
(
PyCFunction
)
cc_full_sweep
,
METH_VARARGS
,
"full_sweep([age]) -- Perform a full sweep of the cache
\n\n
"
...
...
@@ -362,6 +417,8 @@ static struct PyMethodDef cc_methods[] = {
},
{
"incrgc"
,
(
PyCFunction
)
cc_incrgc
,
METH_VARARGS
,
"incrgc() -- Perform incremental garbage collection"
},
{
"invalidate"
,
(
PyCFunction
)
cc_invalidate
,
METH_VARARGS
,
"invalidate(oids) -- invalidate one, many, or all ids"
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -566,7 +623,7 @@ void
initcPickleCache
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.
19
$"
;
char
*
rev
=
"$Revision: 1.
20
$"
;
Cctype
.
ob_type
=&
PyType_Type
;
...
...
@@ -579,7 +636,7 @@ initcPickleCache()
py_reload
=
PyString_FromString
(
"reload"
);
py__p_jar
=
PyString_FromString
(
"_p_jar"
);
py__p_
deactivate
=
PyString_FromString
(
"_p_deactivate
"
);
py__p_
changed
=
PyString_FromString
(
"_p_changed
"
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromStringAndSize
(
rev
+
11
,
strlen
(
rev
+
11
)
-
2
));
...
...
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