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
Kirill Smelkov
ZODB
Commits
6a2b9187
Commit
6a2b9187
authored
Sep 02, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a C API for calling readCurrent.
(This is indirectly tested by the BTree tests.)
parent
b66cbcc0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
src/persistent/cPersistence.c
src/persistent/cPersistence.c
+25
-1
src/persistent/cPersistence.h
src/persistent/cPersistence.h
+4
-0
No files found.
src/persistent/cPersistence.c
View file @
6a2b9187
...
@@ -223,6 +223,29 @@ changed(cPersistentObject *self)
...
@@ -223,6 +223,29 @@ changed(cPersistentObject *self)
return
0
;
return
0
;
}
}
static
int
readCurrent
(
cPersistentObject
*
self
)
{
if
((
self
->
state
==
cPersistent_UPTODATE_STATE
||
self
->
state
==
cPersistent_STICKY_STATE
)
&&
self
->
jar
&&
self
->
oid
)
{
static
PyObject
*
s_readCurrent
=
NULL
;
PyObject
*
r
;
if
(
s_readCurrent
==
NULL
)
s_readCurrent
=
PyString_InternFromString
(
"readCurrent"
);
r
=
PyObject_CallMethodObjArgs
(
self
->
jar
,
s_readCurrent
,
self
,
NULL
);
if
(
r
==
NULL
)
return
-
1
;
Py_DECREF
(
r
);
}
return
0
;
}
static
PyObject
*
static
PyObject
*
Per__p_deactivate
(
cPersistentObject
*
self
)
Per__p_deactivate
(
cPersistentObject
*
self
)
{
{
...
@@ -1262,9 +1285,10 @@ truecPersistenceCAPI = {
...
@@ -1262,9 +1285,10 @@ truecPersistenceCAPI = {
accessed
,
accessed
,
ghostify
,
ghostify
,
(
intfunctionwithpythonarg
)
Per_setstate
,
(
intfunctionwithpythonarg
)
Per_setstate
,
NULL
/* The percachedel slot is initialized in cPickleCache.c when
NULL
,
/* The percachedel slot is initialized in cPickleCache.c when
the module is loaded. It uses a function in a different
the module is loaded. It uses a function in a different
shared library. */
shared library. */
readCurrent
};
};
void
void
...
...
src/persistent/cPersistence.h
View file @
6a2b9187
...
@@ -103,6 +103,7 @@ typedef struct {
...
@@ -103,6 +103,7 @@ typedef struct {
void
(
*
ghostify
)(
cPersistentObject
*
);
void
(
*
ghostify
)(
cPersistentObject
*
);
int
(
*
setstate
)(
PyObject
*
);
int
(
*
setstate
)(
PyObject
*
);
percachedelfunc
percachedel
;
percachedelfunc
percachedel
;
int
(
*
readCurrent
)(
cPersistentObject
*
);
}
cPersistenceCAPIstruct
;
}
cPersistenceCAPIstruct
;
#define cPersistenceType cPersistenceCAPI->pertype
#define cPersistenceType cPersistenceCAPI->pertype
...
@@ -119,6 +120,9 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
...
@@ -119,6 +120,9 @@ static cPersistenceCAPIstruct *cPersistenceCAPI;
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
#define PER_CHANGED(O) (cPersistenceCAPI->changed((cPersistentObject*)(O)))
#define PER_READCURRENT(O, E) \
if (cPersistenceCAPI->readCurrent((cPersistentObject*)(O)) < 0) { E; }
#define PER_GHOSTIFY(O) (cPersistenceCAPI->ghostify((cPersistentObject*)(O)))
#define PER_GHOSTIFY(O) (cPersistenceCAPI->ghostify((cPersistentObject*)(O)))
/* If the object is sticky, make it non-sticky, so that it can be ghostified.
/* If the object is sticky, make it non-sticky, so that it can be ghostified.
...
...
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