/[cl-store]/cl-store/README
ViewVC logotype

Contents of /cl-store/README

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations)
Wed Oct 6 14:41:03 2004 UTC (9 years, 6 months ago) by sross
Branch: MAIN
Changes since 1.7: +9 -12 lines
Changelog 2004-10-06
1 README for Package CL-STORE.
2 Author: Sean Ross
3 Homepage: http://www.common-lisp.net/project/cl-store/
4 Version: 0.2.9
5
6 0. About.
7 CL-STORE is an portable serialization package which
8 should give you the ability to store all common-lisp
9 data types (well not all yet) into files, streams or whatever.
10
11
12 1. Installation.
13 The first thing you need is a common-lisp, CL-STORE currently
14 supports SBCL, CMUCL, Lispworks, CLISP and OpenMCL.
15
16 Hopefully you've asdf-install to install this in which case
17 all should be fine.
18
19 Otherwise symlink cl-store.asd to somewhere on asdf:*central-registry*
20 and run (asdf:oos 'asdf:load-op :cl-store).
21
22 The xml backend can be loaded with (asdf:oos 'asdf:loaded :cl-store-xml).
23 This requires xmls which can be found on http://www.cliki.net and
24 is asdf-installable.
25
26 Run (asdf:oos 'asdf:test-op :cl-store) and (asdf:oos 'asdf:test-op :cl-store-xml)
27 to make sure that everything works. Running these tests will try to
28 load the RT package, which is asdf-installable.
29 If anything breaks drop me a line, see
30 http://www.common-lisp.net/project/cl-store/ for mailing-lists.
31
32
33 2. Usage
34 The two main entry points are
35 - cl-store:store (obj place &optional (backend *default-backend*)) i
36 => obj
37 Where place is a path designator or stream and
38 backend is one of the registered backends.
39
40 - cl-store:restore (place &optional (backend *default-backend*))
41 => restored-obj
42 Where place and backend is as above.
43
44 - cl-store:restore is setfable, which I think makes
45 for a great serialized hit counter.
46 eg. (incf (restore place))
47
48
49 3. Extending
50 CL-STORE is more or less extensible. Using defstore-<backend-name>
51 and defrestore-<backend-name> allows you to customize the storing
52 and restoring of your own classes.
53
54 contrived eg.
55
56 (in-package :cl-user)
57
58 (use-package :cl-store)
59
60 (setf *default-backend* *cl-store-backend*)
61
62 (defclass random-obj () ((a :accessor a :initarg :a)))
63
64 (defvar *random-obj-code* (register-code 110 'random-obj))
65
66 (defstore-cl-store (obj random-obj stream)
67 (output-type-code *random-obj-code* stream)
68 (store-object (a obj) stream))
69
70 (defrestore-cl-store (random-obj stream)
71 (random (restore-object stream)))
72
73 (store (make-instance 'random-obj :a 10) "/tmp/random")
74
75 (restore "/tmp/random")
76 => ; some number from 0 to 9
77
78
79 4. Backends
80 CL-STORE now has a concept of backends, suggested by Robert Sedgewick.
81 Two backends are in releases now, a default backend which is much
82 what cl-store used to be (pre 0.2) and an xml backend which writes out
83 xml to character streams.
84
85 Store and Restore now take an optional backend argument which
86 currently can be one of *default-backend*, *xml-backend* or
87 a self defined backend.
88
89 The xml written out is not very human readable.
90 I recommend using a tool like tidy <http://tidy.sourceforge.net/>
91 to view it in a nice format.
92
93
94 5. Issues
95 There are a number of issues with CL-STORE as it stands (0.2.9).
96
97 - Functions, closures and anything remotely funcallable is unserializable.
98 - MOP classes are largely unsupported at the moment.
99 - Structure instances are not supported in MCL, OpenMCL and Clisp.
100 - Structure definitions aren't supported at all.
101 - No documentation.
102 - Older cmucl versions, where (eq 'cl:class 'pcl::class)
103 returns nil, cannot store classes obtained using cl:find-class.
104 The solution for this is to use pcl::find-class.
105
106
107 Enjoy
108 Sean.

  ViewVC Help
Powered by ViewVC 1.1.5