summa_core/directories/
mod.rs1mod byte_range_cache;
2mod caching_directory;
3mod debug_proxy_directory;
4mod external_requests;
5mod hot_cache_directory;
6mod network_directory;
7
8pub use caching_directory::{CachingDirectory, FileStat, FileStats};
9pub use debug_proxy_directory::DebugProxyDirectory;
10pub use external_requests::{
11 DefaultExternalRequestGenerator, ExternalRequest, ExternalRequestGenerator, ExternalRequestGeneratorClone, ExternalResponse, Header, RequestError,
12};
13pub use hot_cache_directory::{create_hotcache, deserialize_cbor, HotDirectory, StaticDirectoryCache};
14pub use network_directory::{NetworkDirectory, NetworkFile};
15
16struct Noop {}
17
18impl std::io::Write for Noop {
19 fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
20 Ok(buf.len())
21 }
22
23 fn flush(&mut self) -> std::io::Result<()> {
24 Ok(())
25 }
26}
27
28impl tantivy::directory::TerminatingWrite for Noop {
29 fn terminate_ref(&mut self, _: tantivy::directory::AntiCallToken) -> std::io::Result<()> {
30 Ok(())
31 }
32}
33
34#[macro_export]
35macro_rules! write_proxy_directory {
36 () => {
37 fn atomic_write(&self, path: &Path, data: &[u8]) -> std::io::Result<()> {
38 self.underlying.atomic_write(path, data)
39 }
40
41 fn delete(&self, path: &Path) -> Result<(), tantivy::directory::error::DeleteError> {
42 self.underlying.delete(path)
43 }
44
45 async fn delete_async(&self, path: &Path) -> Result<(), tantivy::directory::error::DeleteError> {
46 self.underlying.delete_async(path).await
47 }
48
49 fn open_write(&self, path: &Path) -> Result<tantivy::directory::WritePtr, tantivy::directory::error::OpenWriteError> {
50 self.underlying.open_write(path)
51 }
52
53 fn sync_directory(&self) -> std::io::Result<()> {
54 self.underlying.sync_directory()
55 }
56
57 fn watch(&self, watch_callback: tantivy::directory::WatchCallback) -> tantivy::Result<tantivy::directory::WatchHandle> {
58 self.underlying.watch(watch_callback)
59 }
60
61 fn acquire_lock(&self, lock: &tantivy::directory::Lock) -> Result<tantivy::directory::DirectoryLock, tantivy::directory::error::LockError> {
62 self.underlying.acquire_lock(lock)
63 }
64 };
65}
66pub use write_proxy_directory;