anchor.diff:  handle_pool_info_streaming(Id, HTTPRes, Wait) ->
       receive
       after Wait ->
  -            Res = case Id of
  -                "default" -> {struct, [{nodes, [{struct, [{ipAddress, <<"10.0.1.20">>},
  -                                                    {status, <<"healthy">>},
  -                                                    {ports, {struct, [{routing, 11211},
  -                                                                    {caching, 11311},
  -                                                                    {kvstore, 11411}]}},
  -                                                    {name, <<"first_node">>},
  -                                                    {fqdn, <<"first_node.in.pool.com">>}]}, {struct, [{ipAddress, <<"10.0.1.21">>},
  -                                                                                                {status, <<"healthy">>},
  -                                                                                                {ports, {struct, [{routing, 11211},
  -                                                                                                                  {caching, 11311},
  -                                                                                                                  {kvstore, 11411}]}},
  -                                                                                                {uri, <<"/addresses/10.0.1.20">>},
  -                                                                                                {name, <<"first_node">>},
  -                                                                                                {fqdn, <<"first_node.in.pool.com">>}]}]},
  -                                  {buckets, [{struct, [{uri, <<"/buckets/4">>},
  -                                                      {name, <<"Excerciser Application">>}]}]},
  -                                  {stats, {struct, [{uri, <<"/buckets/4/stats?really_for_pool=1">>}]}},
  -                                  {name, <<"Default Pool">>}]};
  -                _ -> {struct, [{nodes, [{struct, [{ipAddress, <<"10.0.1.22">>},
  -                                                 {uptime, 123321},
  -                                                 {status, <<"healthy">>},
  -                                                 {ports, {struct, [{routing, 11211},
  -                                                                    {caching, 11311},
  -                                                                    {kvstore, 11411}]}},
  -                                                 {uri, <<"https://first_node.in.pool.com:80/pool/Another Pool/node/first_node/">>},
  -                                                 {name, <<"first_node">>},
  -                                                 {fqdn, <<"first_node.in.pool.com">>}]}, {struct, [{ipAddress, <<"10.0.1.23">>},
  -                                                                                               {uptime, 123123},
  -                                                                                               {status, <<"healthy">>},
  -                                                                                               {ports, {struct, [{routing, 11211},
  -                                                                                                                  {caching, 11311},
  -                                                                                                                  {kvstore, 11411}]}},
  -                                                                                               {uri, <<"https://second_node.in.pool.com:80/pool/Another Pool/node/second_node/">>},
  -                                                                                               {name, <<"second_node">>},
  -                                                                                               {fqdn, <<"second_node.in.pool.com">>}]}]},
  -                               {buckets, [{struct, [{uri, <<"/buckets/5">>},
  -                                                   {name, <<"Excerciser Another">>}]}]},
  -                               {stats, {struct, [{uri, <<"/buckets/4/stats?really_for_pool=2">>}]}},
  -                               {name, <<"Another Pool">>}]}
  -                end,
  +            Res = build_pool_info(Id),
           HTTPRes:write_chunk(mochijson2:encode(Res)),
           %% TODO: resolve why mochiweb doesn't support zero chunk... this
           %%       indicates the end of a response for now
  
