anchor.diff:      gen_server:start_link(couch_work_queue, Options, []).
   
   
  +queue(Wq, Item) when is_binary(Item) ->
  +    gen_server:call(Wq, {queue, Item, byte_size(Item)}, infinity);
   queue(Wq, Item) ->
  -    gen_server:call(Wq, {queue, Item}, infinity).
  +    gen_server:call(Wq, {queue, Item, byte_size(?term_to_bin(Item))}, infinity).
   
   
   dequeue(Wq) ->
  
positive.code: 
  -module(couch_work_queue).
  -behaviour(gen_server).
  
  % public API
  -export([new/1, queue/2, dequeue/1, dequeue/2, close/1]).
  
negative.code:     #q{
          queue = Queue,
          items = Count,
          size = Size,
          close_on_dequeue = Close,
          blocked = Blocked
      } = Q,
      case (Max =:= all) orelse (Max >= Count) of
      false ->
          {Items, Size2, Queue2, Blocked2} = dequeue_items(
              Max, Size, Queue, Blocked, []),
          Q2 = Q#q{
              items = Count - Max, size = Size2, blocked = Blocked2, queue = Queue2
          },
          {reply, {ok, Items}, Q2};
      true ->
          lists:foreach(fun(F) -> gen_server:reply(F, ok) end, Blocked),
          Q2 = Q#q{items = 0, size = 0, blocked = [], queue = queue:new()},
          Items = [Item || {Item, _} <- queue:to_list(Queue)],
          case Close of
          false ->
              {reply, {ok, Items}, Q2};
          true ->
              {stop, normal, {ok, Items}, Q2}
          end
      end.
  
  
  dequeue_items(0, Size, Queue, Blocked, DequeuedAcc) ->
      {lists:reverse(DequeuedAcc), Size, Queue, Blocked};
  
  dequeue_items(NumItems, Size, Queue, Blocked, DequeuedAcc) ->
      {{value, {Item, ItemSize}}, Queue2} = queue:out(Queue),
      case Blocked of
      [] ->
          Blocked2 = Blocked;
      [From | Blocked2] ->
          gen_server:reply(From, ok)
      end,
      dequeue_items(
          NumItems - 1, Size - ItemSize, Queue2, Blocked2, [Item | DequeuedAcc]).
      
  
  handle_cast(close, #q{items = 0} = Q) ->
  