Extract ExtensionIndexedDocsProvider to indexed_docs crate (#20607)

This PR extracts the `ExtensionIndexedDocsProvider` implementation to
the `indexed_docs` crate.

To achieve this, we introduce a new `Extension` trait that provides an
abstracted interface for calling an extension. This trait resides in the
`extension` crate, which has minimal dependencies and can be depended on
by other crates, like `indexed_docs`.

We're then able to implement the `ExtensionIndexedDocsProvider` without
having any knowledge of the Wasm-specific internals of the extension
system.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-11-13 11:19:55 -05:00 committed by GitHub
parent 7832883c74
commit b084d53f8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 177 additions and 127 deletions

View file

@ -324,10 +324,8 @@ impl IndexedDocsDatabase {
Ok(any)
})
}
}
impl extension_host::DocsDatabase for IndexedDocsDatabase {
fn insert(&self, key: String, docs: String) -> Task<Result<()>> {
pub fn insert(&self, key: String, docs: String) -> Task<Result<()>> {
let env = self.env.clone();
let entries = self.entries;
@ -339,3 +337,9 @@ impl extension_host::DocsDatabase for IndexedDocsDatabase {
})
}
}
impl extension::KeyValueStoreDelegate for IndexedDocsDatabase {
fn insert(&self, key: String, docs: String) -> Task<Result<()>> {
IndexedDocsDatabase::insert(&self, key, docs)
}
}