Skip to content

Commit e82b6ce

Browse files
chore: remove obsolete collection properties (#14)
1 parent 557a3ee commit e82b6ce

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

src/Collection/Collection.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,9 @@ class Collection implements JsonSerializable
127127
* Default values when creating collections
128128
*/
129129
private array $defaults = [
130-
'journalSize' => 1048576,
131130
'replicationFactor' => 1,
132131
'waitForSync' => false,
133-
'doCompact' => true,
134132
'shardingStrategy' => 'community-compat',
135-
'isVolatile' => false,
136133
'shardKeys' => ["_key"],
137134
'numberOfShards' => 1,
138135
'isSystem' => false,
@@ -142,7 +139,6 @@ class Collection implements JsonSerializable
142139
'type' => 'traditional',
143140
'lastValue' => 0
144141
],
145-
'indexBuckets' => 16
146142
];
147143

148144
/**
@@ -501,7 +497,7 @@ public function dropIndex(IndexInterface $index): bool
501497

502498
/**
503499
* Saves or update the collection.
504-
* Except for 'waitForSync', 'journalSize' and 'name', a collection can not be modified after creation.
500+
* Except for 'waitForSync' and 'name', a collection can not be modified after creation.
505501
* For change 'name', the method 'rename' must be used.
506502
*
507503
* @return bool
@@ -596,7 +592,7 @@ public function load(bool $count = true): bool
596592
}
597593

598594
/**
599-
* Find a document by it's key
595+
* Find a document by its key
600596
*
601597
* @param string $key Document key
602598
* @param bool $isVertex If the collection is a vertex in a graph, passing true will return document as Vertex object.
@@ -729,7 +725,6 @@ protected function getUpdateParameters(): array
729725
{
730726
return [
731727
'waitForSync' => $this->attributes['waitForSync'],
732-
'journalSize' => $this->attributes['journalSize']
733728
];
734729
}
735730

@@ -740,7 +735,7 @@ protected function getUpdateParameters(): array
740735
*
741736
* @throws GuzzleException
742737
*/
743-
private function update()
738+
private function update(): bool
744739
{
745740
$uri = Api::buildDatabaseUri($this->connection->getBaseUri(), $this->getDatabase()->getDatabaseName(), Api::COLLECTION);
746741
$response = $this->connection->put(sprintf("%s/%s%s", $uri, $this->getName(), Api::COLLECTION_PROPERTIES), $this->getUpdateParameters());

src/Validation/Collection/CollectionValidator.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,14 @@ public function rules(): array
4141
{
4242
return [
4343
'name' => Rules::string(),
44-
'journalSize' => Rules::integer(),
4544
'replicationFactor' => Rules::equalsOrGreaterThan(1),
4645
'waitForSync' => Rules::boolean(),
47-
'doCompact' => Rules::boolean(),
4846
'shardingStrategy' => Rules::in(['community-compat', 'enterprise-compat', 'enterprise-smart-edge-compat', 'hash', 'enterprise-hash-smart-edge']),
49-
'isVolatile' => Rules::boolean(),
5047
'shardKeys' => Rules::arr(),
5148
'numberOfShards' => Rules::equalsOrGreaterThan(1),
5249
'isSystem' => Rules::boolean(),
5350
'type' => Rules::in([2, 3]),
5451
'keyOptions' => Rules::arr(),
55-
'indexBuckets' => Rules::in([2, 4, 8, 16, 32, 64, 128, 256, 512, 1024])
5652
];
5753
}
5854
}

tests/Collection/CollectionTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public function testGetter()
5555
$this->assertEquals('any', $collection->name);
5656

5757
$this->assertFalse($collection->waitForSync);
58-
$this->assertTrue($collection->doCompact);
5958
$this->assertNull($collection->id);
6059

6160
$this->assertNull($collection->randomProperty);
@@ -66,12 +65,10 @@ public function testSetter()
6665
$collection = new Collection('any', $this->getConnectionObject()->getDatabase());
6766
$this->assertEquals('any', $collection->name);
6867
$collection->waitForSync = true;
69-
$collection->doCompact = false;
7068
$collection->name = 'newAny';
7169

7270
$this->assertNull($collection->id);
7371
$this->assertTrue($collection->waitForSync);
74-
$this->assertFalse($collection->doCompact);
7572
$this->assertEquals('newAny', $collection->name);
7673

7774
$this->assertNull($collection->randomProperty);

tests/Validation/Collection/CollectionValidatorTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ protected function mockCollectionArray(): array
1414
$buckets = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024];
1515
return [
1616
'name' => random_bytes(10),
17-
'journalSize' => rand(1048576, 2097152),
1817
'replicationFactor' => rand(1, 10),
1918
'waitForSync' => (bool)rand(0, 1),
20-
'doCompact' => (bool)rand(0, 1),
2119
'shardingStrategy' => 'community-compat',
22-
'isVolatile' => (bool)rand(0, 1),
2320
'shardKeys' => ["_key"],
2421
'numberOfShards' => rand(1, 10),
2522
'isSystem' => (bool)rand(0, 1),
@@ -29,7 +26,6 @@ protected function mockCollectionArray(): array
2926
'type' => 'traditional',
3027
'lastValue' => 0
3128
],
32-
'indexBuckets' => $buckets[rand(0, 9)]
3329
];
3430
}
3531

0 commit comments

Comments
 (0)