glide_shared.routes
SlotType
Bases: Enum
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
15 16 17 18 19 20 21 22 23 24 25 26 27 | |
PRIMARY = 1
class-attribute
instance-attribute
Address a primary node.
REPLICA = 2
class-attribute
instance-attribute
Address a replica node.
REPLICA overrides the read_from_replica configuration. If it's used the request
will be routed to a replica, even if the strategy is ALWAYS_FROM_MASTER.
AllNodes
Bases: Route
Route request to all nodes.
Warning
Don't use it with write commands, they could be routed to a replica (RO) node and fail.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
38 39 40 41 42 43 44 45 46 | |
AllPrimaries
Bases: Route
Route request to all primary nodes.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
49 50 51 52 53 54 | |
RandomNode
Bases: Route
Route request to a random node.
Warning
Don't use it with write commands, because they could be randomly routed to a replica (RO) node and fail.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
57 58 59 60 61 62 63 64 65 | |
SlotKeyRoute
Bases: Route
Routes a request to a node by its slot key
Attributes:
| Name | Type | Description |
|---|---|---|
slot_type |
SlotType
|
Defines type of the node being addressed. |
slot_key |
str
|
The request will be sent to nodes managing this key. |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
68 69 70 71 72 73 74 75 76 77 78 79 | |
SlotIdRoute
Bases: Route
Routes a request to a node by its slot ID
Attributes:
| Name | Type | Description |
|---|---|---|
slot_type |
SlotType
|
Defines type of the node being addressed. |
slot_id |
int
|
Slot number. There are 16384 slots in a Valkey cluster, and each shard
manages a slot range. Unless the slot is known, it's better to route using
|
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
ByAddressRoute
Bases: Route
Routes a request to a node by its address
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
The endpoint of the node. If |
port |
Optional[int]
|
The port to access on the node. If port is not provided, |
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/routes.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |