equal
deleted
inserted
replaced
146 val body = res.bytes(Data.body) |
146 val body = res.bytes(Data.body) |
147 Some(Entry(session_name, theory_name, name, Future.value(compressed, body))) |
147 Some(Entry(session_name, theory_name, name, Future.value(compressed, body))) |
148 } |
148 } |
149 else None |
149 else None |
150 }) |
150 }) |
|
151 } |
|
152 |
|
153 def read_entry(dir: Path, session_name: String, theory_name: String, name: String): Option[Entry] = |
|
154 { |
|
155 val path = dir + Path.basic(theory_name) + Path.explode(name) |
|
156 if (path.is_file) { |
|
157 val uncompressed = Bytes.read(path) |
|
158 Some(Entry(session_name, theory_name, name, Future.value((false, uncompressed)))) |
|
159 } |
|
160 else None |
151 } |
161 } |
152 |
162 |
153 |
163 |
154 /* database consumer thread */ |
164 /* database consumer thread */ |
155 |
165 |
197 |
207 |
198 def snapshot(snapshot: Document.Snapshot): Provider = |
208 def snapshot(snapshot: Document.Snapshot): Provider = |
199 new Provider { |
209 new Provider { |
200 def apply(export_name: String): Option[Entry] = |
210 def apply(export_name: String): Option[Entry] = |
201 snapshot.exports_map.get(export_name) |
211 snapshot.exports_map.get(export_name) |
|
212 } |
|
213 |
|
214 def directory(dir: Path, session_name: String, theory_name: String): Provider = |
|
215 new Provider { |
|
216 def apply(export_name: String): Option[Entry] = |
|
217 read_entry(dir, session_name, theory_name, export_name) |
202 } |
218 } |
203 } |
219 } |
204 |
220 |
205 trait Provider |
221 trait Provider |
206 { |
222 { |