[split] Add provides clauses to CSL BUILD files In preparation for publishing with pants, we can now add provides clauses without the build blowing up. NB: pants on master still doesn't publish, but this will help give devprod example libraries to test against.

RB_ID=358451
[split] bump scrooge to 3.15.1-SNAPSHOT

RB_ID=359577
TBR=true
NO-QUEUE=true
[split] Finagle: Blackhole control messages sent to non-mux Thrift clients

Problem
As pointed out in [1], com.twitter.finagle.thriftmux.TTwitterToMux fails
to handle Mux control messages which are sent downstream by
`com.twitter.finagle.mux.Server#close`. These messages have no meaning to
non-mux clients, so there isn't any code in the two
protocol-downgrade ChannelHandlers to deal with them.

Solution
When servicing non-Mux Thrift clients, the ThriftMux Netty server
pipeline will simply satisfy the ChannelFuture associated with any
control messages rather than writing them to the wire. This change also
adds proper message-receipt behavior in the draining state to the Mux
server dispatcher.

[1] https://groups.google.com/forum/#!topic/finaglers/WVZHwgY4-V8

RB_ID=312315
[split] finagle-core: finagle-core: widen type of ClientBuilder#stack

Problem:

Similar to ServerBuilder patch, the narrow type didn't help us and, in fact,
it complicated things.

Solution:

Widen type to Client[Req, Rep]. Note, the failure module transformation
logic now sits in the `codec` method. This means that we only apply
those when using codecs. Arguably, this is no different than
before since there is no guarantee that a StackClient's stack will have
those modules anyways.

RB_ID=359149
[split] finagle-core: StatsReceiver Scaladocs and empty string scoping behavior

Problem
`StatsReceiver.scope` currently allows stats to be scoped by the empty
string, which results in metric names like "srv//blah". This could lead
to inconsistency between stats that are scoped according to dynamic or
consumer-provided strings.

Solution
Check for the empty string in `StatsReceiver.scope` and `.scopeSuffix`.
This change also adds some Scaladocs within StatsReceiver.scala.

RB_ID=358155
[split] finagle-core: widen to type for ServerBuilder#stack

Problem

ServerBuilder#stack required a make function from parameters
to StackServer. The narrow StackServer type didn't buy us
any type safety and, in certain cases, made it difficult to
make protocols compatible with the builders (ex. thriftmux).

Solution

Widen to type of for the stack endpoint to Stack.Params => Server[Req, Rep].
It's up to server implementations to correctly use the parameters passed
through make.

RB_ID=359113
[split] thriftmux: marking a test in EndToEndTest flaky

RB_ID=360517
TBR=true
NO-QUEUE=true
[split] [finagle-core] introduce AbstractResolver

Problem
The Resolver trait contains a default implementation of resolve(),
which prevents it from being cleanly implemented in java.

Solution
Add an abstract class version of Resolver for java compatibility.

RB_ID=361867
[split] finagle-mux: Marked a gc test as flaky

RB_ID=363101
TBR=true
NO-QUEUE=true
[split] finagle-core: Rolls up the /tries scope properly

Problem
The "/tries/" stats scope is mostly symmetric with the "/" stats scope, but it's not rolled up.

Result
The "/tries/" stats scope is rolled up locally.

RB_ID=362077
[split] finagle-thriftmux: add ClientBuilder#stack compatibility and make APIs symmetric

Problem:

There was no API entry point for ThriftMux into ClientBuilder.

Solution:

Implement (Stack.Params => Client[ThriftClientRequest, Array[Byte]]) on
the ThriftMuxClient. Additionally, the API surface area for thriftmux
was becoming unmanageable. This was partly due to the hoops we had to
jump through to make ThriftMuxServer work with ServerBuilder. However,
now that this is simplified, we have an opportunity to make the API
more symmetric and uniform for both ThriftMuxClient/ThriftMuxServer.
Note, instead of using the StackLike variants we have to define
separate ThriftMux{ServerLike/ClientLike} because of the type
conversions from mux to thrift.

RB_ID=359625
TBR=true
[split] finagle-core: remove need for hostConnectionLimit when using ClientBuilder#stack

Problem

Migrating thriftmux to ClientBuilder revealed the following code:

ClientBuilder()
 .stack(ThriftMuxClient)
 .dest(...)
 .hostConnectionLimit(1)
 .build()

Of course, host connection limit is non-sensical in this context.

Solution

Arguably, we shouldn't make any assumptions about the Client created via
the `stack` endpoint. Thus, we can remove type restriction when using the
`stack` API endpoint.

RB_ID=361561
[split] finagle-mux: Modifies MuxService to essentially be a Service[Spool[Buf], Spool[Buf]] Problem

mux does not currently support chunked encoding of requests and responses.

Solution

Use the reserved high bit of the message tag to indicate that a message is to be continued.

Result

You can now stream a request or response using a Spool[Buf].

RB_ID=353023
[split] Problem

The finagle memcache client is currently transforming every "GET" command
in a "GETS" command.

Solution

Fix the mapping, the `get` method is now sending a GET command to
memcachded, the `gets` method stay unchanged.

Signed-off-by: Steve Gury <stevegury@twitter.com>

RB_ID=364141
[split] ServerStatsReceiver and ClientStatsReceiver can now update their root scope

RB_ID=363901
[split] zk2: hold on to your gauges!

The 'gauges' val was not captured the following Var.async closure; use
StatsReceiver#provideGauge instead.

RB_ID=365137
[split] Retrieving a timestamp from the DB nw creates a timestamp in UTC

 Problem:

 When retrieving a timestamp from the DB, timestamp.getTime was returning a different time than that originally stored (local instead of UTC)

 Solution:

 When converting the timestamp string to a timestamp object, it is offset by the local timezone's offset from UTC (converting it to UTC, as desired)

 Result:

 timestamps retrieved from the DB will be in UTC (have a value equal to that which was stored).

RB_ID=361613
[split] finagle-core: fix race case in DelayedFactory

Problem

DelayedFactory can throw set a Promise twice if completion of the underlying factory races with an interrupt to a waiter.
The race occurs when the interrupt observes and retrieves the queue of waiters, then the underlying factory completes, then the element is removed from the queue and set as an exception.

Solution

I've changed the interrupt handler to synchronize before reading the state. An alternative solution to this specific problem is to empty the queue inside of the underlying completion handler, but that still poses the issue that the interrupt handler could be acting on an out of date state.

Result

The Promise is no longer set twice.

RB_ID=365285
[split] finagle-doc: Removed a line from conf.py

Problem

For some docs generation tools, sphinx gives us trouble for bad includes.  links.txt doesn't seem to point anywhere.

Result

sphinx doesn't complain so much

RB_ID=365523
[split] finagle-core: Added Failure support for sourcing to finagle Problem We've started replacing CancelledRequestExceptions with Failures, but CancelledRequestExceptions are SourcedExceptions, and we didn't turn on sourcing Failures properly, so problems involving Failures that are client-specific don't have proper source information, and are difficult to debug.

Solution
Wherever SourcedException is handled, we treat Failures in the same way.  We've added a "service name" key to the `sources` Map.

Result
Client-specific problems should be much easier to debug with finagle.

RB_ID=362019