Skip to content

Commit 9172fc4

Browse files
committed
[CLIENT-2219] Remove docs for deprecated aerospike operator constants
* aerospike_helpers.operations should be used instead * Update some tests to use aerospike_helpers instead of aerospike operator constants
1 parent 55f8a5b commit 9172fc4

File tree

5 files changed

+21
-46
lines changed

5 files changed

+21
-46
lines changed

doc/aerospike.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -679,19 +679,6 @@ Only the `hosts` key is required; the rest of the keys are optional.
679679
Constants
680680
=========
681681
682-
.. _aerospike_operators:
683-
684-
Operators
685-
---------
686-
687-
Operators for the single-record, multi-operation transaction method :py:meth:`Client.operate`.
688-
689-
.. note::
690-
691-
Starting version 3.4.0, it is highly recommended to use the :ref:`aerospike_operation_helpers.operations` \
692-
to create the arguments for :py:meth:`Client.operate` and :py:meth:`Client.operate_ordered`
693-
Old style operators are deprecated. The docs for old style operators were removed in client 6.0.0.
694-
695682
Policy Options
696683
--------------
697684

test/new_tests/test_compress.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def test_operate_with_compress_policy(self):
8585
}
8686

8787
llist = [
88-
{"op": aerospike.OPERATOR_APPEND, "bin": "name", "val": "aa"},
89-
{"op": aerospike.OPERATOR_INCR, "bin": "age", "val": 3},
90-
{"op": aerospike.OPERATOR_READ, "bin": "name"},
88+
operations.append("name", "aa"),
89+
operations.increment("age", 3),
90+
operations.read("name")
9191
]
9292

9393
key, _, bins = self.as_connection.operate(key, llist, {}, policy)

test/new_tests/test_geospatial.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .as_status_codes import AerospikeStatus
66
from aerospike import exception as e
77
from aerospike import predicates as p
8+
from aerospike_helpers.operations import operations
89
import time
910

1011
import aerospike
@@ -472,8 +473,8 @@ def test_geospatial_operate_positive(self):
472473
geo_object_operate = aerospike.GeoJSON({"type": "Point", "coordinates": [43.45, 56.75]})
473474
key = ("test", "demo", "single_geo_operate")
474475
llist = [
475-
{"op": aerospike.OPERATOR_WRITE, "bin": "write_bin", "val": {"no": geo_object_operate}},
476-
{"op": aerospike.OPERATOR_READ, "bin": "write_bin"},
476+
operations.write("write_bin", {"no": geo_object_operate}),
477+
operations.read("write_bin")
477478
]
478479

479480
key, _, bins = self.as_connection.operate(key, llist)

test/new_tests/test_operate_map.py

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
import aerospike
88
from aerospike import exception as e
9-
from aerospike_helpers.operations import map_operations as map_ops
9+
from aerospike_helpers.operations import operations
10+
from aerospike_helpers.operations import map_operations
1011

1112
# aerospike.OP_MAP_SET_POLICY
1213
# aerospike.OP_MAP_PUT
@@ -58,8 +59,8 @@ def setup(self, request, as_connection):
5859
self.test_map_bin = "test_map"
5960
key_order_policy = {"map_order": aerospike.MAP_KEY_ORDERED}
6061
ops = [
61-
map_ops.map_put_items(bin_name="test_map", item_dict=test_map, map_policy=key_order_policy),
62-
map_ops.map_put_items(bin_name="test_map2", item_dict=test_map, map_policy=key_order_policy)
62+
map_operations.map_put_items(bin_name="test_map", item_dict=test_map, map_policy=key_order_policy),
63+
map_operations.map_put_items(bin_name="test_map2", item_dict=test_map, map_policy=key_order_policy)
6364
]
6465
as_connection.operate(key, ops)
6566

@@ -436,13 +437,8 @@ def test_map_remove_by_key_ret_key_val_test_with_list_read_odd(self):
436437
self.test_map.copy()
437438
self.as_connection.put(self.test_map_key, {"cool_list": [1, 2, 3]})
438439
ops = [
439-
{"op": aerospike.OPERATOR_READ, "bin": "cool_list"},
440-
{
441-
"op": aerospike.OP_MAP_REMOVE_BY_KEY,
442-
"bin": self.test_map_bin,
443-
"key": "c",
444-
"return_type": aerospike.MAP_RETURN_KEY_VALUE,
445-
},
440+
operations.read("cool_list"),
441+
map_operations.map_remove_by_key(self.test_map_bin, "c", aerospike.MAP_RETURN_KEY_VALUE)
446442
]
447443

448444
_, _, bins = self.as_connection.operate(self.test_map_key, ops)
@@ -452,26 +448,16 @@ def test_map_remove_by_key_ret_key_val_test_with_list_read_even(self):
452448
self.test_map.copy()
453449
self.as_connection.put(self.test_map_key, {"cool_list": [1, 2, 3, 4]})
454450
ops = [
455-
{"op": aerospike.OPERATOR_READ, "bin": "cool_list"},
456-
{
457-
"op": aerospike.OP_MAP_REMOVE_BY_KEY,
458-
"bin": self.test_map_bin,
459-
"key": "c",
460-
"return_type": aerospike.MAP_RETURN_KEY_VALUE,
461-
},
451+
operations.read("cool_list"),
452+
map_operations.map_remove_by_key(self.test_map_bin, "c", aerospike.MAP_RETURN_KEY_VALUE)
462453
]
463454

464455
_, _, bins = self.as_connection.operate(self.test_map_key, ops)
465456
assert bins["cool_list"] == [1, 2, 3, 4]
466457

467458
@pytest.mark.parametrize("entry", ("bin", "key"))
468459
def test_map_remove_by_key_missing_required_entries(self, entry):
469-
op = {
470-
"op": aerospike.OP_MAP_REMOVE_BY_KEY,
471-
"bin": self.test_map_bin,
472-
"key": "c",
473-
"return_type": aerospike.MAP_RETURN_KEY_VALUE,
474-
}
460+
op = map_operations.map_remove_by_key(self.test_map_bin, "c", aerospike.MAP_RETURN_KEY_VALUE)
475461

476462
del op[entry]
477463
ops = [op]

test/new_tests/test_operate_ordered.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import aerospike
66
from aerospike import exception as e
7+
from aerospike_helpers.operations import operations
78

89

910
class TestOperateOrdered(object):
@@ -75,17 +76,17 @@ def teardown():
7576
(
7677
("test", "demo", 1),
7778
[
78-
{"op": aerospike.OPERATOR_PREPEND, "bin": "name", "val": "ram"},
79-
{"op": aerospike.OPERATOR_INCR, "bin": "age", "val": 3},
80-
{"op": aerospike.OPERATOR_READ, "bin": "name"},
79+
operations.prepend("name", "ram"),
80+
operations.increment("age", 3),
81+
operations.read("name")
8182
],
8283
[("name", "ramname1")],
8384
),
8485
(
8586
("test", "demo", 1), # with_write_float_value
8687
[
87-
{"op": aerospike.OPERATOR_WRITE, "bin": "write_bin", "val": {"no": 89.8}},
88-
{"op": aerospike.OPERATOR_READ, "bin": "write_bin"},
88+
operations.write("write_bin", {"no": 89.8}),
89+
operations.read("write_bin")
8990
],
9091
[("write_bin", {"no": 89.8})],
9192
),

0 commit comments

Comments
 (0)