virgo-agent-toolkit/virgo-base-agent — pull request #89 by songgao (2014-08-02 13:35:03+00:00)
Title: Refactor Work In Progress

Hey guys, sorry for the slow process.

It's not working yet so this is actually a WIP in progress. I'm trying to inject the new `Connection` class into `/base/client/client.lua`(`AgentClient`) and `/base/protocol/connection.lua`(`ProtocolConnection`) but some of the tests are still failing.

Plans after making this work: add Session class and move more responsibility from old code to new code. Specifically, classes such as `AgentClient` and `ProtocolConnection` will work with `Session` (multiple connections) rather than a single `Connection` class. This would make it one step closer to making what we have for the protocol part into a special feature.

Blockers/Questions now:

1. bugs and incompatabilities (seemingly related to the way RPC timeouts are handled)
2. Is there a way to run a single test in `/tests` directory? What's the best way to add new tests that use `luvit-tape`, or what's the best way to run a `.lua` with `rackspace-monitoring-agent` binary so that the `require` is handled in Virgo's way?

Foreseeable problems:

1. Manifest. In new design, manifest is handled in the handshake while in our current protocol, manifest is fetched after handshake with a new RPC call. See https://github.com/virgo-agent-toolkit/virgo-base-agent/blob/master/client/connection_messages.lua#L54 . Do we want to migrate to the new design? If we do, when should the migration happen?

2. Error handling and reconnecting logic. I don't have detailed info yet. I'll follow-up with that if it turns out to be a something complex.