#thread #tlrepo

tlrepo

Thread-local git2::Repository, shareable across threads

9 releases (breaking)

0.8.0 Jan 26, 2025
0.7.0 Jun 25, 2024
0.6.0 Oct 28, 2023
0.5.0 May 20, 2023
0.1.0 Aug 25, 2020

#240 in Concurrency

Download history 3/week @ 2024-12-08 108/week @ 2025-01-26 15/week @ 2025-02-02 6/week @ 2025-02-09 7/week @ 2025-02-16 4/week @ 2025-02-23

504 downloads per month

MIT/Apache

6KB

tlrepo provides ThreadLocalRepo, a convenient way to share a git2::Repository object between threads.

A standard git2::Repository object does not support sharing among threads without some form of synchronization. tlrepo::ThreadLocalRepo provides a convenient way to reopen the same repository on each thread, caching the opened repository thread-locally for reuse.

You can create a ThreadLocalRepo by calling ThreadLocalRepo::new, or by using the extension trait tlrepo::RepositoryExt to call .thread_local() on an existing git2::Repository.


tlrepo provides ThreadLocalRepo, a convenient way to share a git2::Repository object between threads.

A standard git2::Repository object does not support sharing among threads without some form of synchronization. tlrepo::ThreadLocalRepo provides a convenient way to reopen the same repository on each thread, caching the opened repository thread-locally for reuse.

You can create a ThreadLocalRepo by calling ThreadLocalRepo::new, or by using the extension trait tlrepo::RepositoryExt to call .thread_local() on an existing git2::Repository. You can share the ThreadLocalRepo across threads, calling .get() to get a git2::Repository object to work with.

Dependencies

~11MB
~251K SLoC