[elephant-cvs] CVS update: elephant/src/sleepycat.lisp
blee at common-lisp.net
blee at common-lisp.net
Fri Aug 27 17:32:56 UTC 2004
Update of /project/elephant/cvsroot/elephant/src
In directory common-lisp.net:/tmp/cvs-serv13660/src
Modified Files:
sleepycat.lisp
Log Message:
license
Date: Fri Aug 27 10:32:56 2004
Author: blee
Index: elephant/src/sleepycat.lisp
diff -u elephant/src/sleepycat.lisp:1.2 elephant/src/sleepycat.lisp:1.3
--- elephant/src/sleepycat.lisp:1.2 Thu Aug 26 19:54:38 2004
+++ elephant/src/sleepycat.lisp Fri Aug 27 10:32:56 2004
@@ -1,13 +1,40 @@
-;; UFFI
-;(asdf:operate 'asdf:load-op :uffi)
-
-;; DSO loading
-;(defconstant +path-to-libsleepycat+
-; "/path/to/libsleepycat.so")
-;(defconstant +path-to-sleepycat+
-; "/usr/local/lib/db42/libdb.so")
-;(uffi:load-foreign-library +path-to-sleepycat+ :module "sleepycat")
-;(uffi:load-foreign-library +path-to-libsleepycat+ :module "libsleepycat")
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;;;
+;;; sleepycat.lisp -- FFI interface to Berkeley DB
+;;;
+;;; Initial version 8/26/2004 by Ben Lee
+;;; <blee at common-lisp.net>
+;;;
+;;; part of
+;;;
+;;; Elephant: an object-oriented database for Common Lisp
+;;;
+;;; Copyright (c) 2004 by Andrew Blumberg and Ben Lee
+;;; <ablumberg at common-lisp.net> <blee at common-lisp.net>
+;;;
+;;; This program is free software; you can redistribute it
+;;; and/or modify it under the terms of the GNU General
+;;; Public License as published by the Free Software
+;;; Foundation; either version 2 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be
+;;; useful, but WITHOUT ANY WARRANTY; without even the
+;;; implied warranty of MERCHANTABILITY or FITNESS FOR A
+;;; PARTICULAR PURPOSE. See the GNU General Public License
+;;; for more details.
+;;;
+;;; The GNU General Public License can be found in the file
+;;; LICENSE which should have been distributed with this
+;;; code. It can also be found at
+;;;
+;;; http://www.opensource.org/licenses/gpl-license.php
+;;;
+;;; You should have received a copy of the GNU General
+;;; Public License along with this program; if not, write
+;;; to the Free Software Foundation, Inc., 59 Temple Place,
+;;; Suite 330, Boston, MA 02111-1307 USA
+;;;
(defpackage sleepycat
@@ -17,8 +44,8 @@
offset-char-pointer copy-str-to-buf copy-bufs byte-length
pointer-int pointer-void array-or-pointer-char
db-env-create db-env-close db-env-open db-env-dbremove
- db-env-dbrename db-env-remove db-env-set-flags
- db-env-get-flags
+ db-env-dbrename db-env-remove
+ db-env-set-flags db-env-get-flags
db-create db-close db-open
db-remove db-rename db-sync db-truncate
db-get-key-buffered db-get-buffered db-get db-put-buffered db-put
@@ -37,7 +64,71 @@
(in-package "SLEEPYCAT")
+;; Constants and Flags
+;; eventually write a macro which generates a custom flag function.
+
+;I don't like the UFFI syntax for enumerations
+(defconstant DB-BTREE 1)
+(defconstant DB-HASH 2)
+(defconstant DB-QUEUE 3)
+(defconstant DB-RECNO 4)
+(defconstant DB-UNKNOWN 5)
+
+(defconstant DB_AUTO_COMMIT #x1000000)
+(defconstant DB_JOINENV #x0040000)
+(defconstant DB_INIT_CDB #x0001000)
+(defconstant DB_INIT_LOCK #x0002000)
+(defconstant DB_INIT_LOG #x0004000)
+(defconstant DB_INIT_MPOOL #x0008000)
+(defconstant DB_INIT_REP #x0010000)
+(defconstant DB_INIT_TXN #x0020000)
+(defconstant DB_RECOVER #x0000020)
+(defconstant DB_RECOVER_FATAL #x0200000)
+(defconstant DB_LOCKDOWN #x0080000)
+(defconstant DB_PRIVATE #x0100000)
+(defconstant DB_SYSTEM_MEM #x0400000)
+(defconstant DB_THREAD #x0000040)
+(defconstant DB_FORCE #x0000004)
+(defconstant DB_DIRTY_READ #x2000000)
+(defconstant DB_CREATE #x0000001)
+(defconstant DB_EXCL #x0001000)
+(defconstant DB_NOMMAP #x0000008)
+(defconstant DB_RDONLY #x0000010)
+(defconstant DB_TRUNCATE #x0000080)
+(defconstant DB_TXN_NOSYNC #x0000100)
+(defconstant DB_TXN_NOWAIT #x0001000)
+(defconstant DB_TXN_SYNC #x0002000)
+
+(defconstant DB_GET_BOTH 10)
+(defconstant DB_SET_LOCK_TIMEOUT 29)
+(defconstant DB_SET_TXN_TIMEOUT 33)
+
+(def-enum lockop ((:DUMP 0) :GET :GET-TIMEOUT :INHERIT
+ :PUT :PUT-ALL :PUT-OBJ :PUT-READ
+ :TIMEOUT :TRADE :UPGRADE-WRITE))
+
+(def-enum lockmode ((:NG 0) :READ :WRITE :WAIT
+ :IWRITE :IREAD :IWR :DIRTY :WWRITE))
+
+(def-struct db-lockreq
+ (op lockop)
+ (mode lockmode)
+ (timeout :unsigned-int)
+ (obj (:array :char))
+ (lock :pointer-void))
+
(eval-when (:compile-toplevel :load-toplevel)
+ ;; UFFI
+ ;;(asdf:operate 'asdf:load-op :uffi)
+
+ ;; DSO loading
+ (defconstant +path-to-libsleepycat+
+ "/home/ben/lisp/elephant/libsleepycat.so")
+ (defconstant +path-to-sleepycat+
+ "/usr/local/lib/db42/libdb.so")
+ (uffi:load-foreign-library +path-to-sleepycat+ :module "sleepycat")
+ (uffi:load-foreign-library +path-to-libsleepycat+ :module "libsleepycat")
+
(def-type pointer-int (* :int))
(def-type pointer-void :pointer-void)
(def-foreign-type array-or-pointer-char
@@ -775,20 +866,6 @@
;; Locks and timeouts
-(def-enum lockop ((:DUMP 0) :GET :GET-TIMEOUT :INHERIT
- :PUT :PUT-ALL :PUT-OBJ :PUT-READ
- :TIMEOUT :TRADE :UPGRADE-WRITE))
-
-(def-enum lockmode ((:NG 0) :READ :WRITE :WAIT
- :IWRITE :IREAD :IWR :DIRTY :WWRITE))
-
-(def-struct db-lockreq
- (op lockop)
- (mode lockmode)
- (timeout :unsigned-int)
- (obj (:array :char))
- (lock :pointer-void))
-
(def-function ("db_txn_id" db-transaction-id)
((transaction :pointer-void))
@@ -859,45 +936,6 @@
:returning :int)
(wrap-errno db-env-lock-detect (env flags atype) :outs 2)
-
-;; Constants and Flags
-;; eventually write a macro which generates a custom flag function.
-
-;I don't like the UFFI syntax for enumerations
-(defconstant DB-BTREE 1)
-(defconstant DB-HASH 2)
-(defconstant DB-QUEUE 3)
-(defconstant DB-RECNO 4)
-(defconstant DB-UNKNOWN 5)
-
-(defconstant DB_AUTO_COMMIT #x1000000)
-(defconstant DB_JOINENV #x0040000)
-(defconstant DB_INIT_CDB #x0001000)
-(defconstant DB_INIT_LOCK #x0002000)
-(defconstant DB_INIT_LOG #x0004000)
-(defconstant DB_INIT_MPOOL #x0008000)
-(defconstant DB_INIT_REP #x0010000)
-(defconstant DB_INIT_TXN #x0020000)
-(defconstant DB_RECOVER #x0000020)
-(defconstant DB_RECOVER_FATAL #x0200000)
-(defconstant DB_LOCKDOWN #x0080000)
-(defconstant DB_PRIVATE #x0100000)
-(defconstant DB_SYSTEM_MEM #x0400000)
-(defconstant DB_THREAD #x0000040)
-(defconstant DB_FORCE #x0000004)
-(defconstant DB_DIRTY_READ #x2000000)
-(defconstant DB_CREATE #x0000001)
-(defconstant DB_EXCL #x0001000)
-(defconstant DB_NOMMAP #x0000008)
-(defconstant DB_RDONLY #x0000010)
-(defconstant DB_TRUNCATE #x0000080)
-(defconstant DB_TXN_NOSYNC #x0000100)
-(defconstant DB_TXN_NOWAIT #x0001000)
-(defconstant DB_TXN_SYNC #x0002000)
-
-(defconstant DB_GET_BOTH 10)
-(defconstant DB_SET_LOCK_TIMEOUT 29)
-(defconstant DB_SET_TXN_TIMEOUT 33)
(defun flags (&key
auto-commit
More information about the Elephant-cvs
mailing list