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

Method save_downset

backend/src/redis/mod.rs:178–198  ·  view source on GitHub ↗

Since redis keys have the commit hash of an immutible Git commit, they do not need to have an expiry.

(
        &self,
        con: &mut redis_rs::Connection,
        key: &Key,
        set: &HashSet<ExternalId>,
    )

Source from the content-addressed store, hash-verified

176 // Since redis keys have the commit hash of an immutible Git commit, they do not need to have
177 // an expiry.
178 fn save_downset(
179 &self,
180 con: &mut redis_rs::Connection,
181 key: &Key,
182 set: &HashSet<ExternalId>,
183 ) -> Result<()> {
184 redis_rs::transaction::<_, _, (), _>(con, &[key], |con, pipe| {
185 let set = set
186 .iter()
187 .map(ExternalId::to_string)
188 .collect::<HashSet<String>>();
189 if set.is_empty() {
190 pipe.del(key).ignore()
191 } else {
192 pipe.sadd(key, set).ignore()
193 }
194 .query(con)
195 })?;
196
197 Ok(())
198 }
199
200 fn stats_key(&self, repo_id: RepoId, commit: &str) -> String {
201 format!("stats:{repo_id}:{commit}")

Callers 1

intersectionMethod · 0.80

Calls 2

iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected