Esempio n. 1
0
 private function storeArticleCrdt($key, $data)
 {
     $location = new RiakLocation($this->namespace, $key);
     $store = StoreMap::builder()->withLocation($location)->updateMap('author', $data['author'])->updateRegister('name', $data['name'])->updateSet('category', $data['category'])->updateSet('set', $data['category'])->build();
     $this->client->execute($store);
     $this->insureIsIndexed($key);
 }
Esempio n. 2
0
 public function testBuildCommand()
 {
     $counter = new CounterUpdate();
     $builder = StoreMap::builder($this->location, [])->withLocation($this->location)->withContext('context-hash')->removeMap('map_key_remove')->removeSet('set_key_remove')->removeFlag('flag_key_remove')->removeCounter('map_counter_remove')->removeRegister('map_register_remove')->updateMap('map_key', MapUpdate::create())->updateSet('set_key', SetUpdate::create())->updateRegister('map_register', 'foo')->updateCounter('map_counter', 1)->updateFlag('flag_key', true)->withContext('context-hash')->withReturnBody(true)->withDw(1)->withPw(2)->withW(3);
     $counter->withDelta(1);
     $builder->updateCounter('other_counter', $counter);
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\StoreMap', $builder->build());
 }
Esempio n. 3
0
 public function testUpdateMapUsingContext()
 {
     $storeRespose1 = $this->client->execute(StoreMap::builder()->withIncludeContext(true)->withReturnBody(true)->withLocation($this->location)->updateRegister('username', 'FabioBatSilva')->updateFlag('active', false)->build());
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\Response\\StoreMapResponse', $storeRespose1);
     $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Crdt\\RiakMap', $storeRespose1->getDataType());
     $this->assertInternalType('string', $storeRespose1->getContext());
     $store2Response = $this->client->execute(StoreMap::builder()->withIncludeContext(true)->withReturnBody(true)->withContext($storeRespose1->getContext())->withLocation($this->location)->updateCounter('clicks', 1)->updateFlag('active', true)->build());
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\Response\\StoreMapResponse', $store2Response);
     $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Crdt\\RiakMap', $store2Response->getDataType());
     $this->assertInternalType('string', $store2Response->getContext());
     $fetchResponse = $this->client->execute(FetchMap::builder()->withIncludeContext(true)->withLocation($this->location)->build());
     $this->assertInstanceOf('Riak\\Client\\Command\\DataType\\Response\\FetchMapResponse', $fetchResponse);
     $this->assertInstanceOf('Riak\\Client\\Core\\Query\\Crdt\\RiakMap', $fetchResponse->getDataType());
     $this->assertInternalType('string', $fetchResponse->getContext());
 }