Skip to content

Conversation

@logicminds
Copy link
Contributor

I am not sure this is quite ready to merge, as I haven't fixed the documentation yet nor tested with real haproxy instances, but in the following days this should be ready to merge. Have a look as this is a major change. All unit tests are passing at this point. I'll be playing around with this new code in a real environment this week but you can review this for now. Its pretty functional and allows one to play around with server or backend objects instead of the instance. The objects are scoped so you only see backend or server related information gathered from the stats.

I also moved the socket to its own file in case the user wants to create a server or backend object without using the instance object.

These new objects will create a bunch more chatter on the socket channel so I was thinking of going back and adding some sort of cache layer to HAPSocket to reduce the number of calls to the socket. Not sure what would happen to haproxy if the socket is over utilized.

To use you essentially do the following:

haproxy = HAProxyManager::Instance.new ('path to haproxy socket')
servers = haproxy.server_instances
backends = haproxy.backend_instances
servers.each do |srvid, server|
    puts server.name
    puts server.weight
    puts server.up?
    puts server.bin  (bytes in, dynamic method via method missing)
end

@sreeix
Copy link
Contributor

sreeix commented Dec 3, 2013

Looks good. I would not worry about the socket chatter, we should first test it and see how haproxy deals with it. I am certain it will not have issues.

@logicminds
Copy link
Contributor Author

I have updated the read me file. Been using the new API for a few weeks without issues. This should be good to merge now and ready for mass consumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants