Comments (6)
from engine-api.
@nishanttotla can you elaborate on how this nopclient is used?
from engine-api.
@duglin it's used here: https://github.com/docker/swarm/blob/master/cluster/engine.go
The primary purpose is to void every action if an Engine goes down in the cluster. It avoids heavy locking around engine/list structs and pending operations. Without this, Swarm performance can degrade.
from engine-api.
I'm pretty sure we don't need that. You can probably achieve the same behavior with a custom Transport that always returns a client.
Steps:
1- Implement the RoundTripper interface:
type NopTrip struct {}
func (NopTrip) RoundTrip(*Request) (*Response, error) {
return nil, errors.New("nop")
}
2- Create a new HTTPClient using that transport:
client := http.Client{
Transport: NotTrip{},
}
3- Create an API client with this new client:
api, _ := client.NewClient("...", "", client, ...)
🎉
If this doesn't work, we should consider change the code enough to make it work. This approach is way more scalable than the nopclient because we don't have to add new methods to it every time something is added to the client.
from engine-api.
As a second note, Swarm should consider using the Circuit Breaker pattern rather than this hack:
http://martinfowler.com/bliki/CircuitBreaker.html
An implementation in Go: https://github.com/rubyist/circuitbreaker
from engine-api.
@calavera thanks, that sounds like a great suggestion! I'll close this issue for now, and I think we can consider moving away from the nopclient after the 1.2 release next month.
from engine-api.
Related Issues (20)
- APIClient stub HOT 1
- Streaming Events HOT 2
- Wrong pathstat.Size value for tar file extracted using CopyFromContainer
- Pointer to time.Duration HOT 2
- ContainerLogs with default ContainerLogsOption HOT 1
- Go 1.7: context.DeadlineExceeded gets returned as ErrConnectionFailed
- I can't seem to cp files into containers with mounted docker volumes? HOT 1
- Proposal: A new user-focused client API HOT 7
- networkCreate failing to create overlay networks HOT 3
- CreateService with limit.NanoCPUs ERRO[0052] Error response from daemon: {"message":"rpc error: code = 3 desc = invalid cpu value 2e-09: Must be at least 0.001"} HOT 1
- ContainerCreate fails with error
- Proposal: to support YAML version of configuartion files
- [Proposal] Moving the client package to docker/docker HOT 8
- ContainerExecAttach wrong request body? HOT 2
- c.Clone undefined (type *tls.Config has no field or method Clone) HOT 5
- Golang SDK for swarm mode - swarmInit
- adding device with containers/{id}/update api call has no effect
- ContainerStart with memory limit HOT 2
- don't close the write connection on docker attach HOT 1
- API have any function support -net=host?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from engine-api.