MCPcopy Create free account
hub / github.com/emwalker/digraph / index_key

Method index_key

backend/src/git/index.rs:494–506  ·  view source on GitHub ↗

The value of `token` will sometimes need to be normalized by the caller in order for lookups to work as expected. We do not normalize the token here because some searches, e.g., of urls, are more sensitive to normalization, and so we omit it in those cases.

(&self, token: &Phrase)

Source from the content-addressed store, hash-verified

492 // to work as expected. We do not normalize the token here because some searches, e.g.,
493 // of urls, are more sensitive to normalization, and so we omit it in those cases.
494 fn index_key(&self, token: &Phrase) -> Result<IndexKey> {
495 if !token.is_valid() {
496 return Err(Error::Repo(format!("a valid token is required: {token}")));
497 }
498
499 match token.basename() {
500 Some(basename) => Ok(IndexKey {
501 repo_id: self.prefix(),
502 basename,
503 }),
504 None => Err(Error::Repo(format!("bad token: {token}"))),
505 }
506 }
507
508 fn prefix(&self) -> RepoId;
509}

Callers 7

synonym_indexesMethod · 0.80
remove_searchesMethod · 0.80
updateMethod · 0.80
appears_inMethod · 0.80

Implementers 1

index.rsbackend/src/git/index.rs

Calls 4

RepoClass · 0.85
basenameMethod · 0.80
is_validMethod · 0.45
prefixMethod · 0.45

Tested by

no test coverage detected