| 1 | ;;+----------------------------------------------------------------------------- |
|---|
| 2 | ;;+ Isidorus |
|---|
| 3 | ;;+ (c) 2008-2010 Marc Kuester, Christoph Ludwig, Lukas Georgieff |
|---|
| 4 | ;;+ |
|---|
| 5 | ;;+ Isidorus is freely distributable under the LLGPL license. |
|---|
| 6 | ;;+ You can find a detailed description in trunk/docs/LLGPL-LICENSE.txt and |
|---|
| 7 | ;;+ trunk/docs/LGPL-LICENSE.txt. |
|---|
| 8 | ;;+----------------------------------------------------------------------------- |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | ;;This code has to be executed by several sblc instances in paralell!!! |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | (asdf:operate 'asdf:load-op :elephant) |
|---|
| 15 | (asdf:operate 'asdf:load-op :pathnames) |
|---|
| 16 | (asdf:operate 'asdf:load-op :uuid) |
|---|
| 17 | (use-package :elephant) |
|---|
| 18 | (use-package :com.gigamonkeys.pathnames) |
|---|
| 19 | (use-package :uuid) |
|---|
| 20 | (ensure-directories-exist #p"./test_data_base/") |
|---|
| 21 | (defvar *db-path* (truename #p"./test_data_base/")) |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | (defpclass TestClassC () |
|---|
| 25 | ((slot-1 :accessor slot-1 |
|---|
| 26 | :initarg :slot-1 |
|---|
| 27 | :initform "" |
|---|
| 28 | :type String |
|---|
| 29 | :index t) |
|---|
| 30 | (slot-2 :accessor slot-2 |
|---|
| 31 | :initarg :slot-2 |
|---|
| 32 | :initform 0.0 |
|---|
| 33 | :type Single-Float |
|---|
| 34 | :index t) |
|---|
| 35 | (slot-3 :accessor slot-3 |
|---|
| 36 | :initarg :slot-3 |
|---|
| 37 | :initform nil |
|---|
| 38 | :type List |
|---|
| 39 | :index t))) |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | (defun make-object () |
|---|
| 43 | (with-transaction () |
|---|
| 44 | (make-instance 'TestClassC |
|---|
| 45 | :slot-1 (make-v1-uuid) |
|---|
| 46 | :slot-2 (read-from-string |
|---|
| 47 | (concatenate |
|---|
| 48 | 'string (write-to-string (random 1000000000)) |
|---|
| 49 | ".0")) |
|---|
| 50 | :slot-3 (loop for i to 100 |
|---|
| 51 | collect (random 100000))))) |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | (defun do-writing-test() |
|---|
| 55 | (elephant:open-store (list :BDB *db-path*) :register t) |
|---|
| 56 | (dotimes (i 1000) |
|---|
| 57 | (make-object) |
|---|
| 58 | (format t "writing => i: ~a~%" i)) |
|---|
| 59 | (elephant:close-store)) |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | (defun do-reading-test() |
|---|
| 64 | (elephant:open-store (list :BDB *db-path*) :register t) |
|---|
| 65 | (dotimes (i 1000) |
|---|
| 66 | (elephant:get-instances-by-class 'TestclassC) |
|---|
| 67 | (format t "reading => i: ~a~%" i)) |
|---|
| 68 | (elephant:close-store)) |
|---|
| 69 | |
|---|
| 70 | (do-writing-test) |
|---|
| 71 | (do-reading-test) |
|---|