From 022aebfacf60fa46cf2cef01028c502b811208a6 Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Mon, 17 Mar 2008 15:27:56 -0700 Subject: [PATCH] Rename the knode functions to match the krpc method names. --- apt_p2p_Khashmir/actions.py | 8 ++++---- apt_p2p_Khashmir/knode.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apt_p2p_Khashmir/actions.py b/apt_p2p_Khashmir/actions.py index 3863f9a..870e37c 100644 --- a/apt_p2p_Khashmir/actions.py +++ b/apt_p2p_Khashmir/actions.py @@ -236,7 +236,7 @@ class ActionBase: class FindNode(ActionBase): """Find the closest nodes to the key.""" - def __init__(self, caller, target, callback, config, stats, action="findNode"): + def __init__(self, caller, target, callback, config, stats, action="find_node"): ActionBase.__init__(self, caller, target, callback, config, stats, action) def processResponse(self, dict): @@ -254,7 +254,7 @@ class FindNode(ActionBase): class FindValue(ActionBase): """Find the closest nodes to the key and check for values.""" - def __init__(self, caller, target, callback, config, stats, action="findValue"): + def __init__(self, caller, target, callback, config, stats, action="find_value"): ActionBase.__init__(self, caller, target, callback, config, stats, action) def processResponse(self, dict): @@ -272,7 +272,7 @@ class FindValue(ActionBase): class GetValue(ActionBase): """Retrieve values from a list of nodes.""" - def __init__(self, caller, target, local_results, num_results, callback, config, stats, action="getValue"): + def __init__(self, caller, target, local_results, num_results, callback, config, stats, action="get_value"): """Initialize the action with the locally available results. @type local_results: C{list} of C{string} @@ -321,7 +321,7 @@ class GetValue(ActionBase): class StoreValue(ActionBase): """Store a value in a list of nodes.""" - def __init__(self, caller, target, value, num_results, callback, config, stats, action="storeValue"): + def __init__(self, caller, target, value, num_results, callback, config, stats, action="store_value"): """Initialize the action with the value to store. @type value: C{string} diff --git a/apt_p2p_Khashmir/knode.py b/apt_p2p_Khashmir/knode.py index e7fb6b3..2e2c9b6 100644 --- a/apt_p2p_Khashmir/knode.py +++ b/apt_p2p_Khashmir/knode.py @@ -43,7 +43,7 @@ class KNodeBase(Node): df.addCallback(self.checkSender) return df - def findNode(self, id, target): + def find_node(self, id, target): """Request the nearest nodes to the target that the node knows about.""" df = self.conn.sendRequest('find_node', {"target" : target, "id": id}) df.addErrback(self.errBack) @@ -53,14 +53,14 @@ class KNodeBase(Node): class KNodeRead(KNodeBase): """More advanced node that can also find and send values.""" - def findValue(self, id, key): + def find_value(self, id, key): """Request the nearest nodes to the key that the node knows about.""" df = self.conn.sendRequest('find_value', {"key" : key, "id" : id}) df.addErrback(self.errBack) df.addCallback(self.checkSender) return df - def getValue(self, id, key, num): + def get_value(self, id, key, num): """Request the values that the node has for the key.""" df = self.conn.sendRequest('get_value', {"key" : key, "num": num, "id" : id}) df.addErrback(self.errBack) @@ -70,7 +70,7 @@ class KNodeRead(KNodeBase): class KNodeWrite(KNodeRead): """Most advanced node that can also store values.""" - def storeValue(self, id, key, value, token): + def store_value(self, id, key, value, token): """Store a value in the node.""" df = self.conn.sendRequest('store_value', {"key" : key, "value" : value, "token" : token, "id": id}) df.addErrback(self.errBack) -- 2.39.5