Collection of high performance, thread-safe, lock-free go data structures
Collection of high performance, thread-safe, lock-free go data structures
Collection of high performance, thread-safe, lock-free go data structures.
JDKLinkedQueue and MutexLinkedQueue from OpenJDK.go get -u go.linecorp.com/garrPlease find detailed examples in each sub-package.
…package main
import (
"fmt"
"go.linecorp.com/garr/queue"
)
func main() {
q := queue.DefaultQueue() // default using jdk linked queue
// push
q.Offer(123)
// return head queue but not remove
head := q.Peek()
fmt.Println(head)
// remove and return head queue
polled := q.Poll()
fmt.Println(polled)
}package main
import (
cbreaker "go.linecorp.com/garr/circuit-breaker"
)
func makeRequest() error {
return nil
}
func main() {
cb := cbreaker.NewCircuitBreakerBuilder().
SetTicker(cbreaker.SystemTicker).
SetFailureRateThreshold(validFailureRateThreshold).
Build()
if cb.CanRequest() {
err := makeRequest()
if err != nil {
cb.OnFailure()
} else {
cb.OnSuccess()
}
}
}No open issues yet, or sync has not completed.