Пример #1
0
 /**
  * @param \Riak\Client\Core\Message\Bucket\PutRequest $request
  *
  * @return \Riak\Client\ProtoBuf\RpbSetBucketReq
  */
 private function createRpbMessage(PutRequest $request)
 {
     $rpbPutReq = new RpbSetBucketReq();
     $rpbProps = new RpbBucketProps();
     $rpbProps->r = $this->encodeQuorum($request->r);
     $rpbProps->w = $this->encodeQuorum($request->w);
     $rpbProps->dw = $this->encodeQuorum($request->dw);
     $rpbProps->rw = $this->encodeQuorum($request->rw);
     $rpbProps->pr = $this->encodeQuorum($request->pr);
     $rpbProps->pw = $this->encodeQuorum($request->pw);
     $rpbProps->n_val = $request->nVal;
     $rpbProps->allow_mult = $request->allowMult;
     $rpbProps->last_write_wins = $request->lastWriteWins;
     $rpbProps->old_vclock = $request->oldVclock;
     $rpbProps->young_vclock = $request->youngVclock;
     $rpbProps->big_vclock = $request->bigVclock;
     $rpbProps->small_vclock = $request->smallVclock;
     $rpbProps->basic_quorum = $request->basicQuorum;
     $rpbProps->notfound_ok = $request->notfoundOk;
     $rpbProps->backend = $request->backend;
     $rpbProps->search = $request->search;
     $rpbProps->search_index = $request->searchIndex;
     $rpbProps->datatype = $request->datatype;
     $rpbProps->consistent = $request->consistent;
     if ($request->linkwalkFunction) {
         $rpbProps->setLinkfun($this->createRpbModFun($request->linkwalkFunction));
     }
     if ($request->chashKeyFunction) {
         $rpbProps->setChashKeyfun($this->createRpbModFun($request->chashKeyFunction));
     }
     foreach ($request->precommitHooks as $hook) {
         $rpbProps->addPrecommit($this->createRpbCommitHook($hook));
     }
     foreach ($request->postcommitHooks as $hook) {
         $rpbProps->addPostcommit($this->createRpbCommitHook($hook));
     }
     $rpbPutReq->setBucket($request->bucket);
     $rpbPutReq->setType($request->type);
     $rpbPutReq->setProps($rpbProps);
     return $rpbPutReq;
 }