[Zodb-checkins] CVS: Zope/lib/python/BTrees - _fsBTree.c:1.2.2.1 Setup:1.6.116.1

Guido van Rossum guido@python.org
Wed, 13 Feb 2002 11:24:35 -0500


Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv29969/lib/python/BTrees

Modified Files:
      Tag: Zope-2_5-branch
	Setup 
Added Files:
      Tag: Zope-2_5-branch
	_fsBTree.c 
Log Message:
Add the fsIndex feature (merge from trunk).  This adds a new BTree
variant, fsBTree, a module fsIndex.py that uses it, and some changes
to FileStorage.py that use fsIndex.


=== Added File Zope/lib/python/BTrees/_fsBTree.c ===
/* fsBTree - FileStorage index BTree

   This BTree implments a mapping from 2-character strings
   to six-character strings. This allows us to effieciently store
   a FileStorage index as a nested mapping of 6-character oid prefix
   to mapping of 2-character oid suffix to 6-character (byte) file
   positions.
*/

#include <string.h>

typedef unsigned char char2[2];
typedef unsigned char char6[6];


/* Setup template macros */

#define MASTER_ID "$Id: _fsBTree.c,v 1.2.2.1 2002/02/13 16:24:05 gvanrossum Exp $\n"

#define PERSISTENT

#define MOD_NAME_PREFIX "fs"
#define INITMODULE init_fsBTree
#define DEFAULT_MAX_BUCKET_SIZE 500
#define DEFAULT_MAX_BTREE_SIZE 500
                
/*#include "intkeymacros.h"*/

#define KEYMACROS_H "$Id: _fsBTree.c,v 1.2.2.1 2002/02/13 16:24:05 gvanrossum Exp $\n"
#define KEY_TYPE char2
#define KEY_CHECK(K) (PyString_Check(K) && PyString_GET_SIZE(K)==2)
#define TEST_KEY(K, T) ((*(K) < *(T) || (*(K) == *(T) && (K)[1] < (T)[1])) ? -1 : ((*(K) == *(T) && (K)[1] == (T)[1]) ? 0 : 1))
#define DECREF_KEY(KEY)
#define INCREF_KEY(k)
#define COPY_KEY(KEY, E) (*(KEY)=*(E), (KEY)[1]=(E)[1])
#define COPY_KEY_TO_OBJECT(O, K) O=PyString_FromStringAndSize(K,2)
#define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
  if (KEY_CHECK(ARG)) memcpy(TARGET, PyString_AS_STRING(ARG), 2); else { \
      PyErr_SetString(PyExc_TypeError, "expected two-character string key"); \
      (STATUS)=0; } 

/*#include "intvaluemacros.h"*/
#define VALUEMACROS_H "$Id: _fsBTree.c,v 1.2.2.1 2002/02/13 16:24:05 gvanrossum Exp $\n"
#define VALUE_TYPE char6
#define TEST_VALUE(K, T) strncmp(K,T,6)
#define DECLARE_VALUE(NAME) VALUE_TYPE NAME
#define DECREF_VALUE(k)
#define INCREF_VALUE(k)
#define COPY_VALUE(V, E) (memcpy(V, E, 6))
#define COPY_VALUE_TO_OBJECT(O, K) O=PyString_FromStringAndSize(K,6)
#define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \
  if ((PyString_Check(ARG) && PyString_GET_SIZE(ARG)==6)) \
      memcpy(TARGET, PyString_AS_STRING(ARG), 6); else { \
      PyErr_SetString(PyExc_TypeError, "expected six-character string key"); \
      (STATUS)=0; } 
  
#define NORMALIZE_VALUE(V, MIN)
#include "BTreeModuleTemplate.c"


=== Zope/lib/python/BTrees/Setup 1.6 => 1.6.116.1 ===
 _IIBTree _IIBTree.c  -I../../Components/ExtensionClass/src -I../ZODB -I../../Components
 _IOBTree _IOBTree.c  -I../../Components/ExtensionClass/src -I../ZODB -I../../Components
+_fsBTree _fsBTree.c  -I../../Components/ExtensionClass/src -I../ZODB -I../../Components