Ejemplo n.º 1
0
                     $newHead = Db\Op::addOpsArray($esId, $memberId, $ops);
                     $response["result"] = 'added';
                     $response["head_seq"] = $newHead ? $newHead : $currentHead;
                 } else {
                     // no incoming ops (just checking for new ops...)
                     $response["result"] = 'new_ops';
                     $response["ops"] = array();
                     $response["head_seq"] = $currentHead;
                 }
             } else {
                 // HEADs do not match
                 $response["ops"] = $op->getOpsAfterJson($esId, $seqHead);
                 $response["head_seq"] = $currentHead;
                 $response["result"] = $hasOps ? 'conflict' : 'new_ops';
             }
             $inactiveMembers = $member->updateByTimeout($esId);
             foreach ($inactiveMembers as $inactive) {
                 $op->removeCursor($esId, $inactive);
                 $op->removeMember($esId, $inactive);
             }
         } else {
             // Error - no seq_head passed
             throw new BadRequestException();
         }
         break;
     default:
         $ex = new BadRequestException();
         $ex->setBody($request->getRawRequest());
         throw $ex;
         break;
 }