positive.code:             [{"Server", "NorthScale menelaus %TODO gitversion%"}],
              mochijson2:encode(Body)}).
  
  handle_pools(Req) ->
      reply_json(Req, {struct, [
                                %% TODO: pull this from git describe
                                {implementationVersion, <<"comes_from_git_describe">>},
                                {pools, [{struct, [{name, <<"default">>},
                                                   {uri, <<"/pools/default">>},
                                                   {streamingUri, <<"/poolsStreaming/default">>}]},
                                         %% only one pool at first release, this 
                                         %% is just for prototyping
                                         {struct, [{name, <<"Another Pool">>},
                                                   {uri, <<"/pools/Another Pool">>}]}]}]}).
  
  handle_pool_info(Id, Req) ->
      Res = case Id of
                "default" -> {struct, [{nodes, [{struct, [{ipAddress, <<"10.0.1.20">>},
                                                    {status, <<"healthy">>},
                                                    {ports, {struct, [{routing, 11211},
                                                                    {caching, 11311},
                                                                    {kvstore, 11411}]}},
                                                    {name, <<"first_node">>},
                                                    {fqdn, <<"first_node.in.pool.com">>}]},
                                                {struct, [{ipAddress, <<"10.0.1.21">>},
                                                          {status, <<"healthy">>},
                                                          {ports, {struct, [{routing, 11211},
                                                                            {caching, 11311},
                                                                            {kvstore, 11411}]}},
                                                          {uri, <<"/addresses/10.0.1.20">>},
                                                          {name, <<"second_node">>},
                                                          {fqdn, <<"second_node.in.pool.com">>}]}]},
                                  {buckets, [{struct, [{uri, <<"/buckets/4">>},
                                                      {name, <<"Excerciser Application">>}]}]},
                                  {stats, {struct, [{uri, <<"/buckets/4/stats?really_for_pool=1">>}]}},
                                  {name, <<"Default Pool">>}]};
                _ -> {struct, [{nodes, [{struct, [{ipAddress, <<"10.0.1.22">>},
                                                 {uptime, 123321},
                                                 {status, <<"healthy">>},
                                                 {ports, {struct, [{routing, 11211},
                                                                    {caching, 11311},
                                                                    {kvstore, 11411}]}},
                                                 {uri, <<"https://first_node.in.pool.com:80/pool/Another Pool/node/first_node/">>},
                                                 {name, <<"first_node">>},
                                                 {fqdn, <<"first_node.in.pool.com">>}]}, {struct, [{ipAddress, <<"10.0.1.23">>},
                                                                                               {uptime, 123123},
                                                                                               {status, <<"healthy">>},
                                                                                               {ports, {struct, [{routing, 11211},
                                                                                                                  {caching, 11311},
                                                                                                                  {kvstore, 11411}]}},
                                                                                               {uri, <<"https://second_node.in.pool.com:80/pool/Another Pool/node/second_node/">>},
                                                                                               {name, <<"second_node">>},
                                                                                               {fqdn, <<"second_node.in.pool.com">>}]}]},
                               {buckets, [{struct, [{uri, <<"/buckets/5">>},
                                                   {name, <<"Excerciser Another">>}]}]},
                               {stats, {struct, [{uri, <<"/buckets/4/stats?really_for_pool=2">>}]}},
                               {name, <<"Another Pool">>}]}
            end,
      reply_json(Req, Res).
  
  handle_pool_info_streaming(Id, Req) ->
      %% TODO: this shouldn't be timer driven, but rather should register a callback based on some state change in the Erlang OS
      HTTPRes = Req:ok({"application/json; charset=utf-8",
                    [{"Server", "NorthScale menelaus %TODO gitversion%"}],
                    chunked}),
      Res = case Id of
                "default" -> {struct, [{nodes, [{struct, [{ipAddress, <<"10.0.1.20">>},
                                                    {status, <<"healthy">>},
                                                    {ports, {struct, [{routing, 11211},
                                                                    {caching, 11311},
                                                                    {kvstore, 11411}]}},
                                                    {name, <<"first_node">>},
                                                    {fqdn, <<"first_node.in.pool.com">>}]}, {struct, [{ipAddress, <<"10.0.1.21">>},
                                                                                                {status, <<"healthy">>},
                                                                                                {ports, {struct, [{routing, 11211},
                                                                                                                  {caching, 11311},
                                                                                                                  {kvstore, 11411}]}},
                                                                                                {uri, <<"/addresses/10.0.1.20">>},
                                                                                                {name, <<"first_node">>},
                                                                                                {fqdn, <<"first_node.in.pool.com">>}]}]},
                                  {buckets, [{struct, [{uri, <<"/buckets/4">>},
                                                      {name, <<"Excerciser Application">>}]}]},
                                  {stats, {struct, [{uri, <<"/buckets/4/stats?really_for_pool=1">>}]}},
                                  {name, <<"Default Pool">>}]};
                _ -> {struct, [{nodes, [{struct, [{ipAddress, <<"10.0.1.22">>},
                                                 {uptime, 123321},
                                                 {status, <<"healthy">>},
                                                 {ports, {struct, [{routing, 11211},
                                                                    {caching, 11311},
                                                                    {kvstore, 11411}]}},
                                                 {uri, <<"https://first_node.in.pool.com:80/pool/Another Pool/node/first_node/">>},
                                                 {name, <<"first_node">>},
                                                 {fqdn, <<"first_node.in.pool.com">>}]}, {struct, [{ipAddress, <<"10.0.1.23">>},
                                                                                               {uptime, 123123},
                                                                                               {status, <<"healthy">>},
                                                                                               {ports, {struct, [{routing, 11211},
                                                                                                                  {caching, 11311},
                                                                                                                  {kvstore, 11411}]}},
                                                                                               {uri, <<"https://second_node.in.pool.com:80/pool/Another Pool/node/second_node/">>},
                                                                                               {name, <<"second_node">>},
                                                                                               {fqdn, <<"second_node.in.pool.com">>}]}]},
                               {buckets, [{struct, [{uri, <<"/buckets/5">>},
                                                   {name, <<"Excerciser Another">>}]}]},
                               {stats, {struct, [{uri, <<"/buckets/4/stats?really_for_pool=2">>}]}},
                               {name, <<"Another Pool">>}]}
            end,
      HTTPRes:write_chunk(mochijson2:encode(Res)),
      %% TODO: resolve why mochiweb doesn't support zero chunk... this
      %%       indicates the end of a response for now
  
negative.code: 
  -endif.
  
  handle_bucket_stats(_PoolId, Id, Req) ->
      Now = java_date(),
      Params = Req:parse_qs(),
      Res = build_bucket_stats_response(Id, Params, Now),
      reply_json(Req, Res).
  
  
  