writeDeleteSet = (encoder, ds) => {
  encoding.writeVarUint(encoder.restEncoder, ds.clients.size);
  ds.clients.forEach((dsitems, client) => {
    encoder.resetDsCurVal();
    encoding.writeVarUint(encoder.restEncoder, client);
    const len = dsitems.length;
    encoding.writeVarUint(encoder.restEncoder, len);

    for (let i = 0; i < len; i++) {
      const item = dsitems[i];
      encoder.writeDsClock(item.clock);
      encoder.writeDsLen(item.len);
    }
  });
}
@param {DSEncoderV1 | DSEncoderV2} encoder
@param {DeleteSet} ds

@private
@function