Skip to content

Commit

Permalink
finagle/finagle-memcache: Remove unused TwemcachePartitionedClient trait
Browse files Browse the repository at this point in the history
Problem

This trait is unused.

Solution

Remove it.

Differential Revision: https://phabricator.twitter.biz/D1178943
  • Loading branch information
jcrossley authored and jenkins committed Oct 25, 2024
1 parent 4feb34c commit eb41122
Showing 1 changed file with 2 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import com.twitter.finagle.memcached.protocol.Stored
import com.twitter.finagle.memcached.protocol.Exists
import com.twitter.finagle.Service
import com.twitter.io.Buf
import com.twitter.util.{Future, Time}
import com.twitter.util.Future
import com.twitter.util.Time

// Client interface supporting twemcache commands
trait TwemcacheClient extends Client {
Expand Down Expand Up @@ -120,37 +121,3 @@ object TwemcacheClient {
}
}
}

/**
* Twemcache commands implementation for a partitioned client.
* This trait can only be mixed into a PartitionedClient that is delegating twemcache compatible clients.
*/
trait TwemcachePartitionedClient extends TwemcacheClient { self: PartitionedClient =>

// For now we require the PartitionedClient must be delegating TwemcacheClient.
protected[memcached] def twemcacheClientOf(key: String): TwemcacheClient =
clientOf(key).asInstanceOf[TwemcacheClient]

def getvResult(keys: Iterable[String]): Future[GetsResult] = {
if (keys.nonEmpty) {
withKeysGroupedByClient(keys) {
_.getvResult(_)
}.map { GetResult.merged }
} else {
Future.value(GetsResult(GetResult()))
}
}

def upsert(key: String, flags: Int, expiry: Time, value: Buf, version: Buf): Future[JBoolean] =
twemcacheClientOf(key).upsert(key, flags, expiry, value, version)

private[this] def withKeysGroupedByClient[A](
keys: Iterable[String]
)(
f: (TwemcacheClient, Iterable[String]) => Future[A]
): Future[Seq[A]] = {
Future.collect(
keys.groupBy(twemcacheClientOf).iterator.map(Function.tupled(f)).toSeq
)
}
}

0 comments on commit eb41122

Please sign in to comment.