• Stars
    star
    124
  • Rank 278,534 (Top 6 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Concurrency toolkit for Go

cff: a concurrency toolkit for Go

cff logo

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.
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 --> dots2

  dots1 --> X
  dots2 --> Y

  style dots1 fill:none,stroke:none
  style dots2 fill:none,stroke:none
  1. Run independent functions concurrently.
flowchart TD
  A; B; dots[...]; H

  done(( Done ))

  A --> done
  B --Error--x done
  dots -.-> done
  H --> done

  style done fill:none,stroke:none
  style dots fill:none,stroke:none
  1. Run the same function on every element of a map or a slice, without risk of unbounded goroutine growth.
flowchart RL
  subgraph Slice ["[]T"]
    i0["x1"]; i1["x2"]; dots1[...]; iN["xN"]
    style dots1 fill:none,stroke:none
  end

  subgraph Map ["map[K]V"]
    m1["(k1, v1)"]; m2["(k2, v2)"]; dots2[...]; mN["(kN, vN)"]
    style dots2 fill:none,stroke:none
  end

  subgraph Workers
    direction LR
    1; 2
  end

  Slice & Map -.-> Workers

See our documentation at https://uber-go.github.io/cff for more information.

Installation

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.

License

cff is licensed under the Apache 2.0 license. See the LICENSE file for more information.

More Repositories

1

zap

Blazing fast, structured, leveled logging in Go.
Go
20,876
star
2

guide

The Uber Go Style Guide.
Makefile
15,131
star
3

fx

A dependency injection based application framework for Go.
Go
5,186
star
4

goleak

Goroutine leak detector
Go
4,263
star
5

ratelimit

A Go blocking leaky-bucket rate limit implementation
Go
3,934
star
6

dig

A reflection based dependency injection toolkit for Go.
Go
3,596
star
7

automaxprocs

Automatically set GOMAXPROCS to match Linux container CPU quota.
Go
3,459
star
8

mock

GoMock is a mocking framework for the Go programming language.
Go
1,582
star
9

atomic

Wrapper types for sync/atomic which enforce atomic access
Go
1,250
star
10

multierr

Combine one or more Go errors together
Go
907
star
11

tally

A Go metrics interface with fast buffered metrics and third party reporters
Go
810
star
12

gopatch

Refactoring and code transformation tool for Go.
Go
681
star
13

nilaway

Static Analysis tool to detect potential Nil panics in Go code
Go
400
star
14

config

Configuration for Go applications
Go
382
star
15

cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.
Go
322
star
16

sally

A tiny HTTP server for supporting custom Golang import paths
Go
228
star
17

kafka-client

Go client library for Apache Kafka
Go
221
star
18

dosa

DOSA is a data object abstraction layer
Go
197
star
19

tools

A collection of golang tools used at Uber
Go
58
star
20

go-helix

A Go implementation of Apache Helix (currently the participant part only).
Go
56
star
21

icu4go

A Go binding for the icu4c library
Go
49
star
22

mapdecode

Implement YAML/JSON decoding in one place.
Go
48
star
23

hackeroni

A Go API client for HackerOne (api.hackerone.com)
Go
41
star
24

gwr

Get / Watch / Report -ing of operational data. This project is deprecated and not maintained.
Go
38
star
25

flagoverride

An automatic way of creating command line options to override fields from a struct.
Go
20
star