Skip to content

Commit

Permalink
Comments: standardize on "response" instead of "reply"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gperciva committed Apr 30, 2024
1 parent 90e4ba2 commit 13f85df
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion INTERFACES
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion dynamodb-kv/capacity.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lib/wire/wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/wire/wire_requestqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
46 changes: 23 additions & 23 deletions tests/python/kivaloo/proto_kvlds.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,93 +46,93 @@ 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):
""" Compare-and-swap. """
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
24 changes: 12 additions & 12 deletions tests/python/kivaloo/proto_lbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

0 comments on commit 13f85df

Please sign in to comment.