-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscep0103.html
More file actions
228 lines (187 loc) · 10 KB
/
scep0103.html
File metadata and controls
228 lines (187 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structured Commons :: SCEP0103 - Standard filesystem representation method </title>
<meta charset="utf-8" />
<link href="http://www.structured-commons.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Structured Commons Full Atom Feed" />
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="http://www.structured-commons.org/theme/gumby.css" />
<link rel="stylesheet" type="text/css" href="http://www.structured-commons.org/theme/style.css" />
<link rel="stylesheet" type="text/css" href="http://www.structured-commons.org/theme/pygment.css" />
<script src="http://www.structured-commons.org/theme/js/libs/modernizr-2.6.2.min.js"></script>
</head>
<body id="index" class="home">
<div class="container">
<div class="row">
<header id="banner" class="body">
<h1><a href="http://www.structured-commons.org">Structured Commons <strong></strong></a></h1>
</header><!-- /#banner -->
<div id="navigation" class="navbar row">
<a href="#" gumby-trigger="#navigation > ul" class="toggle"><i class="icon-menu"></i></a>
<ul class="columns">
<li><a href="http://www.structured-commons.org/online-forum.html">Forum</a></li>
<li><a href="http://www.structured-commons.org/index.html">About</a></li>
<li><a href="http://www.structured-commons.org/mission.html">Mission statement</a></li>
<li><a href="http://www.structured-commons.org/org.html">Organization</a></li>
<li><a href="http://www.structured-commons.org/participating.html">Participating</a></li>
<li><a href="http://www.structured-commons.org/scep0000.html">SCEPs</a></li>
</ul>
</div>
<!--<h1>SCEP0103 – SCEP0103 - Standard filesystem representation method</h1>-->
<table class="docinfo"><col class="docinfo-name" /><col class="docinfo-content" />
<tbody valign="top">
<tr class="field"><th class="docinfo-name">SCEP:</th><td class="field-body">103</td></tr>
<tr class="field"><th class="docinfo-name">Title:</th><td class="field-body">Standard filesystem representation method</td></tr>
<tr class="field"><th class="docinfo-name">Version:</th><td class="field-body">8b028d25775b16452084cca78d96d730904b294c</td></tr>
<tr class="field"><th class="docinfo-name">Last modified:</th><td class="field-body">2014-06-16 10:23:18 UTC (Mon, 16 June 2014)</td></tr>
<tr class="field"><th class="docinfo-name">Author:</th><td class="field-body">Raphael ‘kena’ Poss</td></tr>
<tr class="field"><th class="docinfo-name">Status:</th><td class="field-body">Draft</td></tr>
<tr class="field"><th class="docinfo-name">Type:</th><td class="field-body">Standards Track</td></tr>
<tr class="field"><th class="docinfo-name">Created:</th><td class="field-body">2014-06-16</td></tr>
<tr class="field"><th class="docinfo-name">Source:</th><td class="field-body"><a href="scep0103.rst">scep0103.rst</a> (<tt>fp:0cYMtlAA_T4_vG2NBmtEeB7uh26b1tpzb-0qiDGHxGrIMw</tt>)</td></tr>
</tbody></table>
<p>The Structured Commons object model is defined semantically in <span class="caps">SCEP</span>
101 <a class="footnote-reference" href="#scep-101" id="id1">[1]</a>, independently from its particular representation in a
computer system. Conversely, there may exist multiple valid
representations for an object.</p>
<p>This <span class="caps">SCEP</span> defines the canonical representation of Structured
Commons objects in a filesystem, with method name "<strong>fs</strong>".</p>
<div class="section" id="overview">
<h2>Overview</h2>
<p>The <tt class="docutils literal">fs</tt> representation maps objects to a filesystem (eg. on disk).</p>
<p>Object files are represented by filesystem files.</p>
<p>Object dictionaries are represented by filesystem directories.</p>
<p>Names in dictionaries are translated using <span class="caps">UTF</span>-8 <a class="footnote-reference" href="#utf" id="id2">[2]</a> to file/directory
names, with an optional percent-encoding <a class="footnote-reference" href="#urlq" id="id3">[3]</a> to support characters
that are not acceptable in file names on a particular platform.</p>
<p>For example, the name "helló / world?" can be translated
"<tt class="docutils literal">hell%C3%B3 %2F world?</tt>" on a Unix filesystem or
to "<tt class="docutils literal">hell%C3%B3%20%2F%20world%3F</tt>" for a directory served
over <span class="caps">HTTP</span>.</p>
<p>Dictionary names that map to objects are represented by directory
entries that point to either files or directories.</p>
<p>Dictionary names that map to fingerprints are represented by a regular
file containing the binary representation of the fingerprint, with a
filesystem name that prepends "%00" to the dictionary name representation.</p>
<div class="caution">
<p class="first admonition-title">Caution!</p>
<p class="last">The names "." and ".." are valid dictionary names
in Structured Commons dictionaries, however they are (usually)
not valid filesystem entry names. In general,
names starting with a "." should always be encoded to a
filesystem name starting with "%2E".</p>
</div>
</div>
<div class="section" id="encoding-algorithm">
<h2>Encoding algorithm</h2>
<pre class="literal-block">
PROCEDURE encode(path, object) BEGIN
IF object IS-A FILE-OBJECT THEN
SAVE BYTE-DATA(object) TO path
ELSE
MAKE-DIRECTORY name
FOR name IN DICTIONARY-LABELS(object) DO
item := DICTIONARY-VALUE(object, name)
npath = URL-QUOTE(UTF-8-ENCODE(name))
IF item IS-A FINGERPRINT THEN
fpath := path + '/%00' + npath
SAVE BYTE-DATA(item) TO fpath;
ELSE
fpath := path + '/' + npath
CALL encode(fpath, item)
END IF
END FOR
END IF
END PROCEDURE
</pre>
</div>
<div class="section" id="decoding-algorithm">
<h2>Decoding algorithm</h2>
<pre class="literal-block">
FUNCTION decode(path) BEGIN
IF IS-REGULAR-FILE(path) THEN
data := LOAD-BYTES-FROM(path)
ELSE
data := MAKE-EMPTY-DICTIONARY()
FOR fname IN DIRECTORY-LISTING(path) DO
IF fname STARTS-WITH "%00" THEN
label := UTF-8-DECODE(DROP-FIRST-CHAR(URL-UNQUOTE(fname)))
fpdata := FINGERPRINT-VALUE(LOAD-BYTES-FROM(fname))
SET data KEY label VALUE fpdata
ELSE
label := UTF-8-DECODE(URL-UNQUOTE(fname))
data := CALL decode(path + '/' + fname)
SET data KEY label VALUE data
END IF
END FOR
END IF
RETURN data
END FUNCTION
</pre>
</div>
<div class="section" id="example-reference-implementation">
<h2>Example/reference implementation</h2>
<p>Example code in Python is provided separately:</p>
<p><a class="reference external" href="https://github.com/structured-commons/tools">https://github.com/structured-commons/tools</a></p>
</div>
<div class="section" id="references">
<h2>References</h2>
<table class="docutils footnote" frame="void" id="scep-101" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><span class="caps">SCEP</span> 101. "Structured Commons Object Model and Fingerprints".
(<a class="reference external" href="http://www.structured-commons.org/scep0101.html">http://www.structured-commons.org/scep0101.html</a>)</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="utf" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td><span class="caps">RFC</span> 3629. "<span class="caps">UTF</span>-8, a transformation format of <span class="caps">ISO</span> 10646".
(<a class="reference external" href="https://tools.ietf.org/html/rfc3629">https://tools.ietf.org/html/rfc3629</a>)</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="urlq" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td><span class="caps">RFC</span> 3986, "Uniform Resource Identifier (<span class="caps">URI</span>): Generic Syntax".
(<a class="reference external" href="https://tools.ietf.org/html/rfc3986">https://tools.ietf.org/html/rfc3986</a>)</td></tr>
</tbody>
</table>
</div>
<div class="section" id="copyright">
<h2>Copyright</h2>
<p>This document has been placed in the public domain.</p>
<!-- Local Variables:
mode: rst
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
coding: utf-8
End: -->
</div>
</div><!-- /.row -->
</div><!-- /.container -->
<div class="container.nopad bg">
<footer id="credits" class="row">
<div class="seven columns left-center">
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>,
which takes great advantage of <a href="http://python.org">Python</a>.
<br />
Based on the <a target="_blank" href="http://gumbyframework.com">Gumby Framework</a>
</address>
</div>
<div class="seven columns">
<div class="row">
<ul class="socbtns">
</ul>
</div>
</div>
</footer>
</div>
<script src="http://www.structured-commons.org/theme/js/libs/jquery-1.9.1.min.js"></script>
<script src="http://www.structured-commons.org/theme/js/libs/gumby.min.js"></script>
<script src="http://www.structured-commons.org/theme/js/plugins.js"></script>
</body>
</html>