fsdb 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.txt +1 -1
- data/lib/fsdb/database.rb +1 -1
- data/rakefile +5 -3
- data/test/test-concurrency.rb +5 -3
- data/test/test-formats.rb +3 -1
- data/test/test-fsdb.rb +5 -3
- metadata +10 -148
- data/junk/OLDRakefile +0 -98
- data/junk/OLDRakefile2 +0 -55
- data/junk/check-cache.rb +0 -18
- data/junk/create-lock.rb +0 -25
- data/junk/doc/old-api/classes/FSDB.html +0 -139
- data/junk/doc/old-api/classes/FSDB/Database.html +0 -953
- data/junk/doc/old-api/classes/FSDB/Database.src/M000029.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000030.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000031.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000032.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000033.html +0 -33
- data/junk/doc/old-api/classes/FSDB/Database.src/M000034.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000035.html +0 -22
- data/junk/doc/old-api/classes/FSDB/Database.src/M000036.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000037.html +0 -22
- data/junk/doc/old-api/classes/FSDB/Database.src/M000038.html +0 -43
- data/junk/doc/old-api/classes/FSDB/Database.src/M000039.html +0 -25
- data/junk/doc/old-api/classes/FSDB/Database.src/M000040.html +0 -43
- data/junk/doc/old-api/classes/FSDB/Database.src/M000041.html +0 -23
- data/junk/doc/old-api/classes/FSDB/Database.src/M000042.html +0 -22
- data/junk/doc/old-api/classes/FSDB/Database.src/M000043.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000044.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000045.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000046.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000047.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000048.html +0 -16
- data/junk/doc/old-api/classes/FSDB/Database.src/M000049.html +0 -71
- data/junk/doc/old-api/classes/FSDB/Database.src/M000050.html +0 -43
- data/junk/doc/old-api/classes/FSDB/Database.src/M000051.html +0 -53
- data/junk/doc/old-api/classes/FSDB/Database.src/M000052.html +0 -44
- data/junk/doc/old-api/classes/FSDB/Database.src/M000053.html +0 -39
- data/junk/doc/old-api/classes/FSDB/Database.src/M000054.html +0 -72
- data/junk/doc/old-api/classes/FSDB/Database.src/M000055.html +0 -39
- data/junk/doc/old-api/classes/FSDB/Database.src/M000056.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000057.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000058.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000059.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000060.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000061.html +0 -23
- data/junk/doc/old-api/classes/FSDB/Database.src/M000062.html +0 -23
- data/junk/doc/old-api/classes/FSDB/Database.src/M000063.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database.src/M000064.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Database/AbortedTransaction.html +0 -118
- data/junk/doc/old-api/classes/FSDB/Database/CreateFileError.html +0 -120
- data/junk/doc/old-api/classes/FSDB/Database/DirIsImmutableError.html +0 -117
- data/junk/doc/old-api/classes/FSDB/Database/DirNotEmptyError.html +0 -117
- data/junk/doc/old-api/classes/FSDB/Database/FormatError.html +0 -117
- data/junk/doc/old-api/classes/FSDB/Database/MissingFileError.html +0 -117
- data/junk/doc/old-api/classes/FSDB/Database/MissingObjectError.html +0 -117
- data/junk/doc/old-api/classes/FSDB/Database/NotDirError.html +0 -118
- data/junk/doc/old-api/classes/FSDB/Database/PathComponentError.html +0 -120
- data/junk/doc/old-api/classes/FSDB/DatabaseDebuggable.html +0 -148
- data/junk/doc/old-api/classes/FSDB/DatabaseDebuggable.src/M000005.html +0 -21
- data/junk/doc/old-api/classes/FSDB/DatabaseDebuggable.src/M000007.html +0 -21
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.html +0 -210
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000006.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000007.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000008.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000009.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000010.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000011.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000012.html +0 -22
- data/junk/doc/old-api/classes/FSDB/DirectoryIterators.src/M000013.html +0 -22
- data/junk/doc/old-api/classes/FSDB/ForkSafely.html +0 -126
- data/junk/doc/old-api/classes/FSDB/Modex.html +0 -237
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000024.html +0 -21
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000025.html +0 -30
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000026.html +0 -21
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000027.html +0 -30
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000028.html +0 -44
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000029.html +0 -26
- data/junk/doc/old-api/classes/FSDB/Modex.src/M000030.html +0 -48
- data/junk/doc/old-api/classes/FSDB/Modex/ForkSafely.html +0 -105
- data/junk/doc/old-api/classes/FSDB/Mutex.html +0 -244
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000018.html +0 -19
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000019.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000020.html +0 -19
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000021.html +0 -18
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000022.html +0 -23
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000023.html +0 -30
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000024.html +0 -26
- data/junk/doc/old-api/classes/FSDB/Mutex.src/M000025.html +0 -21
- data/junk/doc/old-api/classes/FSDB/Mutex/ForkSafely.html +0 -105
- data/junk/doc/old-api/classes/FSDB/PathUtilities.html +0 -257
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000012.html +0 -23
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000013.html +0 -18
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000014.html +0 -23
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000015.html +0 -18
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000016.html +0 -18
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000017.html +0 -22
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000018.html +0 -23
- data/junk/doc/old-api/classes/FSDB/PathUtilities.src/M000019.html +0 -18
- data/junk/doc/old-api/classes/FSDB/PathUtilities/InvalidPathError.html +0 -111
- data/junk/doc/old-api/classes/File.html +0 -272
- data/junk/doc/old-api/classes/File.src/M000001.html +0 -17
- data/junk/doc/old-api/classes/File.src/M000002.html +0 -17
- data/junk/doc/old-api/classes/File.src/M000003.html +0 -20
- data/junk/doc/old-api/classes/File.src/M000004.html +0 -20
- data/junk/doc/old-api/classes/File.src/M000005.html +0 -32
- data/junk/doc/old-api/classes/File.src/M000006.html +0 -32
- data/junk/doc/old-api/created.rid +0 -1
- data/junk/doc/old-api/files/README.html +0 -112
- data/junk/doc/old-api/files/RELEASE-NOTES.html +0 -233
- data/junk/doc/old-api/files/fsdb_txt.html +0 -888
- data/junk/doc/old-api/files/lib/fsdb/database_rb.html +0 -115
- data/junk/doc/old-api/files/lib/fsdb/file-lock_rb.html +0 -109
- data/junk/doc/old-api/files/lib/fsdb/modex_rb.html +0 -121
- data/junk/doc/old-api/files/lib/fsdb/mutex_rb.html +0 -108
- data/junk/doc/old-api/files/lib/fsdb/util_rb.html +0 -108
- data/junk/doc/old-api/fr_class_index.html +0 -47
- data/junk/doc/old-api/fr_file_index.html +0 -34
- data/junk/doc/old-api/fr_method_index.html +0 -90
- data/junk/doc/old-api/index.html +0 -24
- data/junk/doc/old-api/rdoc-style.css +0 -208
- data/junk/file-lock-nb.rb +0 -15
- data/junk/fl.rb +0 -144
- data/junk/flock-test.rb +0 -39
- data/junk/fsdb.kateproject +0 -47
- data/junk/fsdb.prj +0 -196
- data/junk/fsdb.sf +0 -46
- data/junk/insert-dir.rb +0 -48
- data/junk/lock-test-bug.rb +0 -150
- data/junk/lock-test-too-simple.rb +0 -136
- data/junk/lock-test.rb +0 -151
- data/junk/mkrdoc +0 -7
- data/junk/restore-fsdb.rb +0 -37
- data/junk/rf.txt +0 -5
- data/junk/solaris-bug-fixed.rb +0 -184
- data/junk/solaris-bug.rb +0 -182
- data/junk/solaris-bug.txt +0 -43
- data/junk/sync.rb +0 -327
- data/junk/test-file-lock.html +0 -86
- data/junk/test-file-lock.rb +0 -84
- data/junk/test-processes.rb +0 -131
- data/junk/test-threads.rb +0 -113
- data/junk/wiki-mutex.rb +0 -108
- data/misc/fsdb-blorubu.txt +0 -47
- data/misc/mtime-and-file-id.txt +0 -23
- data/misc/posixlock.txt +0 -148
data/junk/check-cache.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
def self.check_cache tester, db, path, thread, who
|
2
|
-
unless $solaris # the File.read gives up the flock?
|
3
|
-
__x__ = tester.x
|
4
|
-
|
5
|
-
data = File.read(File.join(db.dir, path))
|
6
|
-
|
7
|
-
uncached_x = Marshal.load(data).x rescue nil
|
8
|
-
if uncached_x
|
9
|
-
unless uncached_x == __x__
|
10
|
-
fail "#{who} test, process #{Process.pid}," +
|
11
|
-
" thread #{thread[:number]}:" +
|
12
|
-
" cache is stale:\n" +
|
13
|
-
" #{uncached_x} on disk, #{__x__} in cache" +
|
14
|
-
" #{tester}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/junk/create-lock.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
# <b>Windows:</b>
|
3
|
-
# Opens path for writing and reading ("w+") with an exclusive lock for the
|
4
|
-
# duration of the block.
|
5
|
-
# def open_create_lock(path)
|
6
|
-
# is_dir = path =~ /\/$/
|
7
|
-
# File.open(path, is_dir ? "r" : "w+") do |f|
|
8
|
-
# set_binmode(f, path)
|
9
|
-
# f.lock_exclusive(is_dir) do
|
10
|
-
# yield f
|
11
|
-
# end
|
12
|
-
# end
|
13
|
-
# end
|
14
|
-
|
15
|
-
# <b>Non-Windows:</b>
|
16
|
-
# Opens path for writing and reading ("w+") with an exclusive lock for the
|
17
|
-
# duration of the block.
|
18
|
-
# def open_create_lock(path)
|
19
|
-
# is_dir = path =~ /\/$/
|
20
|
-
# File.open(path, is_dir ? "r" : "w+") do |f|
|
21
|
-
# f.lock_exclusive(is_dir) do
|
22
|
-
# yield f
|
23
|
-
# end
|
24
|
-
# end
|
25
|
-
# end
|
@@ -1,139 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: FSDB</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">FSDB</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/fsdb/database_rb.html">
|
59
|
-
lib/fsdb/database.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../files/lib/fsdb/util_rb.html">
|
63
|
-
lib/fsdb/util.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../files/lib/fsdb/modex_rb.html">
|
67
|
-
lib/fsdb/modex.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
<a href="../files/lib/fsdb/mutex_rb.html">
|
71
|
-
lib/fsdb/mutex.rb
|
72
|
-
</a>
|
73
|
-
<br />
|
74
|
-
</td>
|
75
|
-
</tr>
|
76
|
-
|
77
|
-
</table>
|
78
|
-
</div>
|
79
|
-
<!-- banner header -->
|
80
|
-
|
81
|
-
<div id="bodyContent">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<div id="contextContent">
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
|
92
|
-
</div>
|
93
|
-
|
94
|
-
|
95
|
-
<!-- if includes -->
|
96
|
-
<div id="includes">
|
97
|
-
<h3 class="section-bar">Included Modules</h3>
|
98
|
-
|
99
|
-
<div id="includes-list">
|
100
|
-
<span class="include-name">Formats</span>
|
101
|
-
<span class="include-name"><a href="FSDB/PathUtilities.html">PathUtilities</a></span>
|
102
|
-
<span class="include-name"><a href="FSDB/ForkSafely.html">ForkSafely</a></span>
|
103
|
-
<span class="include-name"><a href="FSDB/ForkSafely.html">ForkSafely</a></span>
|
104
|
-
</div>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
<div id="section">
|
108
|
-
|
109
|
-
<div id="class-list">
|
110
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
111
|
-
|
112
|
-
Module <a href="FSDB/DatabaseDebuggable.html" class="link">FSDB::DatabaseDebuggable</a><br />
|
113
|
-
Module <a href="FSDB/DirectoryIterators.html" class="link">FSDB::DirectoryIterators</a><br />
|
114
|
-
Module <a href="FSDB/ForkSafely.html" class="link">FSDB::ForkSafely</a><br />
|
115
|
-
Module <a href="FSDB/PathUtilities.html" class="link">FSDB::PathUtilities</a><br />
|
116
|
-
Class <a href="FSDB/Database.html" class="link">FSDB::Database</a><br />
|
117
|
-
Class <a href="FSDB/Modex.html" class="link">FSDB::Modex</a><br />
|
118
|
-
Class <a href="FSDB/Mutex.html" class="link">FSDB::Mutex</a><br />
|
119
|
-
|
120
|
-
</div>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
<!-- if method_list -->
|
129
|
-
|
130
|
-
|
131
|
-
</div>
|
132
|
-
|
133
|
-
|
134
|
-
<div id="validator-badges">
|
135
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
136
|
-
</div>
|
137
|
-
|
138
|
-
</body>
|
139
|
-
</html>
|
@@ -1,953 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: FSDB::Database</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">FSDB::Database</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/fsdb/database_rb.html">
|
59
|
-
lib/fsdb/database.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../../files/lib/fsdb/util_rb.html">
|
63
|
-
lib/fsdb/util.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
</td>
|
67
|
-
</tr>
|
68
|
-
|
69
|
-
<tr class="top-aligned-row">
|
70
|
-
<td><strong>Parent:</strong></td>
|
71
|
-
<td>
|
72
|
-
Object
|
73
|
-
</td>
|
74
|
-
</tr>
|
75
|
-
</table>
|
76
|
-
</div>
|
77
|
-
<!-- banner header -->
|
78
|
-
|
79
|
-
<div id="bodyContent">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
<div id="contextContent">
|
84
|
-
|
85
|
-
<div id="description">
|
86
|
-
<p>
|
87
|
-
A thread-safe, process-safe object database class which uses the native
|
88
|
-
file system as its back end and allows multiple file formats.
|
89
|
-
</p>
|
90
|
-
|
91
|
-
</div>
|
92
|
-
|
93
|
-
|
94
|
-
</div>
|
95
|
-
|
96
|
-
<div id="method-list">
|
97
|
-
<h3 class="section-bar">Methods</h3>
|
98
|
-
|
99
|
-
<div class="name-list">
|
100
|
-
<a href="#M000034">[]</a>
|
101
|
-
<a href="#M000056">[]</a>
|
102
|
-
<a href="#M000053">[]=</a>
|
103
|
-
<a href="#M000044">abort</a>
|
104
|
-
<a href="#M000043">abort</a>
|
105
|
-
<a href="#M000037">absolute</a>
|
106
|
-
<a href="#M000038">absolute_path_to</a>
|
107
|
-
<a href="#M000049">browse</a>
|
108
|
-
<a href="#M000031">cache</a>
|
109
|
-
<a href="#M000032">cache_mutex</a>
|
110
|
-
<a href="#M000042">clear_cache</a>
|
111
|
-
<a href="#M000041">clear_entry</a>
|
112
|
-
<a href="#M000045">default_browse</a>
|
113
|
-
<a href="#M000046">default_edit</a>
|
114
|
-
<a href="#M000048">default_fetch</a>
|
115
|
-
<a href="#M000054">delete</a>
|
116
|
-
<a href="#M000058">dump</a>
|
117
|
-
<a href="#M000050">edit</a>
|
118
|
-
<a href="#M000055">fetch</a>
|
119
|
-
<a href="#M000062">find_format</a>
|
120
|
-
<a href="#M000059">formats</a>
|
121
|
-
<a href="#M000060">formats=</a>
|
122
|
-
<a href="#M000039">get_file_id</a>
|
123
|
-
<a href="#M000061">identify_file_type</a>
|
124
|
-
<a href="#M000052">insert</a>
|
125
|
-
<a href="#M000036">inspect</a>
|
126
|
-
<a href="#M000063">link</a>
|
127
|
-
<a href="#M000057">load</a>
|
128
|
-
<a href="#M000040">make_file_id</a>
|
129
|
-
<a href="#M000033">new</a>
|
130
|
-
<a href="#M000047">object_missing</a>
|
131
|
-
<a href="#M000051">replace</a>
|
132
|
-
<a href="#M000035">subdb</a>
|
133
|
-
<a href="#M000064">symlink</a>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
</div>
|
138
|
-
|
139
|
-
|
140
|
-
<!-- if includes -->
|
141
|
-
<div id="includes">
|
142
|
-
<h3 class="section-bar">Included Modules</h3>
|
143
|
-
|
144
|
-
<div id="includes-list">
|
145
|
-
<span class="include-name">Formats</span>
|
146
|
-
<span class="include-name"><a href="PathUtilities.html">PathUtilities</a></span>
|
147
|
-
<span class="include-name"><a href="DirectoryIterators.html">DirectoryIterators</a></span>
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<div id="section">
|
152
|
-
|
153
|
-
<div id="class-list">
|
154
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
155
|
-
|
156
|
-
Class <a href="Database/AbortedTransaction.html" class="link">FSDB::Database::AbortedTransaction</a><br />
|
157
|
-
Class <a href="Database/CreateFileError.html" class="link">FSDB::Database::CreateFileError</a><br />
|
158
|
-
Class <a href="Database/DirIsImmutableError.html" class="link">FSDB::Database::DirIsImmutableError</a><br />
|
159
|
-
Class <a href="Database/DirNotEmptyError.html" class="link">FSDB::Database::DirNotEmptyError</a><br />
|
160
|
-
Class <a href="Database/FormatError.html" class="link">FSDB::Database::FormatError</a><br />
|
161
|
-
Class <a href="Database/MissingFileError.html" class="link">FSDB::Database::MissingFileError</a><br />
|
162
|
-
Class <a href="Database/MissingObjectError.html" class="link">FSDB::Database::MissingObjectError</a><br />
|
163
|
-
Class <a href="Database/NotDirError.html" class="link">FSDB::Database::NotDirError</a><br />
|
164
|
-
Class <a href="Database/PathComponentError.html" class="link">FSDB::Database::PathComponentError</a><br />
|
165
|
-
|
166
|
-
</div>
|
167
|
-
|
168
|
-
<div id="constants-list">
|
169
|
-
<h3 class="section-bar">Constants</h3>
|
170
|
-
|
171
|
-
<div class="name-list">
|
172
|
-
<table summary="Constants">
|
173
|
-
<tr class="top-aligned-row context-row">
|
174
|
-
<td class="context-item-name">MTIME_RESOLUTION</td>
|
175
|
-
<td>=</td>
|
176
|
-
<td class="context-item-value">2.1</td>
|
177
|
-
<td width="3em"> </td>
|
178
|
-
<td class="context-item-desc">
|
179
|
-
On windows, FAT mtime granularity is 2 sec, NTFS is 1 sec.
|
180
|
-
|
181
|
-
</td>
|
182
|
-
</tr>
|
183
|
-
<tr class="top-aligned-row context-row">
|
184
|
-
<td class="context-item-name">MTIME_RESOLUTION</td>
|
185
|
-
<td>=</td>
|
186
|
-
<td class="context-item-value">1.1</td>
|
187
|
-
<td width="3em"> </td>
|
188
|
-
<td class="context-item-desc">
|
189
|
-
Even when linux mounts FAT, the mtime granularity is 1 sec.
|
190
|
-
|
191
|
-
</td>
|
192
|
-
</tr>
|
193
|
-
<tr class="top-aligned-row context-row">
|
194
|
-
<td class="context-item-name">CLOCK_SKEW</td>
|
195
|
-
<td>=</td>
|
196
|
-
<td class="context-item-value">0.0</td>
|
197
|
-
<td width="3em"> </td>
|
198
|
-
<td class="context-item-desc">
|
199
|
-
in seconds, adjust as needed for stability on NFS
|
200
|
-
|
201
|
-
</td>
|
202
|
-
</tr>
|
203
|
-
<tr class="top-aligned-row context-row">
|
204
|
-
<td class="context-item-name">DEFAULT_META_PREFIX</td>
|
205
|
-
<td>=</td>
|
206
|
-
<td class="context-item-value">'..fsdb.meta.'</td>
|
207
|
-
<td width="3em"> </td>
|
208
|
-
<td class="context-item-desc">
|
209
|
-
Subclasses can change the defaults.
|
210
|
-
|
211
|
-
</td>
|
212
|
-
</tr>
|
213
|
-
<tr class="top-aligned-row context-row">
|
214
|
-
<td class="context-item-name">DEFAULT_LOCK_TYPE</td>
|
215
|
-
<td>=</td>
|
216
|
-
<td class="context-item-value">:flock</td>
|
217
|
-
<td width="3em"> </td>
|
218
|
-
<td class="context-item-desc">
|
219
|
-
if RUBY_PLATFORM =~ /darwin/
|
220
|
-
|
221
|
-
<pre>
|
222
|
-
DEFAULT_LOCK_TYPE = :fcntl_lock
|
223
|
-
</pre>
|
224
|
-
<p>
|
225
|
-
else
|
226
|
-
</p>
|
227
|
-
</td>
|
228
|
-
</tr>
|
229
|
-
<tr class="top-aligned-row context-row">
|
230
|
-
<td class="context-item-name">LOCK_TYPES</td>
|
231
|
-
<td>=</td>
|
232
|
-
<td class="context-item-value">[:flock, :fcntl_lock]</td>
|
233
|
-
<td width="3em"> </td>
|
234
|
-
<td class="context-item-desc">
|
235
|
-
These must be methods of <a href="../File.html">File</a>.
|
236
|
-
|
237
|
-
</td>
|
238
|
-
</tr>
|
239
|
-
<tr class="top-aligned-row context-row">
|
240
|
-
<td class="context-item-name">FORMATS</td>
|
241
|
-
<td>=</td>
|
242
|
-
<td class="context-item-value">[TEXT_FORMAT, MARSHAL_FORMAT].freeze</td>
|
243
|
-
<td width="3em"> </td>
|
244
|
-
<td class="context-item-desc">
|
245
|
-
Subclasses can define their own list of formats, with specified search
|
246
|
-
order
|
247
|
-
|
248
|
-
</td>
|
249
|
-
</tr>
|
250
|
-
</table>
|
251
|
-
</div>
|
252
|
-
</div>
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
<div id="attribute-list">
|
257
|
-
<h3 class="section-bar">Attributes</h3>
|
258
|
-
|
259
|
-
<div class="name-list">
|
260
|
-
<table>
|
261
|
-
<tr class="top-aligned-row context-row">
|
262
|
-
<td class="context-item-name">dir</td>
|
263
|
-
<td class="context-item-value"> [R] </td>
|
264
|
-
<td class="context-item-desc">
|
265
|
-
The root directory of the db, to which paths are relative.
|
266
|
-
|
267
|
-
</td>
|
268
|
-
</tr>
|
269
|
-
<tr class="top-aligned-row context-row">
|
270
|
-
<td class="context-item-name">lock_type</td>
|
271
|
-
<td class="context-item-value"> [R] </td>
|
272
|
-
<td class="context-item-desc">
|
273
|
-
The lock type of the db, by default <tt>:flock</tt>, optionally
|
274
|
-
<tt>:fcntl_lock</tt>.
|
275
|
-
|
276
|
-
</td>
|
277
|
-
</tr>
|
278
|
-
</table>
|
279
|
-
</div>
|
280
|
-
</div>
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
<!-- if method_list -->
|
285
|
-
<div id="methods">
|
286
|
-
<h3 class="section-bar">Public Class methods</h3>
|
287
|
-
|
288
|
-
<div id="method-M000034" class="method-detail">
|
289
|
-
<a name="M000034"></a>
|
290
|
-
|
291
|
-
<div class="method-heading">
|
292
|
-
<a href="Database.src/M000034.html" target="Code" class="method-signature"
|
293
|
-
onclick="popupCode('Database.src/M000034.html');return false;">
|
294
|
-
<span class="method-name">[]</span><span class="method-args">(path)</span>
|
295
|
-
</a>
|
296
|
-
</div>
|
297
|
-
|
298
|
-
<div class="method-description">
|
299
|
-
<p>
|
300
|
-
Shortcut to create a new database at <tt>path</tt>.
|
301
|
-
</p>
|
302
|
-
</div>
|
303
|
-
</div>
|
304
|
-
|
305
|
-
<div id="method-M000044" class="method-detail">
|
306
|
-
<a name="M000044"></a>
|
307
|
-
|
308
|
-
<div class="method-heading">
|
309
|
-
<a href="Database.src/M000044.html" target="Code" class="method-signature"
|
310
|
-
onclick="popupCode('Database.src/M000044.html');return false;">
|
311
|
-
<span class="method-name">abort</span><span class="method-args">()</span>
|
312
|
-
</a>
|
313
|
-
</div>
|
314
|
-
|
315
|
-
<div class="method-description">
|
316
|
-
<p>
|
317
|
-
Same as <a href="Database.html#M000043">abort</a>.
|
318
|
-
</p>
|
319
|
-
</div>
|
320
|
-
</div>
|
321
|
-
|
322
|
-
<div id="method-M000033" class="method-detail">
|
323
|
-
<a name="M000033"></a>
|
324
|
-
|
325
|
-
<div class="method-heading">
|
326
|
-
<a href="Database.src/M000033.html" target="Code" class="method-signature"
|
327
|
-
onclick="popupCode('Database.src/M000033.html');return false;">
|
328
|
-
<span class="method-name">new</span><span class="method-args">(dir, opts = {})</span>
|
329
|
-
</a>
|
330
|
-
</div>
|
331
|
-
|
332
|
-
<div class="method-description">
|
333
|
-
<p>
|
334
|
-
Create a new database object that accesses <tt>dir</tt>. Makes sure that
|
335
|
-
the directory exists on disk, but doesn’t create or open any other
|
336
|
-
files. The <tt>opts</tt> hash can include:
|
337
|
-
</p>
|
338
|
-
<table>
|
339
|
-
<tr><td valign="top"><tt>:lock_type</tt>:</td><td><tt>:flock</tt> by default, or <tt>:fcntl_lock</tt>
|
340
|
-
|
341
|
-
</td></tr>
|
342
|
-
<tr><td valign="top"><tt>:meta_prefix</tt>:</td><td><tt>’..fsdb.meta.’</tt> by default
|
343
|
-
|
344
|
-
</td></tr>
|
345
|
-
<tr><td valign="top"><tt>:formats</tt>:</td><td>nil by default, so the class’s FORMATS is used
|
346
|
-
|
347
|
-
</td></tr>
|
348
|
-
</table>
|
349
|
-
</div>
|
350
|
-
</div>
|
351
|
-
|
352
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
353
|
-
|
354
|
-
<div id="method-M000056" class="method-detail">
|
355
|
-
<a name="M000056"></a>
|
356
|
-
|
357
|
-
<div class="method-heading">
|
358
|
-
<span class="method-name">[]</span><span class="method-args">(path = "/")</span>
|
359
|
-
</div>
|
360
|
-
|
361
|
-
<div class="method-description">
|
362
|
-
<p>
|
363
|
-
Alias for <a href="Database.html#M000055">fetch</a>
|
364
|
-
</p>
|
365
|
-
</div>
|
366
|
-
</div>
|
367
|
-
|
368
|
-
<div id="method-M000053" class="method-detail">
|
369
|
-
<a name="M000053"></a>
|
370
|
-
|
371
|
-
<div class="method-heading">
|
372
|
-
<span class="method-name">[]=</span><span class="method-args">(path, object)</span>
|
373
|
-
</div>
|
374
|
-
|
375
|
-
<div class="method-description">
|
376
|
-
<p>
|
377
|
-
Alias for <a href="Database.html#M000052">insert</a>
|
378
|
-
</p>
|
379
|
-
</div>
|
380
|
-
</div>
|
381
|
-
|
382
|
-
<div id="method-M000043" class="method-detail">
|
383
|
-
<a name="M000043"></a>
|
384
|
-
|
385
|
-
<div class="method-heading">
|
386
|
-
<a href="Database.src/M000043.html" target="Code" class="method-signature"
|
387
|
-
onclick="popupCode('Database.src/M000043.html');return false;">
|
388
|
-
<span class="method-name">abort</span><span class="method-args">()</span>
|
389
|
-
</a>
|
390
|
-
</div>
|
391
|
-
|
392
|
-
<div class="method-description">
|
393
|
-
<p>
|
394
|
-
Abort the current transaction (<a href="Database.html#M000049">browse</a>,
|
395
|
-
<a href="Database.html#M000050">edit</a>, <a
|
396
|
-
href="Database.html#M000051">replace</a>, or <a
|
397
|
-
href="Database.html#M000054">delete</a>, roll back the state of the object,
|
398
|
-
and return nil from the transaction.
|
399
|
-
</p>
|
400
|
-
<p>
|
401
|
-
In the <a href="Database.html#M000049">browse</a> case, the only effect is
|
402
|
-
to end the transaction.
|
403
|
-
</p>
|
404
|
-
<p>
|
405
|
-
Note that any exception that breaks out of the transaction will also abort
|
406
|
-
the transaction, and be re-raised.
|
407
|
-
</p>
|
408
|
-
</div>
|
409
|
-
</div>
|
410
|
-
|
411
|
-
<div id="method-M000037" class="method-detail">
|
412
|
-
<a name="M000037"></a>
|
413
|
-
|
414
|
-
<div class="method-heading">
|
415
|
-
<a href="Database.src/M000037.html" target="Code" class="method-signature"
|
416
|
-
onclick="popupCode('Database.src/M000037.html');return false;">
|
417
|
-
<span class="method-name">absolute</span><span class="method-args">(path)</span>
|
418
|
-
</a>
|
419
|
-
</div>
|
420
|
-
|
421
|
-
<div class="method-description">
|
422
|
-
<p>
|
423
|
-
Convert a relative path (relative to the db dir) to an absolute path.
|
424
|
-
</p>
|
425
|
-
</div>
|
426
|
-
</div>
|
427
|
-
|
428
|
-
<div id="method-M000038" class="method-detail">
|
429
|
-
<a name="M000038"></a>
|
430
|
-
|
431
|
-
<div class="method-heading">
|
432
|
-
<span class="method-name">absolute_path_to</span><span class="method-args">(path)</span>
|
433
|
-
</div>
|
434
|
-
|
435
|
-
<div class="method-description">
|
436
|
-
<p>
|
437
|
-
Alias for <a href="Database.html#M000037">absolute</a>
|
438
|
-
</p>
|
439
|
-
</div>
|
440
|
-
</div>
|
441
|
-
|
442
|
-
<div id="method-M000049" class="method-detail">
|
443
|
-
<a name="M000049"></a>
|
444
|
-
|
445
|
-
<div class="method-heading">
|
446
|
-
<a href="Database.src/M000049.html" target="Code" class="method-signature"
|
447
|
-
onclick="popupCode('Database.src/M000049.html');return false;">
|
448
|
-
<span class="method-name">browse</span><span class="method-args">(path = "/") {|object| ...}</span>
|
449
|
-
</a>
|
450
|
-
</div>
|
451
|
-
|
452
|
-
<div class="method-description">
|
453
|
-
<p>
|
454
|
-
Browse the object. Yields the object to the caller’s block, and
|
455
|
-
returns the value of the block.
|
456
|
-
</p>
|
457
|
-
<p>
|
458
|
-
Changes to the object are not persistent, but should be avoided (they
|
459
|
-
<b>will</b> be seen by other threads, but only in the current process, and
|
460
|
-
only until the cache is cleared). If you return the object from the block,
|
461
|
-
or keep a reference to it in some other way, the object will no longer be
|
462
|
-
protected from concurrent writers.
|
463
|
-
</p>
|
464
|
-
</div>
|
465
|
-
</div>
|
466
|
-
|
467
|
-
<div id="method-M000031" class="method-detail">
|
468
|
-
<a name="M000031"></a>
|
469
|
-
|
470
|
-
<div class="method-heading">
|
471
|
-
<a href="Database.src/M000031.html" target="Code" class="method-signature"
|
472
|
-
onclick="popupCode('Database.src/M000031.html');return false;">
|
473
|
-
<span class="method-name">cache</span><span class="method-args">()</span>
|
474
|
-
</a>
|
475
|
-
</div>
|
476
|
-
|
477
|
-
<div class="method-description">
|
478
|
-
</div>
|
479
|
-
</div>
|
480
|
-
|
481
|
-
<div id="method-M000032" class="method-detail">
|
482
|
-
<a name="M000032"></a>
|
483
|
-
|
484
|
-
<div class="method-heading">
|
485
|
-
<a href="Database.src/M000032.html" target="Code" class="method-signature"
|
486
|
-
onclick="popupCode('Database.src/M000032.html');return false;">
|
487
|
-
<span class="method-name">cache_mutex</span><span class="method-args">()</span>
|
488
|
-
</a>
|
489
|
-
</div>
|
490
|
-
|
491
|
-
<div class="method-description">
|
492
|
-
</div>
|
493
|
-
</div>
|
494
|
-
|
495
|
-
<div id="method-M000042" class="method-detail">
|
496
|
-
<a name="M000042"></a>
|
497
|
-
|
498
|
-
<div class="method-heading">
|
499
|
-
<a href="Database.src/M000042.html" target="Code" class="method-signature"
|
500
|
-
onclick="popupCode('Database.src/M000042.html');return false;">
|
501
|
-
<span class="method-name">clear_cache</span><span class="method-args">()</span>
|
502
|
-
</a>
|
503
|
-
</div>
|
504
|
-
|
505
|
-
<div class="method-description">
|
506
|
-
<p>
|
507
|
-
Can be called occasionally to reduce memory footprint, esp. if cached
|
508
|
-
objects are large and infrequently used.
|
509
|
-
</p>
|
510
|
-
</div>
|
511
|
-
</div>
|
512
|
-
|
513
|
-
<div id="method-M000041" class="method-detail">
|
514
|
-
<a name="M000041"></a>
|
515
|
-
|
516
|
-
<div class="method-heading">
|
517
|
-
<a href="Database.src/M000041.html" target="Code" class="method-signature"
|
518
|
-
onclick="popupCode('Database.src/M000041.html');return false;">
|
519
|
-
<span class="method-name">clear_entry</span><span class="method-args">(file_id)</span>
|
520
|
-
</a>
|
521
|
-
</div>
|
522
|
-
|
523
|
-
<div class="method-description">
|
524
|
-
<p>
|
525
|
-
For housekeeping, so that stale entries don’t result in unused, but
|
526
|
-
uncollectable, CacheEntry objects.
|
527
|
-
</p>
|
528
|
-
</div>
|
529
|
-
</div>
|
530
|
-
|
531
|
-
<div id="method-M000045" class="method-detail">
|
532
|
-
<a name="M000045"></a>
|
533
|
-
|
534
|
-
<div class="method-heading">
|
535
|
-
<a href="Database.src/M000045.html" target="Code" class="method-signature"
|
536
|
-
onclick="popupCode('Database.src/M000045.html');return false;">
|
537
|
-
<span class="method-name">default_browse</span><span class="method-args">(path) {|x| ...}</span>
|
538
|
-
</a>
|
539
|
-
</div>
|
540
|
-
|
541
|
-
<div class="method-description">
|
542
|
-
<p>
|
543
|
-
Called when <a href="Database.html#M000049">browse</a> doesn’t find
|
544
|
-
anything at the path. The original caller’s block is available to be
|
545
|
-
yielded to.
|
546
|
-
</p>
|
547
|
-
</div>
|
548
|
-
</div>
|
549
|
-
|
550
|
-
<div id="method-M000046" class="method-detail">
|
551
|
-
<a name="M000046"></a>
|
552
|
-
|
553
|
-
<div class="method-heading">
|
554
|
-
<a href="Database.src/M000046.html" target="Code" class="method-signature"
|
555
|
-
onclick="popupCode('Database.src/M000046.html');return false;">
|
556
|
-
<span class="method-name">default_edit</span><span class="method-args">(path) {|x| ...}</span>
|
557
|
-
</a>
|
558
|
-
</div>
|
559
|
-
|
560
|
-
<div class="method-description">
|
561
|
-
<p>
|
562
|
-
Called when <a href="Database.html#M000050">edit</a> doesn’t find
|
563
|
-
anything at the path. The original caller’s block is available to be
|
564
|
-
yielded to.
|
565
|
-
</p>
|
566
|
-
</div>
|
567
|
-
</div>
|
568
|
-
|
569
|
-
<div id="method-M000048" class="method-detail">
|
570
|
-
<a name="M000048"></a>
|
571
|
-
|
572
|
-
<div class="method-heading">
|
573
|
-
<a href="Database.src/M000048.html" target="Code" class="method-signature"
|
574
|
-
onclick="popupCode('Database.src/M000048.html');return false;">
|
575
|
-
<span class="method-name">default_fetch</span><span class="method-args">(path)</span>
|
576
|
-
</a>
|
577
|
-
</div>
|
578
|
-
|
579
|
-
<div class="method-description">
|
580
|
-
<p>
|
581
|
-
Called when <a href="Database.html#M000055">fetch</a> doesn’t find
|
582
|
-
anything at the path. Default definition just returns nil.
|
583
|
-
</p>
|
584
|
-
</div>
|
585
|
-
</div>
|
586
|
-
|
587
|
-
<div id="method-M000054" class="method-detail">
|
588
|
-
<a name="M000054"></a>
|
589
|
-
|
590
|
-
<div class="method-heading">
|
591
|
-
<a href="Database.src/M000054.html" target="Code" class="method-signature"
|
592
|
-
onclick="popupCode('Database.src/M000054.html');return false;">
|
593
|
-
<span class="method-name">delete</span><span class="method-args">(path, load=true) {|object| ...}</span>
|
594
|
-
</a>
|
595
|
-
</div>
|
596
|
-
|
597
|
-
<div class="method-description">
|
598
|
-
<p>
|
599
|
-
Delete the object from the db. If a block is given, yields the object (or
|
600
|
-
nil if none) before deleting it from the db (but before releasing the lock
|
601
|
-
on the path), and returns the value of the block. Otherwise, just returns
|
602
|
-
the object (or nil, if none). Raises <a
|
603
|
-
href="Database/DirNotEmptyError.html">DirNotEmptyError</a> if path refers
|
604
|
-
to a non-empty dir. If the dir is empty, it is deleted, and the returned
|
605
|
-
value is <tt>true</tt>. The block is not yielded to. If the <em>load</em>
|
606
|
-
argument is <tt>false</tt>, delete the object from the db without loading
|
607
|
-
it or yielding, returning <tt>true</tt>.
|
608
|
-
</p>
|
609
|
-
</div>
|
610
|
-
</div>
|
611
|
-
|
612
|
-
<div id="method-M000058" class="method-detail">
|
613
|
-
<a name="M000058"></a>
|
614
|
-
|
615
|
-
<div class="method-heading">
|
616
|
-
<a href="Database.src/M000058.html" target="Code" class="method-signature"
|
617
|
-
onclick="popupCode('Database.src/M000058.html');return false;">
|
618
|
-
<span class="method-name">dump</span><span class="method-args">(object, f)</span>
|
619
|
-
</a>
|
620
|
-
</div>
|
621
|
-
|
622
|
-
<div class="method-description">
|
623
|
-
<p>
|
624
|
-
Writes object to f (must be open for writing).
|
625
|
-
</p>
|
626
|
-
</div>
|
627
|
-
</div>
|
628
|
-
|
629
|
-
<div id="method-M000050" class="method-detail">
|
630
|
-
<a name="M000050"></a>
|
631
|
-
|
632
|
-
<div class="method-heading">
|
633
|
-
<a href="Database.src/M000050.html" target="Code" class="method-signature"
|
634
|
-
onclick="popupCode('Database.src/M000050.html');return false;">
|
635
|
-
<span class="method-name">edit</span><span class="method-args">(path = "/") {|object if block_given?| ...}</span>
|
636
|
-
</a>
|
637
|
-
</div>
|
638
|
-
|
639
|
-
<div class="method-description">
|
640
|
-
<p>
|
641
|
-
Edit the object in place. Changes to the yielded object made within the
|
642
|
-
caller’s block become persistent. Returns the value of the block.
|
643
|
-
Note that assigning to the block argument variable does not change the
|
644
|
-
state of the object. Use destructive methods on the object.
|
645
|
-
</p>
|
646
|
-
</div>
|
647
|
-
</div>
|
648
|
-
|
649
|
-
<div id="method-M000055" class="method-detail">
|
650
|
-
<a name="M000055"></a>
|
651
|
-
|
652
|
-
<div class="method-heading">
|
653
|
-
<a href="Database.src/M000055.html" target="Code" class="method-signature"
|
654
|
-
onclick="popupCode('Database.src/M000055.html');return false;">
|
655
|
-
<span class="method-name">fetch</span><span class="method-args">(path = "/")</span>
|
656
|
-
</a>
|
657
|
-
</div>
|
658
|
-
|
659
|
-
<div class="method-description">
|
660
|
-
<p>
|
661
|
-
Fetch a <b>copy</b> of the object at the path for private use by the
|
662
|
-
current thread/process. (The copy is a <b>deep</b> copy.)
|
663
|
-
</p>
|
664
|
-
<p>
|
665
|
-
Note that this is inherently less efficient than <a
|
666
|
-
href="Database.html#M000049">browse</a>, because <a
|
667
|
-
href="Database.html#M000049">browse</a> leaves the object in the cache,
|
668
|
-
but, for safety, <a href="Database.html#M000055">fetch</a> can only return
|
669
|
-
a copy and wipe the cache, since the copy is going to be used outside of
|
670
|
-
any transaction. Subsequent transactions will have to read the object
|
671
|
-
again.
|
672
|
-
</p>
|
673
|
-
</div>
|
674
|
-
</div>
|
675
|
-
|
676
|
-
<div id="method-M000062" class="method-detail">
|
677
|
-
<a name="M000062"></a>
|
678
|
-
|
679
|
-
<div class="method-heading">
|
680
|
-
<a href="Database.src/M000062.html" target="Code" class="method-signature"
|
681
|
-
onclick="popupCode('Database.src/M000062.html');return false;">
|
682
|
-
<span class="method-name">find_format</span><span class="method-args">(path, abs_path = absolute(path))</span>
|
683
|
-
</a>
|
684
|
-
</div>
|
685
|
-
|
686
|
-
<div class="method-description">
|
687
|
-
</div>
|
688
|
-
</div>
|
689
|
-
|
690
|
-
<div id="method-M000059" class="method-detail">
|
691
|
-
<a name="M000059"></a>
|
692
|
-
|
693
|
-
<div class="method-heading">
|
694
|
-
<a href="Database.src/M000059.html" target="Code" class="method-signature"
|
695
|
-
onclick="popupCode('Database.src/M000059.html');return false;">
|
696
|
-
<span class="method-name">formats</span><span class="method-args">()</span>
|
697
|
-
</a>
|
698
|
-
</div>
|
699
|
-
|
700
|
-
<div class="method-description">
|
701
|
-
</div>
|
702
|
-
</div>
|
703
|
-
|
704
|
-
<div id="method-M000060" class="method-detail">
|
705
|
-
<a name="M000060"></a>
|
706
|
-
|
707
|
-
<div class="method-heading">
|
708
|
-
<a href="Database.src/M000060.html" target="Code" class="method-signature"
|
709
|
-
onclick="popupCode('Database.src/M000060.html');return false;">
|
710
|
-
<span class="method-name">formats=</span><span class="method-args">(fmts)</span>
|
711
|
-
</a>
|
712
|
-
</div>
|
713
|
-
|
714
|
-
<div class="method-description">
|
715
|
-
</div>
|
716
|
-
</div>
|
717
|
-
|
718
|
-
<div id="method-M000039" class="method-detail">
|
719
|
-
<a name="M000039"></a>
|
720
|
-
|
721
|
-
<div class="method-heading">
|
722
|
-
<a href="Database.src/M000039.html" target="Code" class="method-signature"
|
723
|
-
onclick="popupCode('Database.src/M000039.html');return false;">
|
724
|
-
<span class="method-name">get_file_id</span><span class="method-args">(abs_path)</span>
|
725
|
-
</a>
|
726
|
-
</div>
|
727
|
-
|
728
|
-
<div class="method-description">
|
729
|
-
<p>
|
730
|
-
Convert an absolute path to a unique key for the cache, raising <a
|
731
|
-
href="Database/MissingFileError.html">MissingFileError</a> if the file does
|
732
|
-
not exist.
|
733
|
-
</p>
|
734
|
-
</div>
|
735
|
-
</div>
|
736
|
-
|
737
|
-
<div id="method-M000061" class="method-detail">
|
738
|
-
<a name="M000061"></a>
|
739
|
-
|
740
|
-
<div class="method-heading">
|
741
|
-
<a href="Database.src/M000061.html" target="Code" class="method-signature"
|
742
|
-
onclick="popupCode('Database.src/M000061.html');return false;">
|
743
|
-
<span class="method-name">identify_file_type</span><span class="method-args">(f, path, abs_path = absolute(path))</span>
|
744
|
-
</a>
|
745
|
-
</div>
|
746
|
-
|
747
|
-
<div class="method-description">
|
748
|
-
<p>
|
749
|
-
<tt>path</tt> is relative to the database, and initial ’/’ is
|
750
|
-
ignored
|
751
|
-
</p>
|
752
|
-
</div>
|
753
|
-
</div>
|
754
|
-
|
755
|
-
<div id="method-M000052" class="method-detail">
|
756
|
-
<a name="M000052"></a>
|
757
|
-
|
758
|
-
<div class="method-heading">
|
759
|
-
<a href="Database.src/M000052.html" target="Code" class="method-signature"
|
760
|
-
onclick="popupCode('Database.src/M000052.html');return false;">
|
761
|
-
<span class="method-name">insert</span><span class="method-args">(path, object)</span>
|
762
|
-
</a>
|
763
|
-
</div>
|
764
|
-
|
765
|
-
<div class="method-description">
|
766
|
-
<p>
|
767
|
-
Insert the object, replacing anything at the path. Returns the object. (The
|
768
|
-
object remains a <em>local copy</em>, distinct from the one which will be
|
769
|
-
returned when accessing the path through database transactions.)
|
770
|
-
</p>
|
771
|
-
<p>
|
772
|
-
If <tt>path</tt> ends in "/", then object is treated as a
|
773
|
-
collection of key-value pairs, and each value is inserted at the
|
774
|
-
corresponding key under <tt>path</tt>. (You can omit the "/" if
|
775
|
-
the dir already exists.)
|
776
|
-
</p>
|
777
|
-
<pre>
|
778
|
-
is this still true?
|
779
|
-
</pre>
|
780
|
-
</div>
|
781
|
-
</div>
|
782
|
-
|
783
|
-
<div id="method-M000036" class="method-detail">
|
784
|
-
<a name="M000036"></a>
|
785
|
-
|
786
|
-
<div class="method-heading">
|
787
|
-
<a href="Database.src/M000036.html" target="Code" class="method-signature"
|
788
|
-
onclick="popupCode('Database.src/M000036.html');return false;">
|
789
|
-
<span class="method-name">inspect</span><span class="method-args">()</span>
|
790
|
-
</a>
|
791
|
-
</div>
|
792
|
-
|
793
|
-
<div class="method-description">
|
794
|
-
</div>
|
795
|
-
</div>
|
796
|
-
|
797
|
-
<div id="method-M000063" class="method-detail">
|
798
|
-
<a name="M000063"></a>
|
799
|
-
|
800
|
-
<div class="method-heading">
|
801
|
-
<a href="Database.src/M000063.html" target="Code" class="method-signature"
|
802
|
-
onclick="popupCode('Database.src/M000063.html');return false;">
|
803
|
-
<span class="method-name">link</span><span class="method-args">(old_name, new_name)</span>
|
804
|
-
</a>
|
805
|
-
</div>
|
806
|
-
|
807
|
-
<div class="method-description">
|
808
|
-
<p>
|
809
|
-
Create a hard link, using File.link. The names are relative to the
|
810
|
-
database’s path.
|
811
|
-
</p>
|
812
|
-
</div>
|
813
|
-
</div>
|
814
|
-
|
815
|
-
<div id="method-M000057" class="method-detail">
|
816
|
-
<a name="M000057"></a>
|
817
|
-
|
818
|
-
<div class="method-heading">
|
819
|
-
<a href="Database.src/M000057.html" target="Code" class="method-signature"
|
820
|
-
onclick="popupCode('Database.src/M000057.html');return false;">
|
821
|
-
<span class="method-name">load</span><span class="method-args">(f)</span>
|
822
|
-
</a>
|
823
|
-
</div>
|
824
|
-
|
825
|
-
<div class="method-description">
|
826
|
-
<p>
|
827
|
-
Returns object read from f (must be open for reading).
|
828
|
-
</p>
|
829
|
-
</div>
|
830
|
-
</div>
|
831
|
-
|
832
|
-
<div id="method-M000040" class="method-detail">
|
833
|
-
<a name="M000040"></a>
|
834
|
-
|
835
|
-
<div class="method-heading">
|
836
|
-
<a href="Database.src/M000040.html" target="Code" class="method-signature"
|
837
|
-
onclick="popupCode('Database.src/M000040.html');return false;">
|
838
|
-
<span class="method-name">make_file_id</span><span class="method-args">(abs_path)</span>
|
839
|
-
</a>
|
840
|
-
</div>
|
841
|
-
|
842
|
-
<div class="method-description">
|
843
|
-
<p>
|
844
|
-
Convert an absolute path to a unique key for the cache, creating the file
|
845
|
-
if it does not exist. Raises <a
|
846
|
-
href="Database/CreateFileError.html">CreateFileError</a> if it can’t
|
847
|
-
be created.
|
848
|
-
</p>
|
849
|
-
</div>
|
850
|
-
</div>
|
851
|
-
|
852
|
-
<div id="method-M000047" class="method-detail">
|
853
|
-
<a name="M000047"></a>
|
854
|
-
|
855
|
-
<div class="method-heading">
|
856
|
-
<a href="Database.src/M000047.html" target="Code" class="method-signature"
|
857
|
-
onclick="popupCode('Database.src/M000047.html');return false;">
|
858
|
-
<span class="method-name">object_missing</span><span class="method-args">(path)</span>
|
859
|
-
</a>
|
860
|
-
</div>
|
861
|
-
|
862
|
-
<div class="method-description">
|
863
|
-
<p>
|
864
|
-
The default behavior of both <a
|
865
|
-
href="Database.html#M000046">default_edit</a> and <a
|
866
|
-
href="Database.html#M000045">default_browse</a>. Raises <a
|
867
|
-
href="Database/MissingObjectError.html">MissingObjectError</a> by default,
|
868
|
-
but it can yield to the original block.
|
869
|
-
</p>
|
870
|
-
</div>
|
871
|
-
</div>
|
872
|
-
|
873
|
-
<div id="method-M000051" class="method-detail">
|
874
|
-
<a name="M000051"></a>
|
875
|
-
|
876
|
-
<div class="method-heading">
|
877
|
-
<a href="Database.src/M000051.html" target="Code" class="method-signature"
|
878
|
-
onclick="popupCode('Database.src/M000051.html');return false;">
|
879
|
-
<span class="method-name">replace</span><span class="method-args">(path) {|old_object if block_given?| ...}</span>
|
880
|
-
</a>
|
881
|
-
</div>
|
882
|
-
|
883
|
-
<div class="method-description">
|
884
|
-
<p>
|
885
|
-
Replace the yielded object (or nil) with the return value of the block.
|
886
|
-
Returns the object that was replaced. No object need exist at
|
887
|
-
<tt>path</tt>.
|
888
|
-
</p>
|
889
|
-
<p>
|
890
|
-
Use replace instead of edit when accessing db over a drb connection. Use
|
891
|
-
replace instead of insert if the path needs to be protected while the
|
892
|
-
object is prepared for insertion.
|
893
|
-
</p>
|
894
|
-
<p>
|
895
|
-
Note that (unlike <a href="Database.html#M000050">edit</a>) destructive
|
896
|
-
methods on the object do not persistently change the state of the object,
|
897
|
-
unless the object is the return value of the block.
|
898
|
-
</p>
|
899
|
-
</div>
|
900
|
-
</div>
|
901
|
-
|
902
|
-
<div id="method-M000035" class="method-detail">
|
903
|
-
<a name="M000035"></a>
|
904
|
-
|
905
|
-
<div class="method-heading">
|
906
|
-
<a href="Database.src/M000035.html" target="Code" class="method-signature"
|
907
|
-
onclick="popupCode('Database.src/M000035.html');return false;">
|
908
|
-
<span class="method-name">subdb</span><span class="method-args">(path)</span>
|
909
|
-
</a>
|
910
|
-
</div>
|
911
|
-
|
912
|
-
<div class="method-description">
|
913
|
-
<p>
|
914
|
-
Create a new database object that accesses <tt>path</tt> relative to the
|
915
|
-
database directory. A process can have any number of dbs accessing
|
916
|
-
overlapping dirs. The cost of creating an additional db is very low; its
|
917
|
-
state is just the dir and some options. Caching is done in structures owned
|
918
|
-
by the <a href="Database.html">Database</a> class itself.
|
919
|
-
</p>
|
920
|
-
</div>
|
921
|
-
</div>
|
922
|
-
|
923
|
-
<div id="method-M000064" class="method-detail">
|
924
|
-
<a name="M000064"></a>
|
925
|
-
|
926
|
-
<div class="method-heading">
|
927
|
-
<a href="Database.src/M000064.html" target="Code" class="method-signature"
|
928
|
-
onclick="popupCode('Database.src/M000064.html');return false;">
|
929
|
-
<span class="method-name">symlink</span><span class="method-args">(old_name, new_name)</span>
|
930
|
-
</a>
|
931
|
-
</div>
|
932
|
-
|
933
|
-
<div class="method-description">
|
934
|
-
<p>
|
935
|
-
Create a symbolic link, using File.symlink. The names are relative to the
|
936
|
-
database’s path.
|
937
|
-
</p>
|
938
|
-
</div>
|
939
|
-
</div>
|
940
|
-
|
941
|
-
|
942
|
-
</div>
|
943
|
-
|
944
|
-
|
945
|
-
</div>
|
946
|
-
|
947
|
-
|
948
|
-
<div id="validator-badges">
|
949
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
950
|
-
</div>
|
951
|
-
|
952
|
-
</body>
|
953
|
-
</html>
|