@@ -301,14 +301,33 @@ def response_handler(resp: Response) -> Json:
301
301
return self ._execute (request , response_handler )
302
302
303
303
def configure (
304
- self , sync : Optional [bool ] = None , schema : Optional [Json ] = None
304
+ self ,
305
+ sync : Optional [bool ] = None ,
306
+ schema : Optional [Json ] = None ,
307
+ replication_factor : Optional [int ] = None ,
308
+ write_concern : Optional [int ] = None
305
309
) -> Result [Json ]:
306
310
"""Configure collection properties.
307
311
308
312
:param sync: Block until operations are synchronized to disk.
309
313
:type sync: bool | None
310
314
:param schema: document schema for validation of objects.
311
315
:type schema: dict
316
+ :param replication_factor: Number of copies of each shard on different
317
+ servers in a cluster. Allowed values are 1 (only one copy is kept
318
+ and no synchronous replication), and n (n-1 replicas are kept and
319
+ any two copies are replicated across servers synchronously, meaning
320
+ every write to the master is copied to all slaves before operation
321
+ is reported successful).
322
+ :type replication_factor: int
323
+ :param write_concern: Write concern for the collection. Determines how
324
+ many copies of each shard are required to be in sync on different
325
+ DBServers. If there are less than these many copies in the cluster
326
+ a shard will refuse to write. Writes to shards with enough
327
+ up-to-date copies will succeed at the same time. The value of this
328
+ parameter cannot be larger than that of **replication_factor**.
329
+ Default value is 1. Used for clusters only.
330
+ :type write_concern: int
312
331
:return: New collection properties.
313
332
:rtype: dict
314
333
:raise arango.exceptions.CollectionConfigureError: If operation fails.
@@ -318,6 +337,10 @@ def configure(
318
337
data ["waitForSync" ] = sync
319
338
if schema is not None :
320
339
data ["schema" ] = schema
340
+ if replication_factor is not None :
341
+ data ["replicationFactor" ] = replication_factor
342
+ if write_concern is not None :
343
+ data ["writeConcern" ] = write_concern
321
344
322
345
request = Request (
323
346
method = "put" ,
0 commit comments