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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
f80e1312
Commit
f80e1312
authored
Feb 19, 2001
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made persistence optional.
parent
f3b85e9b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
30 deletions
+66
-30
src/BTrees/BTreeModuleTemplate.c
src/BTrees/BTreeModuleTemplate.c
+27
-3
src/BTrees/BTreeTemplate.c
src/BTrees/BTreeTemplate.c
+8
-12
src/BTrees/BucketTemplate.c
src/BTrees/BucketTemplate.c
+8
-12
src/BTrees/IIBTree.c
src/BTrees/IIBTree.c
+2
-0
src/BTrees/IOBTree.c
src/BTrees/IOBTree.c
+3
-0
src/BTrees/OIBTree.c
src/BTrees/OIBTree.c
+3
-0
src/BTrees/OOBTree.c
src/BTrees/OOBTree.c
+3
-0
src/BTrees/SetTemplate.c
src/BTrees/SetTemplate.c
+6
-2
src/BTrees/TreeSetTemplate.c
src/BTrees/TreeSetTemplate.c
+6
-1
No files found.
src/BTrees/BTreeModuleTemplate.c
View file @
f80e1312
...
...
@@ -85,9 +85,10 @@
static
char
BTree_module_documentation
[]
=
""
"
\n
$Id: BTreeModuleTemplate.c,v 1.
1 2001/02/19 00:09:45
jim Exp $"
"
\n
$Id: BTreeModuleTemplate.c,v 1.
2 2001/02/19 00:38:41
jim Exp $"
;
#ifdef PERSISTENT
#include "cPersistence.h"
/***************************************************************
...
...
@@ -100,9 +101,17 @@ static char BTree_module_documentation[] =
? (((O)->state==cPersistent_UPTODATE_STATE) \
? ((O)->state=cPersistent_STICKY_STATE) : 1) : 0)
#define Ghost_Test(O) ((O)->state == cPersistent_GHOST_STATE)
#endif
/***************************************************************/
#else
#include "ExtensionClass.h"
#define PER_USE_OR_RETURN(self, NULL)
#define PER_ALLOW_DEACTIVATION(self)
#define PER_PREVENT_DEACTIVATION(self)
#define PER_DEL(self)
#define PER_USE(O) 1
#define PER_CHANGED(O) 0
#endif
PyObject
*
sort_str
,
*
reverse_str
;
...
...
@@ -126,7 +135,11 @@ typedef struct BTreeItemStruct {
}
BTreeItem
;
typedef
struct
Bucket_s
{
#ifdef PERSISTENT
cPersistent_HEAD
#else
PyObject_HEAD
#endif
int
size
,
len
;
struct
Bucket_s
*
next
;
KEY_TYPE
*
keys
;
...
...
@@ -140,7 +153,11 @@ static void PyVar_AssignB(Bucket **v, Bucket *e) { Py_XDECREF(*v); *v=e;}
#define ASSIGNBC(V,E) (Py_INCREF((E)), PyVar_AssignB(&(V),(E)))
typedef
struct
{
#ifdef PERSISTENT
cPersistent_HEAD
#else
PyObject_HEAD
#endif
int
size
,
len
;
Bucket
*
firstbucket
;
BTreeItem
*
data
;
...
...
@@ -311,6 +328,7 @@ INITMODULE ()
UNLESS
(
PyExtensionClassCAPI
=
PyCObject_Import
(
"ExtensionClass"
,
"CAPI"
))
return
;
#ifdef PERSISTENT
if
(
cPersistenceCAPI
=
PyCObject_Import
(
"cPersistence"
,
"CAPI"
))
{
BucketType
.
methods
.
link
=
cPersistenceCAPI
->
methods
;
...
...
@@ -330,6 +348,12 @@ INITMODULE ()
TreeSetType
.
tp_setattro
=
cPersistenceCAPI
->
setattro
;
}
else
return
;
#else
BTreeType
.
tp_getattro
=
PyExtensionClassCAPI
->
getattro
;
BucketType
.
tp_getattro
=
PyExtensionClassCAPI
->
getattro
;
SetType
.
tp_getattro
=
PyExtensionClassCAPI
->
getattro
;
TreeSetType
.
tp_getattro
=
PyExtensionClassCAPI
->
getattro
;
#endif
BTreeItemsType
.
ob_type
=&
PyType_Type
;
...
...
@@ -342,7 +366,7 @@ INITMODULE ()
d
=
PyModule_GetDict
(
m
);
PyDict_SetItemString
(
d
,
"__version__"
,
PyString_FromString
(
"$Revision: 1.
1
$"
));
PyString_FromString
(
"$Revision: 1.
2
$"
));
PyExtensionClass_Export
(
d
,
PREFIX
"Bucket"
,
BucketType
);
PyExtensionClass_Export
(
d
,
PREFIX
"BTree"
,
BTreeType
);
...
...
src/BTrees/BTreeTemplate.c
View file @
f80e1312
...
...
@@ -555,17 +555,7 @@ _BTree_clear(BTree *self)
return
0
;
}
/*
** BTree__p_deactivate
**
** Persistance machinery support to turn the object into a ghost
**
** Arguments: self The BTree
** args (unused)
**
** Returns: None on success
** NULL on failure
*/
#ifdef PERSISTENT
static
PyObject
*
BTree__p_deactivate
(
BTree
*
self
,
PyObject
*
args
)
{
...
...
@@ -578,6 +568,7 @@ BTree__p_deactivate(BTree *self, PyObject *args)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
#endif
/*
** BTree_clear
...
...
@@ -1111,8 +1102,10 @@ static struct PyMethodDef BTree_methods[] = {
"insert(key, value) -- Add an item if the key is not already used.
\n\n
"
"Return 1 if the item was added, or 0 otherwise"
},
#ifdef PERSISTENT
{
"_p_deactivate"
,
(
PyCFunction
)
BTree__p_deactivate
,
METH_VARARGS
,
"_p_deactivate() -- Reinitialize from a newly created copy"
},
#endif
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -1215,6 +1208,9 @@ static PyExtensionClass BTreeType = {
0L
,
0L
,
"Mapping type implemented as sorted list of items"
,
METHOD_CHAIN
(
BTree_methods
),
EXTENSIONCLASS_BASICNEW_FLAG
|
PERSISTENT_TYPE_FLAG
EXTENSIONCLASS_BASICNEW_FLAG
#ifdef PERSISTENT
|
PERSISTENT_TYPE_FLAG
#endif
|
EXTENSIONCLASS_NOINSTDICT_FLAG
,
};
src/BTrees/BucketTemplate.c
View file @
f80e1312
...
...
@@ -726,17 +726,7 @@ bucket_byValue(Bucket *self, PyObject *args)
return
NULL
;
}
/*
** bucket__p_deactivate
**
** Reinitialization function for persistence machinery; turns this
** bucket into a ghost (releases contained data)
**
** Arguments: self The Bucket
** args (unused)
**
** Returns: None
*/
#ifdef PERSISTENT
static
PyObject
*
bucket__p_deactivate
(
Bucket
*
self
,
PyObject
*
args
)
{
...
...
@@ -757,6 +747,7 @@ bucket__p_deactivate(Bucket *self, PyObject *args)
Py_INCREF
(
Py_None
);
return
Py_None
;
}
#endif
/*
** bucket_clear
...
...
@@ -980,8 +971,10 @@ static struct PyMethodDef Bucket_methods[] = {
"get(key[,default]) -- Look up a value
\n\n
"
"Return the default (or None) if the key is not found."
},
#ifdef PERSISTENT
{
"_p_deactivate"
,
(
PyCFunction
)
bucket__p_deactivate
,
METH_VARARGS
,
"_p_deactivate() -- Reinitialize from a newly created copy"
},
#endif
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -1065,7 +1058,10 @@ static PyExtensionClass BucketType = {
0L
,
0L
,
"Mapping type implemented as sorted list of items"
,
METHOD_CHAIN
(
Bucket_methods
),
EXTENSIONCLASS_BASICNEW_FLAG
|
PERSISTENT_TYPE_FLAG
EXTENSIONCLASS_BASICNEW_FLAG
#ifdef PERSISTENT
|
PERSISTENT_TYPE_FLAG
#endif
|
EXTENSIONCLASS_NOINSTDICT_FLAG
,
};
...
...
src/BTrees/IIBTree.c
View file @
f80e1312
/* Setup template macros */
#define PERSISTENT
#define PREFIX "II"
#define INITMODULE initIIBTree
#define DEFAULT_MAX_BUCKET_SIZE 100
...
...
src/BTrees/IOBTree.c
View file @
f80e1312
#define PERSISTENT
#define PREFIX "IO"
#define DEFAULT_MAX_BUCKET_SIZE 32
#define INITMODULE initIOBTree
...
...
src/BTrees/OIBTree.c
View file @
f80e1312
#define PERSISTENT
#define PREFIX "OI"
#define INITMODULE initOIBTree
#define DEFAULT_MAX_BUCKET_SIZE 64
...
...
src/BTrees/OOBTree.c
View file @
f80e1312
#define PERSISTENT
#define PREFIX "OO"
#define INITMODULE initOOBTree
#define DEFAULT_MAX_BUCKET_SIZE 32
...
...
src/BTrees/SetTemplate.c
View file @
f80e1312
...
...
@@ -215,9 +215,10 @@ static struct PyMethodDef Set_methods[] = {
{
"minKey"
,
(
PyCFunction
)
Bucket_minKey
,
METH_VARARGS
,
"minKey([key]) -- Fine the minimum key
\n\n
"
"If an argument is given, find the minimum >= the argument"
},
#ifdef PERSISTENT
{
"_p_deactivate"
,
(
PyCFunction
)
bucket__p_deactivate
,
METH_VARARGS
,
"_p_deactivate() -- Reinitialize from a newly created copy"
},
#endif
{
"insert"
,
(
PyCFunction
)
Set_insert
,
METH_VARARGS
,
"insert(id,[ignored]) -- Add a key to the set"
},
{
"remove"
,
(
PyCFunction
)
Set_remove
,
METH_VARARGS
,
...
...
@@ -311,7 +312,10 @@ static PyExtensionClass SetType = {
0L
,
0L
,
"Set implemented as sorted keys"
,
METHOD_CHAIN
(
Set_methods
),
EXTENSIONCLASS_BASICNEW_FLAG
|
PERSISTENT_TYPE_FLAG
EXTENSIONCLASS_BASICNEW_FLAG
#ifdef PERSISTENT
|
PERSISTENT_TYPE_FLAG
#endif
|
EXTENSIONCLASS_NOINSTDICT_FLAG
,
};
...
...
src/BTrees/TreeSetTemplate.c
View file @
f80e1312
...
...
@@ -126,8 +126,10 @@ static struct PyMethodDef TreeSet_methods[] = {
"insert(id,[ignored]) -- Add an id to the set"
},
{
"remove"
,
(
PyCFunction
)
TreeSet_remove
,
METH_VARARGS
,
"remove(id) -- Remove a key from the set"
},
#ifdef PERSISTENT
{
"_p_deactivate"
,
(
PyCFunction
)
BTree__p_deactivate
,
METH_VARARGS
,
"_p_deactivate() -- Reinitialize from a newly created copy"
},
#endif
{
NULL
,
NULL
}
/* sentinel */
};
...
...
@@ -157,6 +159,9 @@ static PyExtensionClass TreeSetType = {
0L
,
0L
,
"Set implemented as sorted tree of items"
,
METHOD_CHAIN
(
TreeSet_methods
),
EXTENSIONCLASS_BASICNEW_FLAG
|
PERSISTENT_TYPE_FLAG
EXTENSIONCLASS_BASICNEW_FLAG
#ifdef PERSISTENT
|
PERSISTENT_TYPE_FLAG
#endif
|
EXTENSIONCLASS_NOINSTDICT_FLAG
,
};
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