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

Contents of /cl-store/README

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Tue Aug 17 12:07:37 2004 UTC (9 years, 8 months ago) by sross
Branch: MAIN
CVS Tags: v0-2
Changes since 1.4: +2 -0 lines
*** empty log message ***
1 README for Package CL-STORE.
2 Author: Sean Ross
3 Homepage: http://www.common-lisp.net/project/cl-store/
4 Version: 0.2
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) to make sure that
27 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, stream or socket and
38 backend is one of the registered backend.
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 22 '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 Store and Restore now take an optional backend argument which
85 currently can be one of *default-backend* or *xml-backend*.
86
87 The xml written out is not very human readable.
88 I recommend using a tool like tidy <http://tidy.sourceforge.net/>
89 to view it in a nice format.
90
91
92 5. Issues
93 There are a number of issues with CL-STORE as it stands (0.2).
94
95 - Functions, closures and anything remotely funcallable is unserializable.
96 - MOP classes are largely unsupported at the moment.
97 - Structure instances are not supported in anything but CMUCL and SBCL.
98 - Structure definitions aren't supported at all.
99 - No documentation.
100 - Older cmucl versions, where (eq 'cl:class 'pcl::class)
101 returns nil, cannot store classes obtained using cl:find-class.
102 The solution for this is to use pcl::find-class.
103
104
105 Enjoy
106 Sean.

  ViewVC Help
Powered by ViewVC 1.1.5