Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uber-go/cff
Concurrency toolkit for Go
https://github.com/uber-go/cff
code-generator concurrency golang
Last synced: 4 days ago
JSON representation
Concurrency toolkit for Go
- Host: GitHub
- URL: https://github.com/uber-go/cff
- Owner: uber-go
- License: apache-2.0
- Created: 2022-09-28T20:38:01.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-01T11:14:59.000Z (6 months ago)
- Last Synced: 2024-06-21T19:50:22.831Z (5 months ago)
- Topics: code-generator, concurrency, golang
- Language: Go
- Homepage: https://uber-go.github.io/cff
- Size: 3.3 MB
- Stars: 154
- Watchers: 9
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# cff: a concurrency toolkit for Go
![cff logo](assets/logo.png)
cff (pronounce *caff* as in caffeine) is a library and code generator for Go
that makes it easy to write concurrent code in Go.It gives you:
* Bounded resource consumption: cff uses a pool of goroutines to run all operations, preventing issues arising from unbounded goroutine growth in your application.
* Panic-safety: cff prevents panics in your concurrent code from crashing your application in a predictable manner.cff can be useful when you are trying to:
1. Run interdependent functions concurrently, with a guarantee that a function does not run before its dependencies.
```mermaid
flowchart LR
A; B; C; D; E; F; G
dots1[...]; dots2[...]
X; Y;A & B --> C
B --> D & E
A & C --> F
C & D & E --> G
F & G --> dots1
G & E --> dots2dots1 --> X
dots2 --> Ystyle dots1 fill:none,stroke:none
style dots2 fill:none,stroke:none
```2. Run independent functions concurrently.
```mermaid
flowchart TD
A; B; dots[...]; Hdone(( Done ))
A --> done
B --Error--x done
dots -.-> done
H --> donestyle done fill:none,stroke:none
style dots fill:none,stroke:none
```3. Run the same function on every element of a map or a slice, without risk of unbounded goroutine growth.
```mermaid
flowchart RL
subgraph Slice ["[]T"]
i0["x1"]; i1["x2"]; dots1[...]; iN["xN"]
style dots1 fill:none,stroke:none
endsubgraph Map ["map[K]V"]
m1["(k1, v1)"]; m2["(k2, v2)"]; dots2[...]; mN["(kN, vN)"]
style dots2 fill:none,stroke:none
endsubgraph Workers
direction LR
1; 2
endSlice & Map -.-> Workers
```See our documentation at https://uber-go.github.io/cff for more information.
## Installation
```bash
go get -u go.uber.org/cff
```## Project status
At Uber, we've been using cff in production for several years.
We're confident in the stability of its core functionality.Although its APIs have satisfied a majority of our needs,
we expect to add or modify some of these once the project is public.That said, we intend to make these changes in compliance with
[Semantic Versioning](https://semver.org/).## License
cff is licensed under the Apache 2.0 license. See the LICENSE file for more information.