Durability

class couchbase.durability.ClientDurability(replicate_to: ReplicateTo = ReplicateTo.NONE, persist_to: PersistTo | PersistToExtended = PersistTo.NONE)

Durability the SDK confirms by polling the nodes after a write.

Parameters:
  • replicate_to (ReplicateTo, optional) – How many replicas must hold the mutation. Defaults to ReplicateTo.NONE.

  • persist_to (PersistTo | PersistToExtended, optional) – How many nodes must have written the mutation to disk. Defaults to PersistTo.NONE.

property persist_to: PersistTo | PersistToExtended

How many nodes must have written the mutation to disk.

property replicate_to: ReplicateTo

How many replicas must hold the mutation.

class couchbase.durability.Durability(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

DEPRECATED The durability levels.

Deprecated since version 4.0.0: Use DurabilityLevel instead.

MAJORITY = 1
MAJORITY_AND_PERSIST_TO_ACTIVE = 2
NONE = 0
PERSIST_TO_MAJORITY = 3
class couchbase.durability.DurabilityLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

How durable the server makes a mutation before it acknowledges it.

MAJORITY holds the mutation in memory on a majority of the bucket’s nodes. MAJORITY_AND_PERSIST_TO_ACTIVE also writes it to disk on the active node, and PERSIST_TO_MAJORITY writes it to disk on a majority. NONE asks for no durability.

MAJORITY = 1
MAJORITY_AND_PERSIST_TO_ACTIVE = 2
NONE = 0
PERSIST_TO_MAJORITY = 3
classmethod from_server_str(value: str) → DurabilityLevel

DEPRECATED The level Couchbase Server named, NONE for a name it does not know.

Deprecated since version 4.7.0: The SDK returns a DurabilityLevel member wherever it reads a durability level from the server.

couchbase.durability.DurabilityType = couchbase.common.durability.ClientDurability | couchbase.common.durability.ServerDurability

Represent a PEP 604 union type

E.g. for int | str

class couchbase.durability.PersistTo(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

How many nodes must have written a mutation to disk before the SDK reports it done.

The SDK confirms it by polling the nodes after the write. PersistToExtended has the same members and also ACTIVE and FOUR.

NONE = 0
ONE = 2
THREE = 4
TWO = 3
class couchbase.durability.PersistToExtended(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

How many nodes must have written a mutation to disk before the SDK reports it done.

ACTIVE is the node holding the active copy, and FOUR is the active node and all three replicas.

ACTIVE = 1
FOUR = 5
NONE = 0
ONE = 2
THREE = 4
TWO = 3
class couchbase.durability.ReplicateTo(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

How many replicas a mutation must reach before the SDK reports it done.

The SDK confirms it by polling the replicas after the write.

NONE = 0
ONE = 1
THREE = 3
TWO = 2
class couchbase.durability.ServerDurability(level: DurabilityLevel)
class couchbase.durability.ServerDurability(level: Durability)

Durability the server applies before it acknowledges a write.

Parameters:

level (DurabilityLevel) – How durable the server makes the mutation.

property level: DurabilityLevel

How durable the server makes the mutation.