From 13f85df37d70dddc06419c32dc45ba4d72bc459e Mon Sep 17 00:00:00 2001 From: Graham Percival Date: Tue, 30 Apr 2024 14:46:46 -0700 Subject: [PATCH] Comments: standardize on "response" instead of "reply" Before this commit, the git tree [*] contained: - 5 "reply" - 1 "replies" vs: - 415 "response" - 5 "responses" Clearly "response(s)" are the preferred terms. [*] these counts excluded the tests/python/ directory, since I wasn't careful about naming when I wrote that test code. --- INTERFACES | 2 +- dynamodb-kv/capacity.c | 2 +- lib/wire/wire.h | 4 +-- lib/wire/wire_requestqueue.c | 4 +-- tests/python/kivaloo/proto_kvlds.py | 46 ++++++++++++++--------------- tests/python/kivaloo/proto_lbs.py | 24 +++++++-------- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/INTERFACES b/INTERFACES index 1bb812b8..fdcf16ec 100644 --- a/INTERFACES +++ b/INTERFACES @@ -3,7 +3,7 @@ Kivaloo daemon interfaces Kivaloo components communicate via sockets (either UNIX domain sockets or TCP sockets) using a request-response wire protocol supporting out-of-order -replies. The protocol uses CRCs to provide some error-detection, but has no +responses. The protocol uses CRCs to provide some error-detection, but has no encryption, authentication, or authorization mechanisms; if required, these should be handled externally. diff --git a/dynamodb-kv/capacity.c b/dynamodb-kv/capacity.c index 2ae15c28..ddf975ec 100644 --- a/dynamodb-kv/capacity.c +++ b/dynamodb-kv/capacity.c @@ -243,7 +243,7 @@ capacity_init(const char * key_id, const char * key_secret, if (readmetadata(M)) goto err3; - /* Wait for reply. */ + /* Wait for response. */ if (events_spin(&M->done)) goto err0; diff --git a/lib/wire/wire.h b/lib/wire/wire.h index 3cb1d75e..7be3b289 100644 --- a/lib/wire/wire.h +++ b/lib/wire/wire.h @@ -95,7 +95,7 @@ struct wire_requestqueue * wire_requestqueue_init(int); * a pointer to where the request packet data should be written. This must be * followed by a call to wire_requestqueue_add_done(). * - * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a reply is received, + * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a response is received, * or with resbuf == NULL if the request failed (because it couldn't be sent * or because the connection failed or was destroyed before a response was * received). Note that responses may arrive out-of-order. @@ -114,7 +114,7 @@ int wire_requestqueue_add_done(struct wire_requestqueue *, uint8_t *, size_t); /** * wire_requestqueue_add(Q, buf, buflen, callback, cookie): * Add the ${buflen}-byte request record ${buf} to the request queue ${Q}. - * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a reply is received, + * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a response is received, * or with resbuf == NULL if the request failed (because it couldn't be sent * or because the connection failed or was destroyed before a response was * received). Note that responses may arrive out-of-order. The callback is diff --git a/lib/wire/wire_requestqueue.c b/lib/wire/wire_requestqueue.c index 5d3a69c8..ad5c870f 100644 --- a/lib/wire/wire_requestqueue.c +++ b/lib/wire/wire_requestqueue.c @@ -213,7 +213,7 @@ wire_requestqueue_init(int s) * a pointer to where the request packet data should be written. This must be * followed by a call to wire_requestqueue_add_done(). * - * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a reply is received, + * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a response is received, * or with resbuf == NULL if the request failed (because it couldn't be sent * or because the connection failed or was destroyed before a response was * received). Note that responses may arrive out-of-order. @@ -286,7 +286,7 @@ wire_requestqueue_add_done(struct wire_requestqueue * Q, uint8_t * wbuf, /** * wire_requestqueue_add(Q, buf, buflen, callback, cookie): * Add the ${buflen}-byte request record ${buf} to the request queue ${Q}. - * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a reply is received, + * Invoke ${callback}(${cookie}, resbuf, resbuflen) when a response is received, * or with resbuf == NULL if the request failed (because it couldn't be sent * or because the connection failed or was destroyed before a response was * received). Note that responses may arrive out-of-order. The callback is diff --git a/tests/python/kivaloo/proto_kvlds.py b/tests/python/kivaloo/proto_kvlds.py index c2bdd3be..ee726624 100644 --- a/tests/python/kivaloo/proto_kvlds.py +++ b/tests/python/kivaloo/proto_kvlds.py @@ -46,17 +46,17 @@ def close(self): def params(self): """ Get the block size and next free block. """ - reply = self.wire.send_recv('>I', 0x100) - max_length, max_value = reply.get('>II') + response = self.wire.send_recv('>I', 0x100) + max_length, max_value = response.get('>II') return max_length, max_value def set(self, key, value): """ Set a key/value pair. """ kl_key = kvlds_length_and_bytes(key) kl_value = kvlds_length_and_bytes(value) - reply = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_value)), + response = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_value)), 0x110, kl_key, kl_value) - status = reply.get_int() + status = response.get_int() return status def cas(self, key, oval, value): @@ -64,75 +64,75 @@ def cas(self, key, oval, value): kl_key = kvlds_length_and_bytes(key) kl_oval = kvlds_length_and_bytes(oval) kl_value = kvlds_length_and_bytes(value) - reply = self.wire.send_recv('>I%ds%ds%ds' % (len(kl_key), + response = self.wire.send_recv('>I%ds%ds%ds' % (len(kl_key), len(kl_oval), len(kl_value)), 0x111, kl_key, kl_oval, kl_value) - status = reply.get_int() + status = response.get_int() return status def add(self, key, value): """ Add a key/value pair. """ kl_key = kvlds_length_and_bytes(key) kl_value = kvlds_length_and_bytes(value) - reply = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_value)), + response = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_value)), 0x112, kl_key, kl_value) - status = reply.get_int() + status = response.get_int() return status def modify(self, key, value): """ Modify a key / value pair. """ kl_key = kvlds_length_and_bytes(key) kl_value = kvlds_length_and_bytes(value) - reply = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_value)), + response = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_value)), 0x113, kl_key, kl_value) - status = reply.get_int() + status = response.get_int() return status def delete(self, key): """ Delete a key / value pair. """ kl_key = kvlds_length_and_bytes(key) - reply = self.wire.send_recv('>I%ds' % (len(kl_key)), + response = self.wire.send_recv('>I%ds' % (len(kl_key)), 0x120, kl_key) - status = reply.get_int() + status = response.get_int() return status def cad(self, key, oval): """ Compare and delete. """ kl_key = kvlds_length_and_bytes(key) kl_oval = kvlds_length_and_bytes(oval) - reply = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_oval)), + response = self.wire.send_recv('>I%ds%ds' % (len(kl_key), len(kl_oval)), 0x121, kl_key, kl_oval) - status = reply.get_int() + status = response.get_int() return status def get(self, key): """ Get a value. """ kl_key = kvlds_length_and_bytes(key) - reply = self.wire.send_recv('>I%ds' % (len(kl_key)), 0x130, kl_key) - status = reply.get_int() + response = self.wire.send_recv('>I%ds' % (len(kl_key)), 0x130, kl_key) + status = response.get_int() if status == 1: return status, None - value = reply.get_kvlds_data() + value = response.get_kvlds_data() return status, value def range(self, maxsize, start, end): """ Get a range of key/value pairs. """ kl_start = kvlds_length_and_bytes(start) kl_end = kvlds_length_and_bytes(end) - reply = self.wire.send_recv('>II%ds%ds' % (len(kl_start), len(kl_end)), + response = self.wire.send_recv('>II%ds%ds' % (len(kl_start), len(kl_end)), 0x131, maxsize, kl_start, kl_end) - status = reply.get_int() + status = response.get_int() if status == 1: return status, None, None - num_pairs = reply.get_int() - nextkey = reply.get_kvlds_data() + num_pairs = response.get_int() + nextkey = response.get_kvlds_data() pairs = {} for _ in range(num_pairs): - key = reply.get_kvlds_data() - val = reply.get_kvlds_data() + key = response.get_kvlds_data() + val = response.get_kvlds_data() pairs[key] = val return status, nextkey, pairs diff --git a/tests/python/kivaloo/proto_lbs.py b/tests/python/kivaloo/proto_lbs.py index 485d7f40..b88a0b28 100644 --- a/tests/python/kivaloo/proto_lbs.py +++ b/tests/python/kivaloo/proto_lbs.py @@ -30,23 +30,23 @@ def close(self): def params(self): """ Get the block size and next free block. """ - reply = self.wire.send_recv('>I', 0x00) - block_size, next_block = reply.get('>IQ') + response = self.wire.send_recv('>I', 0x00) + block_size, next_block = response.get('>IQ') return block_size, next_block def params2(self): """ Get the block size, next free block, and the last used block. """ - reply = self.wire.send_recv('>I', 0x04) - block_size, next_block, last_block = reply.get('>IQQ') + response = self.wire.send_recv('>I', 0x04) + block_size, next_block, last_block = response.get('>IQQ') return block_size, next_block, last_block def get(self, blocknum): """ Get data from a block. """ - reply = self.wire.send_recv('>IQ', 0x01, blocknum) - status = reply.get_int() + response = self.wire.send_recv('>IQ', 0x01, blocknum) + status = response.get_int() if status == 1: return status, None - data, = reply.get('>%ds' % (self.block_size)) + data, = response.get('>%ds' % (self.block_size)) return status, data def append(self, nums, start, blocks): @@ -56,18 +56,18 @@ def append(self, nums, start, blocks): if len(blocks) % self.block_size != 0: raise Exception("wire append: Invalid blocksize: %d" % len(blocks)) num_bytes = self.block_size * nums - reply = self.wire.send_recv('>IIQ%ds' % (num_bytes), + response = self.wire.send_recv('>IIQ%ds' % (num_bytes), 0x02, nums, start, blocks) - status = reply.get_int() + status = response.get_int() if status == 1: return status, None - next_block, = reply.get('>Q') + next_block, = response.get('>Q') return status, next_block def free(self, keep_num): """ Indicate that some data can be freed. The server can decide if/when to free those blocks. """ - reply = self.wire.send_recv('>IQ', 0x03, keep_num) - status = reply.get_int() + response = self.wire.send_recv('>IQ', 0x03, keep_num) + status = response.get_int() return status