id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
234,200
hyperledger/indy-plenum
plenum/common/batched.py
Batched._enqueueIntoAllRemotes
def _enqueueIntoAllRemotes(self, msg: Any, signer: Signer) -> None: """ Enqueue the specified message into all the remotes in the nodestack. :param msg: the message to enqueue """ for rid in self.remotes.keys(): self._enqueue(msg, rid, signer)
python
def _enqueueIntoAllRemotes(self, msg: Any, signer: Signer) -> None: """ Enqueue the specified message into all the remotes in the nodestack. :param msg: the message to enqueue """ for rid in self.remotes.keys(): self._enqueue(msg, rid, signer)
[ "def", "_enqueueIntoAllRemotes", "(", "self", ",", "msg", ":", "Any", ",", "signer", ":", "Signer", ")", "->", "None", ":", "for", "rid", "in", "self", ".", "remotes", ".", "keys", "(", ")", ":", "self", ".", "_enqueue", "(", "msg", ",", "rid", ","...
Enqueue the specified message into all the remotes in the nodestack. :param msg: the message to enqueue
[ "Enqueue", "the", "specified", "message", "into", "all", "the", "remotes", "in", "the", "nodestack", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/batched.py#L47-L54
234,201
hyperledger/indy-plenum
plenum/common/batched.py
Batched.send
def send(self, msg: Any, * rids: Iterable[int], signer: Signer = None, message_splitter=None) -> None: """ Enqueue the given message into the outBoxes of the specified remotes or into the outBoxes of all the remotes if rids is None :pa...
python
def send(self, msg: Any, * rids: Iterable[int], signer: Signer = None, message_splitter=None) -> None: """ Enqueue the given message into the outBoxes of the specified remotes or into the outBoxes of all the remotes if rids is None :pa...
[ "def", "send", "(", "self", ",", "msg", ":", "Any", ",", "*", "rids", ":", "Iterable", "[", "int", "]", ",", "signer", ":", "Signer", "=", "None", ",", "message_splitter", "=", "None", ")", "->", "None", ":", "# Signing (if required) and serializing before...
Enqueue the given message into the outBoxes of the specified remotes or into the outBoxes of all the remotes if rids is None :param msg: the message to enqueue :param rids: ids of the remotes to whose outBoxes this message must be enqueued :param message_splitter: callable t...
[ "Enqueue", "the", "given", "message", "into", "the", "outBoxes", "of", "the", "specified", "remotes", "or", "into", "the", "outBoxes", "of", "all", "the", "remotes", "if", "rids", "is", "None" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/batched.py#L56-L88
234,202
hyperledger/indy-plenum
plenum/common/batched.py
Batched.flushOutBoxes
def flushOutBoxes(self) -> None: """ Clear the outBoxes and transmit batched messages to remotes. """ removedRemotes = [] for rid, msgs in self.outBoxes.items(): try: dest = self.remotes[rid].name except KeyError: removedRem...
python
def flushOutBoxes(self) -> None: """ Clear the outBoxes and transmit batched messages to remotes. """ removedRemotes = [] for rid, msgs in self.outBoxes.items(): try: dest = self.remotes[rid].name except KeyError: removedRem...
[ "def", "flushOutBoxes", "(", "self", ")", "->", "None", ":", "removedRemotes", "=", "[", "]", "for", "rid", ",", "msgs", "in", "self", ".", "outBoxes", ".", "items", "(", ")", ":", "try", ":", "dest", "=", "self", ".", "remotes", "[", "rid", "]", ...
Clear the outBoxes and transmit batched messages to remotes.
[ "Clear", "the", "outBoxes", "and", "transmit", "batched", "messages", "to", "remotes", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/batched.py#L90-L147
234,203
hyperledger/indy-plenum
stp_core/loop/looper.py
Looper.prodAllOnce
async def prodAllOnce(self): """ Call `prod` once for each Prodable in this Looper :return: the sum of the number of events executed successfully """ # TODO: looks like limit is always None??? limit = None s = 0 for n in self.prodables: s += a...
python
async def prodAllOnce(self): """ Call `prod` once for each Prodable in this Looper :return: the sum of the number of events executed successfully """ # TODO: looks like limit is always None??? limit = None s = 0 for n in self.prodables: s += a...
[ "async", "def", "prodAllOnce", "(", "self", ")", ":", "# TODO: looks like limit is always None???", "limit", "=", "None", "s", "=", "0", "for", "n", "in", "self", ".", "prodables", ":", "s", "+=", "await", "n", ".", "prod", "(", "limit", ")", "return", "...
Call `prod` once for each Prodable in this Looper :return: the sum of the number of events executed successfully
[ "Call", "prod", "once", "for", "each", "Prodable", "in", "this", "Looper" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L142-L153
234,204
hyperledger/indy-plenum
stp_core/loop/looper.py
Looper.add
def add(self, prodable: Prodable) -> None: """ Add one Prodable object to this Looper's list of Prodables :param prodable: the Prodable object to add """ if prodable.name in [p.name for p in self.prodables]: raise ProdableAlreadyAdded("Prodable {} already added.". ...
python
def add(self, prodable: Prodable) -> None: """ Add one Prodable object to this Looper's list of Prodables :param prodable: the Prodable object to add """ if prodable.name in [p.name for p in self.prodables]: raise ProdableAlreadyAdded("Prodable {} already added.". ...
[ "def", "add", "(", "self", ",", "prodable", ":", "Prodable", ")", "->", "None", ":", "if", "prodable", ".", "name", "in", "[", "p", ".", "name", "for", "p", "in", "self", ".", "prodables", "]", ":", "raise", "ProdableAlreadyAdded", "(", "\"Prodable {} ...
Add one Prodable object to this Looper's list of Prodables :param prodable: the Prodable object to add
[ "Add", "one", "Prodable", "object", "to", "this", "Looper", "s", "list", "of", "Prodables" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L155-L166
234,205
hyperledger/indy-plenum
stp_core/loop/looper.py
Looper.removeProdable
def removeProdable(self, prodable: Prodable=None, name: str=None) -> Optional[Prodable]: """ Remove the specified Prodable object from this Looper's list of Prodables :param prodable: the Prodable to remove """ if prodable: self.prodables.remove(prodable) ...
python
def removeProdable(self, prodable: Prodable=None, name: str=None) -> Optional[Prodable]: """ Remove the specified Prodable object from this Looper's list of Prodables :param prodable: the Prodable to remove """ if prodable: self.prodables.remove(prodable) ...
[ "def", "removeProdable", "(", "self", ",", "prodable", ":", "Prodable", "=", "None", ",", "name", ":", "str", "=", "None", ")", "->", "Optional", "[", "Prodable", "]", ":", "if", "prodable", ":", "self", ".", "prodables", ".", "remove", "(", "prodable"...
Remove the specified Prodable object from this Looper's list of Prodables :param prodable: the Prodable to remove
[ "Remove", "the", "specified", "Prodable", "object", "from", "this", "Looper", "s", "list", "of", "Prodables" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L168-L189
234,206
hyperledger/indy-plenum
stp_core/loop/looper.py
Looper.runOnceNicely
async def runOnceNicely(self): """ Execute `runOnce` with a small tolerance of 0.01 seconds so that the Prodables can complete their other asynchronous tasks not running on the event-loop. """ start = time.perf_counter() msgsProcessed = await self.prodAllOnce() if...
python
async def runOnceNicely(self): """ Execute `runOnce` with a small tolerance of 0.01 seconds so that the Prodables can complete their other asynchronous tasks not running on the event-loop. """ start = time.perf_counter() msgsProcessed = await self.prodAllOnce() if...
[ "async", "def", "runOnceNicely", "(", "self", ")", ":", "start", "=", "time", ".", "perf_counter", "(", ")", "msgsProcessed", "=", "await", "self", ".", "prodAllOnce", "(", ")", "if", "msgsProcessed", "==", "0", ":", "# if no let other stuff run", "await", "...
Execute `runOnce` with a small tolerance of 0.01 seconds so that the Prodables can complete their other asynchronous tasks not running on the event-loop.
[ "Execute", "runOnce", "with", "a", "small", "tolerance", "of", "0", ".", "01", "seconds", "so", "that", "the", "Prodables", "can", "complete", "their", "other", "asynchronous", "tasks", "not", "running", "on", "the", "event", "-", "loop", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L204-L217
234,207
hyperledger/indy-plenum
stp_core/loop/looper.py
Looper.run
def run(self, *coros: CoroWrapper): """ Runs an arbitrary list of coroutines in order and then quits the loop, if not running as a context manager. """ if not self.running: raise RuntimeError("not running!") async def wrapper(): results = [] ...
python
def run(self, *coros: CoroWrapper): """ Runs an arbitrary list of coroutines in order and then quits the loop, if not running as a context manager. """ if not self.running: raise RuntimeError("not running!") async def wrapper(): results = [] ...
[ "def", "run", "(", "self", ",", "*", "coros", ":", "CoroWrapper", ")", ":", "if", "not", "self", ".", "running", ":", "raise", "RuntimeError", "(", "\"not running!\"", ")", "async", "def", "wrapper", "(", ")", ":", "results", "=", "[", "]", "for", "c...
Runs an arbitrary list of coroutines in order and then quits the loop, if not running as a context manager.
[ "Runs", "an", "arbitrary", "list", "of", "coroutines", "in", "order", "and", "then", "quits", "the", "loop", "if", "not", "running", "as", "a", "context", "manager", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L229-L263
234,208
hyperledger/indy-plenum
stp_core/loop/looper.py
Looper.shutdown
async def shutdown(self): """ Shut down this Looper. """ logger.display("Looper shutting down now...", extra={"cli": False}) self.running = False start = time.perf_counter() if not self.runFut.done(): await self.runFut self.stopall() lo...
python
async def shutdown(self): """ Shut down this Looper. """ logger.display("Looper shutting down now...", extra={"cli": False}) self.running = False start = time.perf_counter() if not self.runFut.done(): await self.runFut self.stopall() lo...
[ "async", "def", "shutdown", "(", "self", ")", ":", "logger", ".", "display", "(", "\"Looper shutting down now...\"", ",", "extra", "=", "{", "\"cli\"", ":", "False", "}", ")", "self", ".", "running", "=", "False", "start", "=", "time", ".", "perf_counter",...
Shut down this Looper.
[ "Shut", "down", "this", "Looper", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L271-L287
234,209
hyperledger/indy-plenum
plenum/bls/bls_bft_factory.py
create_default_bls_bft_factory
def create_default_bls_bft_factory(node): ''' Creates a default BLS factory to instantiate BLS BFT classes. :param node: Node instance :return: BLS factory instance ''' bls_keys_dir = os.path.join(node.keys_dir, node.name) bls_crypto_factory = create_default_bls_crypto_factory(bls_keys_dir)...
python
def create_default_bls_bft_factory(node): ''' Creates a default BLS factory to instantiate BLS BFT classes. :param node: Node instance :return: BLS factory instance ''' bls_keys_dir = os.path.join(node.keys_dir, node.name) bls_crypto_factory = create_default_bls_crypto_factory(bls_keys_dir)...
[ "def", "create_default_bls_bft_factory", "(", "node", ")", ":", "bls_keys_dir", "=", "os", ".", "path", ".", "join", "(", "node", ".", "keys_dir", ",", "node", ".", "name", ")", "bls_crypto_factory", "=", "create_default_bls_crypto_factory", "(", "bls_keys_dir", ...
Creates a default BLS factory to instantiate BLS BFT classes. :param node: Node instance :return: BLS factory instance
[ "Creates", "a", "default", "BLS", "factory", "to", "instantiate", "BLS", "BFT", "classes", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/bls/bls_bft_factory.py#L32-L41
234,210
hyperledger/indy-plenum
stp_core/crypto/nacl_wrappers.py
SigningKey.sign
def sign(self, message, encoder=encoding.RawEncoder): """ Sign a message using this key. :param message: [:class:`bytes`] The data to be signed. :param encoder: A class that is used to encode the signed message. :rtype: :class:`~SignedMessage` """ raw_signed = li...
python
def sign(self, message, encoder=encoding.RawEncoder): """ Sign a message using this key. :param message: [:class:`bytes`] The data to be signed. :param encoder: A class that is used to encode the signed message. :rtype: :class:`~SignedMessage` """ raw_signed = li...
[ "def", "sign", "(", "self", ",", "message", ",", "encoder", "=", "encoding", ".", "RawEncoder", ")", ":", "raw_signed", "=", "libnacl", ".", "crypto_sign", "(", "message", ",", "self", ".", "_signing_key", ")", "signature", "=", "encoder", ".", "encode", ...
Sign a message using this key. :param message: [:class:`bytes`] The data to be signed. :param encoder: A class that is used to encode the signed message. :rtype: :class:`~SignedMessage`
[ "Sign", "a", "message", "using", "this", "key", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/crypto/nacl_wrappers.py#L162-L176
234,211
hyperledger/indy-plenum
stp_core/crypto/nacl_wrappers.py
Verifier.verify
def verify(self, signature, msg): ''' Verify the message ''' if not self.key: return False try: self.key.verify(signature + msg) except ValueError: return False return True
python
def verify(self, signature, msg): ''' Verify the message ''' if not self.key: return False try: self.key.verify(signature + msg) except ValueError: return False return True
[ "def", "verify", "(", "self", ",", "signature", ",", "msg", ")", ":", "if", "not", "self", ".", "key", ":", "return", "False", "try", ":", "self", ".", "key", ".", "verify", "(", "signature", "+", "msg", ")", "except", "ValueError", ":", "return", ...
Verify the message
[ "Verify", "the", "message" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/crypto/nacl_wrappers.py#L232-L242
234,212
hyperledger/indy-plenum
stp_core/crypto/nacl_wrappers.py
Box.encrypt
def encrypt(self, plaintext, nonce, encoder=encoding.RawEncoder): """ Encrypts the plaintext message using the given `nonce` and returns the ciphertext encoded with the encoder. .. warning:: It is **VITALLY** important that the nonce is a nonce, i.e. it is a number used only...
python
def encrypt(self, plaintext, nonce, encoder=encoding.RawEncoder): """ Encrypts the plaintext message using the given `nonce` and returns the ciphertext encoded with the encoder. .. warning:: It is **VITALLY** important that the nonce is a nonce, i.e. it is a number used only...
[ "def", "encrypt", "(", "self", ",", "plaintext", ",", "nonce", ",", "encoder", "=", "encoding", ".", "RawEncoder", ")", ":", "if", "len", "(", "nonce", ")", "!=", "self", ".", "NONCE_SIZE", ":", "raise", "ValueError", "(", "\"The nonce must be exactly %s byt...
Encrypts the plaintext message using the given `nonce` and returns the ciphertext encoded with the encoder. .. warning:: It is **VITALLY** important that the nonce is a nonce, i.e. it is a number used only once for any given key. If you fail to do this, you compromise the privac...
[ "Encrypts", "the", "plaintext", "message", "using", "the", "given", "nonce", "and", "returns", "the", "ciphertext", "encoded", "with", "the", "encoder", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/crypto/nacl_wrappers.py#L357-L388
234,213
hyperledger/indy-plenum
stp_core/crypto/nacl_wrappers.py
Box.decrypt
def decrypt(self, ciphertext, nonce=None, encoder=encoding.RawEncoder): """ Decrypts the ciphertext using the given nonce and returns the plaintext message. :param ciphertext: [:class:`bytes`] The encrypted message to decrypt :param nonce: [:class:`bytes`] The nonce used when en...
python
def decrypt(self, ciphertext, nonce=None, encoder=encoding.RawEncoder): """ Decrypts the ciphertext using the given nonce and returns the plaintext message. :param ciphertext: [:class:`bytes`] The encrypted message to decrypt :param nonce: [:class:`bytes`] The nonce used when en...
[ "def", "decrypt", "(", "self", ",", "ciphertext", ",", "nonce", "=", "None", ",", "encoder", "=", "encoding", ".", "RawEncoder", ")", ":", "# Decode our ciphertext", "ciphertext", "=", "encoder", ".", "decode", "(", "ciphertext", ")", "if", "nonce", "is", ...
Decrypts the ciphertext using the given nonce and returns the plaintext message. :param ciphertext: [:class:`bytes`] The encrypted message to decrypt :param nonce: [:class:`bytes`] The nonce used when encrypting the ciphertext :param encoder: The encoder used to decode the c...
[ "Decrypts", "the", "ciphertext", "using", "the", "given", "nonce", "and", "returns", "the", "plaintext", "message", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/crypto/nacl_wrappers.py#L390-L419
234,214
hyperledger/indy-plenum
stp_core/crypto/nacl_wrappers.py
Privateer.decrypt
def decrypt(self, cipher, nonce, pubkey, dehex=False): ''' Return decrypted msg contained in cypher using nonce and shared key generated from .key and pubkey. If pubkey is hex encoded it is converted first If dehex is True then use HexEncoder otherwise use RawEncoder Int...
python
def decrypt(self, cipher, nonce, pubkey, dehex=False): ''' Return decrypted msg contained in cypher using nonce and shared key generated from .key and pubkey. If pubkey is hex encoded it is converted first If dehex is True then use HexEncoder otherwise use RawEncoder Int...
[ "def", "decrypt", "(", "self", ",", "cipher", ",", "nonce", ",", "pubkey", ",", "dehex", "=", "False", ")", ":", "if", "not", "isinstance", "(", "pubkey", ",", "PublicKey", ")", ":", "if", "len", "(", "pubkey", ")", "==", "32", ":", "pubkey", "=", ...
Return decrypted msg contained in cypher using nonce and shared key generated from .key and pubkey. If pubkey is hex encoded it is converted first If dehex is True then use HexEncoder otherwise use RawEncoder Intended for the owner of .key cypher is string nonce is stri...
[ "Return", "decrypted", "msg", "contained", "in", "cypher", "using", "nonce", "and", "shared", "key", "generated", "from", ".", "key", "and", "pubkey", ".", "If", "pubkey", "is", "hex", "encoded", "it", "is", "converted", "first", "If", "dehex", "is", "True...
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/crypto/nacl_wrappers.py#L496-L518
234,215
hyperledger/indy-plenum
plenum/common/config_util.py
getInstalledConfig
def getInstalledConfig(installDir, configFile): """ Reads config from the installation directory of Plenum. :param installDir: installation directory of Plenum :param configFile: name of the configuration file :raises: FileNotFoundError :return: the configuration as a python object """ ...
python
def getInstalledConfig(installDir, configFile): """ Reads config from the installation directory of Plenum. :param installDir: installation directory of Plenum :param configFile: name of the configuration file :raises: FileNotFoundError :return: the configuration as a python object """ ...
[ "def", "getInstalledConfig", "(", "installDir", ",", "configFile", ")", ":", "configPath", "=", "os", ".", "path", ".", "join", "(", "installDir", ",", "configFile", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "configPath", ")", ":", "raise"...
Reads config from the installation directory of Plenum. :param installDir: installation directory of Plenum :param configFile: name of the configuration file :raises: FileNotFoundError :return: the configuration as a python object
[ "Reads", "config", "from", "the", "installation", "directory", "of", "Plenum", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/config_util.py#L11-L27
234,216
hyperledger/indy-plenum
plenum/common/config_util.py
_getConfig
def _getConfig(general_config_dir: str = None): """ Reads a file called config.py in the project directory :raises: FileNotFoundError :return: the configuration as a python object """ stp_config = STPConfig() plenum_config = import_module("plenum.config") config = stp_config config....
python
def _getConfig(general_config_dir: str = None): """ Reads a file called config.py in the project directory :raises: FileNotFoundError :return: the configuration as a python object """ stp_config = STPConfig() plenum_config = import_module("plenum.config") config = stp_config config....
[ "def", "_getConfig", "(", "general_config_dir", ":", "str", "=", "None", ")", ":", "stp_config", "=", "STPConfig", "(", ")", "plenum_config", "=", "import_module", "(", "\"plenum.config\"", ")", "config", "=", "stp_config", "config", ".", "__dict__", ".", "upd...
Reads a file called config.py in the project directory :raises: FileNotFoundError :return: the configuration as a python object
[ "Reads", "a", "file", "called", "config", ".", "py", "in", "the", "project", "directory" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/config_util.py#L68-L95
234,217
hyperledger/indy-plenum
plenum/server/router.py
Router.getFunc
def getFunc(self, o: Any) -> Callable: """ Get the next function from the list of routes that is capable of processing o's type. :param o: the object to process :return: the next function """ for cls, func in self.routes.items(): if isinstance(o, cls)...
python
def getFunc(self, o: Any) -> Callable: """ Get the next function from the list of routes that is capable of processing o's type. :param o: the object to process :return: the next function """ for cls, func in self.routes.items(): if isinstance(o, cls)...
[ "def", "getFunc", "(", "self", ",", "o", ":", "Any", ")", "->", "Callable", ":", "for", "cls", ",", "func", "in", "self", ".", "routes", ".", "items", "(", ")", ":", "if", "isinstance", "(", "o", ",", "cls", ")", ":", "return", "func", "logger", ...
Get the next function from the list of routes that is capable of processing o's type. :param o: the object to process :return: the next function
[ "Get", "the", "next", "function", "from", "the", "list", "of", "routes", "that", "is", "capable", "of", "processing", "o", "s", "type", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/router.py#L46-L60
234,218
hyperledger/indy-plenum
plenum/server/router.py
Router.handleSync
def handleSync(self, msg: Any) -> Any: """ Pass the message as an argument to the function defined in `routes`. If the msg is a tuple, pass the values as multiple arguments to the function. :param msg: tuple of object and callable """ # If a plain python tuple and not a ...
python
def handleSync(self, msg: Any) -> Any: """ Pass the message as an argument to the function defined in `routes`. If the msg is a tuple, pass the values as multiple arguments to the function. :param msg: tuple of object and callable """ # If a plain python tuple and not a ...
[ "def", "handleSync", "(", "self", ",", "msg", ":", "Any", ")", "->", "Any", ":", "# If a plain python tuple and not a named tuple, a better alternative", "# would be to create a named entity with the 3 characteristics below", "# TODO: non-obvious tuple, re-factor!", "if", "isinstance...
Pass the message as an argument to the function defined in `routes`. If the msg is a tuple, pass the values as multiple arguments to the function. :param msg: tuple of object and callable
[ "Pass", "the", "message", "as", "an", "argument", "to", "the", "function", "defined", "in", "routes", ".", "If", "the", "msg", "is", "a", "tuple", "pass", "the", "values", "as", "multiple", "arguments", "to", "the", "function", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/router.py#L63-L77
234,219
hyperledger/indy-plenum
plenum/server/router.py
Router.handle
async def handle(self, msg: Any) -> Any: """ Handle both sync and async functions. :param msg: a message :return: the result of execution of the function corresponding to this message's type """ res = self.handleSync(msg) if isawaitable(res): return a...
python
async def handle(self, msg: Any) -> Any: """ Handle both sync and async functions. :param msg: a message :return: the result of execution of the function corresponding to this message's type """ res = self.handleSync(msg) if isawaitable(res): return a...
[ "async", "def", "handle", "(", "self", ",", "msg", ":", "Any", ")", "->", "Any", ":", "res", "=", "self", ".", "handleSync", "(", "msg", ")", "if", "isawaitable", "(", "res", ")", ":", "return", "await", "res", "else", ":", "return", "res" ]
Handle both sync and async functions. :param msg: a message :return: the result of execution of the function corresponding to this message's type
[ "Handle", "both", "sync", "and", "async", "functions", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/router.py#L79-L90
234,220
hyperledger/indy-plenum
plenum/server/router.py
Router.handleAll
async def handleAll(self, deq: deque, limit=None) -> int: """ Handle all items in a deque. Can call asynchronous handlers. :param deq: a deque of items to be handled by this router :param limit: the number of items in the deque to the handled :return: the number of items handled...
python
async def handleAll(self, deq: deque, limit=None) -> int: """ Handle all items in a deque. Can call asynchronous handlers. :param deq: a deque of items to be handled by this router :param limit: the number of items in the deque to the handled :return: the number of items handled...
[ "async", "def", "handleAll", "(", "self", ",", "deq", ":", "deque", ",", "limit", "=", "None", ")", "->", "int", ":", "count", "=", "0", "while", "deq", "and", "(", "not", "limit", "or", "count", "<", "limit", ")", ":", "count", "+=", "1", "item"...
Handle all items in a deque. Can call asynchronous handlers. :param deq: a deque of items to be handled by this router :param limit: the number of items in the deque to the handled :return: the number of items handled successfully
[ "Handle", "all", "items", "in", "a", "deque", ".", "Can", "call", "asynchronous", "handlers", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/router.py#L92-L105
234,221
hyperledger/indy-plenum
plenum/server/router.py
Router.handleAllSync
def handleAllSync(self, deq: deque, limit=None) -> int: """ Synchronously handle all items in a deque. :param deq: a deque of items to be handled by this router :param limit: the number of items in the deque to the handled :return: the number of items handled successfully ...
python
def handleAllSync(self, deq: deque, limit=None) -> int: """ Synchronously handle all items in a deque. :param deq: a deque of items to be handled by this router :param limit: the number of items in the deque to the handled :return: the number of items handled successfully ...
[ "def", "handleAllSync", "(", "self", ",", "deq", ":", "deque", ",", "limit", "=", "None", ")", "->", "int", ":", "count", "=", "0", "while", "deq", "and", "(", "not", "limit", "or", "count", "<", "limit", ")", ":", "count", "+=", "1", "msg", "=",...
Synchronously handle all items in a deque. :param deq: a deque of items to be handled by this router :param limit: the number of items in the deque to the handled :return: the number of items handled successfully
[ "Synchronously", "handle", "all", "items", "in", "a", "deque", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/router.py#L107-L120
234,222
hyperledger/indy-plenum
ledger/compact_merkle_tree.py
CompactMerkleTree.load
def load(self, other: merkle_tree.MerkleTree): """Load this tree from a dumb data object for serialisation. The object must have attributes tree_size:int and hashes:list. """ self._update(other.tree_size, other.hashes)
python
def load(self, other: merkle_tree.MerkleTree): """Load this tree from a dumb data object for serialisation. The object must have attributes tree_size:int and hashes:list. """ self._update(other.tree_size, other.hashes)
[ "def", "load", "(", "self", ",", "other", ":", "merkle_tree", ".", "MerkleTree", ")", ":", "self", ".", "_update", "(", "other", ".", "tree_size", ",", "other", ".", "hashes", ")" ]
Load this tree from a dumb data object for serialisation. The object must have attributes tree_size:int and hashes:list.
[ "Load", "this", "tree", "from", "a", "dumb", "data", "object", "for", "serialisation", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/compact_merkle_tree.py#L47-L52
234,223
hyperledger/indy-plenum
ledger/compact_merkle_tree.py
CompactMerkleTree.save
def save(self, other: merkle_tree.MerkleTree): """Save this tree into a dumb data object for serialisation. The object must have attributes tree_size:int and hashes:list. """ other.__tree_size = self.__tree_size other.__hashes = self.__hashes
python
def save(self, other: merkle_tree.MerkleTree): """Save this tree into a dumb data object for serialisation. The object must have attributes tree_size:int and hashes:list. """ other.__tree_size = self.__tree_size other.__hashes = self.__hashes
[ "def", "save", "(", "self", ",", "other", ":", "merkle_tree", ".", "MerkleTree", ")", ":", "other", ".", "__tree_size", "=", "self", ".", "__tree_size", "other", ".", "__hashes", "=", "self", ".", "__hashes" ]
Save this tree into a dumb data object for serialisation. The object must have attributes tree_size:int and hashes:list.
[ "Save", "this", "tree", "into", "a", "dumb", "data", "object", "for", "serialisation", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/compact_merkle_tree.py#L54-L60
234,224
hyperledger/indy-plenum
ledger/compact_merkle_tree.py
CompactMerkleTree.append
def append(self, new_leaf: bytes) -> List[bytes]: """Append a new leaf onto the end of this tree and return the audit path""" auditPath = list(reversed(self.__hashes)) self._push_subtree([new_leaf]) return auditPath
python
def append(self, new_leaf: bytes) -> List[bytes]: """Append a new leaf onto the end of this tree and return the audit path""" auditPath = list(reversed(self.__hashes)) self._push_subtree([new_leaf]) return auditPath
[ "def", "append", "(", "self", ",", "new_leaf", ":", "bytes", ")", "->", "List", "[", "bytes", "]", ":", "auditPath", "=", "list", "(", "reversed", "(", "self", ".", "__hashes", ")", ")", "self", ".", "_push_subtree", "(", "[", "new_leaf", "]", ")", ...
Append a new leaf onto the end of this tree and return the audit path
[ "Append", "a", "new", "leaf", "onto", "the", "end", "of", "this", "tree", "and", "return", "the", "audit", "path" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/compact_merkle_tree.py#L155-L160
234,225
hyperledger/indy-plenum
ledger/compact_merkle_tree.py
CompactMerkleTree.extend
def extend(self, new_leaves: List[bytes]): """Extend this tree with new_leaves on the end. The algorithm works by using _push_subtree() as a primitive, calling it with the maximum number of allowed leaves until we can add the remaining leaves as a valid entire (non-full) subtree in one ...
python
def extend(self, new_leaves: List[bytes]): """Extend this tree with new_leaves on the end. The algorithm works by using _push_subtree() as a primitive, calling it with the maximum number of allowed leaves until we can add the remaining leaves as a valid entire (non-full) subtree in one ...
[ "def", "extend", "(", "self", ",", "new_leaves", ":", "List", "[", "bytes", "]", ")", ":", "size", "=", "len", "(", "new_leaves", ")", "final_size", "=", "self", ".", "tree_size", "+", "size", "idx", "=", "0", "while", "True", ":", "# keep pushing subt...
Extend this tree with new_leaves on the end. The algorithm works by using _push_subtree() as a primitive, calling it with the maximum number of allowed leaves until we can add the remaining leaves as a valid entire (non-full) subtree in one go.
[ "Extend", "this", "tree", "with", "new_leaves", "on", "the", "end", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/compact_merkle_tree.py#L162-L185
234,226
hyperledger/indy-plenum
ledger/compact_merkle_tree.py
CompactMerkleTree.extended
def extended(self, new_leaves: List[bytes]): """Returns a new tree equal to this tree extended with new_leaves.""" new_tree = self.__copy__() new_tree.extend(new_leaves) return new_tree
python
def extended(self, new_leaves: List[bytes]): """Returns a new tree equal to this tree extended with new_leaves.""" new_tree = self.__copy__() new_tree.extend(new_leaves) return new_tree
[ "def", "extended", "(", "self", ",", "new_leaves", ":", "List", "[", "bytes", "]", ")", ":", "new_tree", "=", "self", ".", "__copy__", "(", ")", "new_tree", ".", "extend", "(", "new_leaves", ")", "return", "new_tree" ]
Returns a new tree equal to this tree extended with new_leaves.
[ "Returns", "a", "new", "tree", "equal", "to", "this", "tree", "extended", "with", "new_leaves", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/compact_merkle_tree.py#L187-L191
234,227
hyperledger/indy-plenum
ledger/compact_merkle_tree.py
CompactMerkleTree.verify_consistency
def verify_consistency(self, expected_leaf_count) -> bool: """ Check that the tree has same leaf count as expected and the number of nodes are also as expected """ if expected_leaf_count != self.leafCount: raise ConsistencyVerificationFailed() if self.get_expe...
python
def verify_consistency(self, expected_leaf_count) -> bool: """ Check that the tree has same leaf count as expected and the number of nodes are also as expected """ if expected_leaf_count != self.leafCount: raise ConsistencyVerificationFailed() if self.get_expe...
[ "def", "verify_consistency", "(", "self", ",", "expected_leaf_count", ")", "->", "bool", ":", "if", "expected_leaf_count", "!=", "self", ".", "leafCount", ":", "raise", "ConsistencyVerificationFailed", "(", ")", "if", "self", ".", "get_expected_node_count", "(", "...
Check that the tree has same leaf count as expected and the number of nodes are also as expected
[ "Check", "that", "the", "tree", "has", "same", "leaf", "count", "as", "expected", "and", "the", "number", "of", "nodes", "are", "also", "as", "expected" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/compact_merkle_tree.py#L280-L289
234,228
hyperledger/indy-plenum
state/util/utils.py
isHex
def isHex(val: str) -> bool: """ Return whether the given str represents a hex value or not :param val: the string to check :return: whether the given str represents a hex value """ if isinstance(val, bytes): # only decodes utf-8 string try: val = val.decode() ...
python
def isHex(val: str) -> bool: """ Return whether the given str represents a hex value or not :param val: the string to check :return: whether the given str represents a hex value """ if isinstance(val, bytes): # only decodes utf-8 string try: val = val.decode() ...
[ "def", "isHex", "(", "val", ":", "str", ")", "->", "bool", ":", "if", "isinstance", "(", "val", ",", "bytes", ")", ":", "# only decodes utf-8 string", "try", ":", "val", "=", "val", ".", "decode", "(", ")", "except", "ValueError", ":", "return", "False...
Return whether the given str represents a hex value or not :param val: the string to check :return: whether the given str represents a hex value
[ "Return", "whether", "the", "given", "str", "represents", "a", "hex", "value", "or", "not" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/state/util/utils.py#L80-L93
234,229
hyperledger/indy-plenum
plenum/common/latency_measurements.py
EMALatencyMeasurementForEachClient._accumulate
def _accumulate(self, old_accum, next_val): """ Implement exponential moving average """ return old_accum * (1 - self.alpha) + next_val * self.alpha
python
def _accumulate(self, old_accum, next_val): """ Implement exponential moving average """ return old_accum * (1 - self.alpha) + next_val * self.alpha
[ "def", "_accumulate", "(", "self", ",", "old_accum", ",", "next_val", ")", ":", "return", "old_accum", "*", "(", "1", "-", "self", ".", "alpha", ")", "+", "next_val", "*", "self", ".", "alpha" ]
Implement exponential moving average
[ "Implement", "exponential", "moving", "average" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/latency_measurements.py#L36-L40
234,230
hyperledger/indy-plenum
ledger/hash_stores/hash_store.py
HashStore.getNodePosition
def getNodePosition(cls, start, height=None) -> int: """ Calculates node position based on start and height :param start: The sequence number of the first leaf under this tree. :param height: Height of this node in the merkle tree :return: the node's position """ ...
python
def getNodePosition(cls, start, height=None) -> int: """ Calculates node position based on start and height :param start: The sequence number of the first leaf under this tree. :param height: Height of this node in the merkle tree :return: the node's position """ ...
[ "def", "getNodePosition", "(", "cls", ",", "start", ",", "height", "=", "None", ")", "->", "int", ":", "pwr", "=", "highest_bit_set", "(", "start", ")", "-", "1", "height", "=", "height", "or", "pwr", "if", "count_bits_set", "(", "start", ")", "==", ...
Calculates node position based on start and height :param start: The sequence number of the first leaf under this tree. :param height: Height of this node in the merkle tree :return: the node's position
[ "Calculates", "node", "position", "based", "on", "start", "and", "height" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/hash_stores/hash_store.py#L88-L104
234,231
hyperledger/indy-plenum
ledger/hash_stores/hash_store.py
HashStore.getPath
def getPath(cls, seqNo, offset=0): """ Get the audit path of the leaf at the position specified by serNo. :param seqNo: sequence number of the leaf to calculate the path for :param offset: the sequence number of the node from where the path should begin. :return: tuple ...
python
def getPath(cls, seqNo, offset=0): """ Get the audit path of the leaf at the position specified by serNo. :param seqNo: sequence number of the leaf to calculate the path for :param offset: the sequence number of the node from where the path should begin. :return: tuple ...
[ "def", "getPath", "(", "cls", ",", "seqNo", ",", "offset", "=", "0", ")", ":", "if", "offset", ">=", "seqNo", ":", "raise", "ValueError", "(", "\"Offset should be less than serial number\"", ")", "pwr", "=", "highest_bit_set", "(", "seqNo", "-", "1", "-", ...
Get the audit path of the leaf at the position specified by serNo. :param seqNo: sequence number of the leaf to calculate the path for :param offset: the sequence number of the node from where the path should begin. :return: tuple of leafs and nodes
[ "Get", "the", "audit", "path", "of", "the", "leaf", "at", "the", "position", "specified", "by", "serNo", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/hash_stores/hash_store.py#L107-L127
234,232
hyperledger/indy-plenum
ledger/hash_stores/hash_store.py
HashStore.readNodeByTree
def readNodeByTree(self, start, height=None): """ Fetches nodeHash based on start leaf and height of the node in the tree. :return: the nodeHash """ pos = self.getNodePosition(start, height) return self.readNode(pos)
python
def readNodeByTree(self, start, height=None): """ Fetches nodeHash based on start leaf and height of the node in the tree. :return: the nodeHash """ pos = self.getNodePosition(start, height) return self.readNode(pos)
[ "def", "readNodeByTree", "(", "self", ",", "start", ",", "height", "=", "None", ")", ":", "pos", "=", "self", ".", "getNodePosition", "(", "start", ",", "height", ")", "return", "self", ".", "readNode", "(", "pos", ")" ]
Fetches nodeHash based on start leaf and height of the node in the tree. :return: the nodeHash
[ "Fetches", "nodeHash", "based", "on", "start", "leaf", "and", "height", "of", "the", "node", "in", "the", "tree", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/hash_stores/hash_store.py#L129-L136
234,233
hyperledger/indy-plenum
ledger/hash_stores/hash_store.py
HashStore.is_consistent
def is_consistent(self) -> bool: """ Returns True if number of nodes are consistent with number of leaves """ from ledger.compact_merkle_tree import CompactMerkleTree return self.nodeCount == CompactMerkleTree.get_expected_node_count( self.leafCount)
python
def is_consistent(self) -> bool: """ Returns True if number of nodes are consistent with number of leaves """ from ledger.compact_merkle_tree import CompactMerkleTree return self.nodeCount == CompactMerkleTree.get_expected_node_count( self.leafCount)
[ "def", "is_consistent", "(", "self", ")", "->", "bool", ":", "from", "ledger", ".", "compact_merkle_tree", "import", "CompactMerkleTree", "return", "self", ".", "nodeCount", "==", "CompactMerkleTree", ".", "get_expected_node_count", "(", "self", ".", "leafCount", ...
Returns True if number of nodes are consistent with number of leaves
[ "Returns", "True", "if", "number", "of", "nodes", "are", "consistent", "with", "number", "of", "leaves" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/hash_stores/hash_store.py#L139-L145
234,234
hyperledger/indy-plenum
storage/chunked_file_store.py
ChunkedFileStore._startNextChunk
def _startNextChunk(self) -> None: """ Close current and start next chunk """ if self.currentChunk is None: self._useLatestChunk() else: self._useChunk(self.currentChunkIndex + self.chunkSize)
python
def _startNextChunk(self) -> None: """ Close current and start next chunk """ if self.currentChunk is None: self._useLatestChunk() else: self._useChunk(self.currentChunkIndex + self.chunkSize)
[ "def", "_startNextChunk", "(", "self", ")", "->", "None", ":", "if", "self", ".", "currentChunk", "is", "None", ":", "self", ".", "_useLatestChunk", "(", ")", "else", ":", "self", ".", "_useChunk", "(", "self", ".", "currentChunkIndex", "+", "self", ".",...
Close current and start next chunk
[ "Close", "current", "and", "start", "next", "chunk" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/storage/chunked_file_store.py#L108-L115
234,235
hyperledger/indy-plenum
storage/chunked_file_store.py
ChunkedFileStore.get
def get(self, key) -> str: """ Determines the file to retrieve the data from and retrieves the data. :return: value corresponding to specified key """ # TODO: get is creating files when a key is given which is more than # the store size chunk_no, offset = self._g...
python
def get(self, key) -> str: """ Determines the file to retrieve the data from and retrieves the data. :return: value corresponding to specified key """ # TODO: get is creating files when a key is given which is more than # the store size chunk_no, offset = self._g...
[ "def", "get", "(", "self", ",", "key", ")", "->", "str", ":", "# TODO: get is creating files when a key is given which is more than", "# the store size", "chunk_no", ",", "offset", "=", "self", ".", "_get_key_location", "(", "key", ")", "with", "self", ".", "_openCh...
Determines the file to retrieve the data from and retrieves the data. :return: value corresponding to specified key
[ "Determines", "the", "file", "to", "retrieve", "the", "data", "from", "and", "retrieves", "the", "data", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/storage/chunked_file_store.py#L168-L178
234,236
hyperledger/indy-plenum
storage/chunked_file_store.py
ChunkedFileStore.reset
def reset(self) -> None: """ Clear all data in file storage. """ self.close() for f in os.listdir(self.dataDir): os.remove(os.path.join(self.dataDir, f)) self._useLatestChunk()
python
def reset(self) -> None: """ Clear all data in file storage. """ self.close() for f in os.listdir(self.dataDir): os.remove(os.path.join(self.dataDir, f)) self._useLatestChunk()
[ "def", "reset", "(", "self", ")", "->", "None", ":", "self", ".", "close", "(", ")", "for", "f", "in", "os", ".", "listdir", "(", "self", ".", "dataDir", ")", ":", "os", ".", "remove", "(", "os", ".", "path", ".", "join", "(", "self", ".", "d...
Clear all data in file storage.
[ "Clear", "all", "data", "in", "file", "storage", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/storage/chunked_file_store.py#L180-L187
234,237
hyperledger/indy-plenum
storage/chunked_file_store.py
ChunkedFileStore._listChunks
def _listChunks(self): """ Lists stored chunks :return: sorted list of available chunk indices """ chunks = [] for fileName in os.listdir(self.dataDir): index = ChunkedFileStore._fileNameToChunkIndex(fileName) if index is not None: ...
python
def _listChunks(self): """ Lists stored chunks :return: sorted list of available chunk indices """ chunks = [] for fileName in os.listdir(self.dataDir): index = ChunkedFileStore._fileNameToChunkIndex(fileName) if index is not None: ...
[ "def", "_listChunks", "(", "self", ")", ":", "chunks", "=", "[", "]", "for", "fileName", "in", "os", ".", "listdir", "(", "self", ".", "dataDir", ")", ":", "index", "=", "ChunkedFileStore", ".", "_fileNameToChunkIndex", "(", "fileName", ")", "if", "index...
Lists stored chunks :return: sorted list of available chunk indices
[ "Lists", "stored", "chunks" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/storage/chunked_file_store.py#L216-L227
234,238
hyperledger/indy-plenum
plenum/server/primary_decider.py
PrimaryDecider.filterMsgs
def filterMsgs(self, wrappedMsgs: deque) -> deque: """ Filters messages by view number so that only the messages that have the current view number are retained. :param wrappedMsgs: the messages to filter """ filtered = deque() while wrappedMsgs: wrapp...
python
def filterMsgs(self, wrappedMsgs: deque) -> deque: """ Filters messages by view number so that only the messages that have the current view number are retained. :param wrappedMsgs: the messages to filter """ filtered = deque() while wrappedMsgs: wrapp...
[ "def", "filterMsgs", "(", "self", ",", "wrappedMsgs", ":", "deque", ")", "->", "deque", ":", "filtered", "=", "deque", "(", ")", "while", "wrappedMsgs", ":", "wrappedMsg", "=", "wrappedMsgs", ".", "popleft", "(", ")", "msg", ",", "sender", "=", "wrappedM...
Filters messages by view number so that only the messages that have the current view number are retained. :param wrappedMsgs: the messages to filter
[ "Filters", "messages", "by", "view", "number", "so", "that", "only", "the", "messages", "that", "have", "the", "current", "view", "number", "are", "retained", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/primary_decider.py#L74-L97
234,239
hyperledger/indy-plenum
plenum/server/plugin_loader.py
PluginLoader.get
def get(self, name): """Retrieve a plugin by name.""" try: return self.plugins[name] except KeyError: raise RuntimeError("plugin {} does not exist".format(name))
python
def get(self, name): """Retrieve a plugin by name.""" try: return self.plugins[name] except KeyError: raise RuntimeError("plugin {} does not exist".format(name))
[ "def", "get", "(", "self", ",", "name", ")", ":", "try", ":", "return", "self", ".", "plugins", "[", "name", "]", "except", "KeyError", ":", "raise", "RuntimeError", "(", "\"plugin {} does not exist\"", ".", "format", "(", "name", ")", ")" ]
Retrieve a plugin by name.
[ "Retrieve", "a", "plugin", "by", "name", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/plugin_loader.py#L65-L70
234,240
hyperledger/indy-plenum
common/version.py
VersionBase.cmp
def cmp(cls, v1: 'VersionBase', v2: 'VersionBase') -> int: """ Compares two instances. """ # TODO types checking if v1._version > v2._version: return 1 elif v1._version == v2._version: return 0 else: return -1
python
def cmp(cls, v1: 'VersionBase', v2: 'VersionBase') -> int: """ Compares two instances. """ # TODO types checking if v1._version > v2._version: return 1 elif v1._version == v2._version: return 0 else: return -1
[ "def", "cmp", "(", "cls", ",", "v1", ":", "'VersionBase'", ",", "v2", ":", "'VersionBase'", ")", "->", "int", ":", "# TODO types checking", "if", "v1", ".", "_version", ">", "v2", ".", "_version", ":", "return", "1", "elif", "v1", ".", "_version", "=="...
Compares two instances.
[ "Compares", "two", "instances", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/common/version.py#L39-L47
234,241
hyperledger/indy-plenum
stp_zmq/kit_zstack.py
KITZStack.maintainConnections
def maintainConnections(self, force=False): """ Ensure appropriate connections. """ now = time.perf_counter() if now < self.nextCheck and not force: return False self.nextCheck = now + (self.config.RETRY_TIMEOUT_NOT_RESTRICTED ...
python
def maintainConnections(self, force=False): """ Ensure appropriate connections. """ now = time.perf_counter() if now < self.nextCheck and not force: return False self.nextCheck = now + (self.config.RETRY_TIMEOUT_NOT_RESTRICTED ...
[ "def", "maintainConnections", "(", "self", ",", "force", "=", "False", ")", ":", "now", "=", "time", ".", "perf_counter", "(", ")", "if", "now", "<", "self", ".", "nextCheck", "and", "not", "force", ":", "return", "False", "self", ".", "nextCheck", "="...
Ensure appropriate connections.
[ "Ensure", "appropriate", "connections", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_zmq/kit_zstack.py#L54-L69
234,242
hyperledger/indy-plenum
stp_zmq/kit_zstack.py
KITZStack.connectToMissing
def connectToMissing(self) -> set: """ Try to connect to the missing nodes """ missing = self.reconcileNodeReg() if not missing: return missing logger.info("{}{} found the following missing connections: {}". format(CONNECTION_PREFIX, self...
python
def connectToMissing(self) -> set: """ Try to connect to the missing nodes """ missing = self.reconcileNodeReg() if not missing: return missing logger.info("{}{} found the following missing connections: {}". format(CONNECTION_PREFIX, self...
[ "def", "connectToMissing", "(", "self", ")", "->", "set", ":", "missing", "=", "self", ".", "reconcileNodeReg", "(", ")", "if", "not", "missing", ":", "return", "missing", "logger", ".", "info", "(", "\"{}{} found the following missing connections: {}\"", ".", "...
Try to connect to the missing nodes
[ "Try", "to", "connect", "to", "the", "missing", "nodes" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_zmq/kit_zstack.py#L107-L125
234,243
hyperledger/indy-plenum
stp_core/common/logging/handlers.py
CallbackHandler.emit
def emit(self, record): """ Passes the log record back to the CLI for rendering """ should_cb = None attr_val = None if hasattr(record, self.typestr): attr_val = getattr(record, self.typestr) should_cb = bool(attr_val) if should_cb is None ...
python
def emit(self, record): """ Passes the log record back to the CLI for rendering """ should_cb = None attr_val = None if hasattr(record, self.typestr): attr_val = getattr(record, self.typestr) should_cb = bool(attr_val) if should_cb is None ...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "should_cb", "=", "None", "attr_val", "=", "None", "if", "hasattr", "(", "record", ",", "self", ".", "typestr", ")", ":", "attr_val", "=", "getattr", "(", "record", ",", "self", ".", "typestr", ")"...
Passes the log record back to the CLI for rendering
[ "Passes", "the", "log", "record", "back", "to", "the", "CLI", "for", "rendering" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/common/logging/handlers.py#L18-L39
234,244
hyperledger/indy-plenum
stp_core/network/keep_in_touch.py
KITNetworkInterface.conns
def conns(self, value: Set[str]) -> None: """ Updates the connection count of this node if not already done. """ if not self._conns == value: old = self._conns self._conns = value ins = value - old outs = old - value logger.disp...
python
def conns(self, value: Set[str]) -> None: """ Updates the connection count of this node if not already done. """ if not self._conns == value: old = self._conns self._conns = value ins = value - old outs = old - value logger.disp...
[ "def", "conns", "(", "self", ",", "value", ":", "Set", "[", "str", "]", ")", "->", "None", ":", "if", "not", "self", ".", "_conns", "==", "value", ":", "old", "=", "self", ".", "_conns", "self", ".", "_conns", "=", "value", "ins", "=", "value", ...
Updates the connection count of this node if not already done.
[ "Updates", "the", "connection", "count", "of", "this", "node", "if", "not", "already", "done", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/network/keep_in_touch.py#L57-L67
234,245
hyperledger/indy-plenum
stp_core/network/keep_in_touch.py
KITNetworkInterface.findInNodeRegByHA
def findInNodeRegByHA(self, remoteHa): """ Returns the name of the remote by HA if found in the node registry, else returns None """ regName = [nm for nm, ha in self.registry.items() if self.sameAddr(ha, remoteHa)] if len(regName) > 1: raise...
python
def findInNodeRegByHA(self, remoteHa): """ Returns the name of the remote by HA if found in the node registry, else returns None """ regName = [nm for nm, ha in self.registry.items() if self.sameAddr(ha, remoteHa)] if len(regName) > 1: raise...
[ "def", "findInNodeRegByHA", "(", "self", ",", "remoteHa", ")", ":", "regName", "=", "[", "nm", "for", "nm", ",", "ha", "in", "self", ".", "registry", ".", "items", "(", ")", "if", "self", ".", "sameAddr", "(", "ha", ",", "remoteHa", ")", "]", "if",...
Returns the name of the remote by HA if found in the node registry, else returns None
[ "Returns", "the", "name", "of", "the", "remote", "by", "HA", "if", "found", "in", "the", "node", "registry", "else", "returns", "None" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/network/keep_in_touch.py#L110-L122
234,246
hyperledger/indy-plenum
stp_core/network/keep_in_touch.py
KITNetworkInterface.getRemoteName
def getRemoteName(self, remote): """ Returns the name of the remote object if found in node registry. :param remote: the remote object """ if remote.name not in self.registry: find = [name for name, ha in self.registry.items() if ha == remote.ha] ...
python
def getRemoteName(self, remote): """ Returns the name of the remote object if found in node registry. :param remote: the remote object """ if remote.name not in self.registry: find = [name for name, ha in self.registry.items() if ha == remote.ha] ...
[ "def", "getRemoteName", "(", "self", ",", "remote", ")", ":", "if", "remote", ".", "name", "not", "in", "self", ".", "registry", ":", "find", "=", "[", "name", "for", "name", ",", "ha", "in", "self", ".", "registry", ".", "items", "(", ")", "if", ...
Returns the name of the remote object if found in node registry. :param remote: the remote object
[ "Returns", "the", "name", "of", "the", "remote", "object", "if", "found", "in", "node", "registry", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/network/keep_in_touch.py#L124-L135
234,247
hyperledger/indy-plenum
stp_core/network/keep_in_touch.py
KITNetworkInterface.notConnectedNodes
def notConnectedNodes(self) -> Set[str]: """ Returns the names of nodes in the registry this node is NOT connected to. """ return set(self.registry.keys()) - self.conns
python
def notConnectedNodes(self) -> Set[str]: """ Returns the names of nodes in the registry this node is NOT connected to. """ return set(self.registry.keys()) - self.conns
[ "def", "notConnectedNodes", "(", "self", ")", "->", "Set", "[", "str", "]", ":", "return", "set", "(", "self", ".", "registry", ".", "keys", "(", ")", ")", "-", "self", ".", "conns" ]
Returns the names of nodes in the registry this node is NOT connected to.
[ "Returns", "the", "names", "of", "nodes", "in", "the", "registry", "this", "node", "is", "NOT", "connected", "to", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/network/keep_in_touch.py#L138-L143
234,248
hyperledger/indy-plenum
stp_zmq/authenticator.py
MultiZapAuthenticator.start
def start(self): """Create and bind the ZAP socket""" self.zap_socket = self.context.socket(zmq.REP) self.zap_socket.linger = 1 zapLoc = 'inproc://zeromq.zap.{}'.format(MultiZapAuthenticator.count) self.zap_socket.bind(zapLoc) self.log.debug('Starting ZAP at {}'.format(za...
python
def start(self): """Create and bind the ZAP socket""" self.zap_socket = self.context.socket(zmq.REP) self.zap_socket.linger = 1 zapLoc = 'inproc://zeromq.zap.{}'.format(MultiZapAuthenticator.count) self.zap_socket.bind(zapLoc) self.log.debug('Starting ZAP at {}'.format(za...
[ "def", "start", "(", "self", ")", ":", "self", ".", "zap_socket", "=", "self", ".", "context", ".", "socket", "(", "zmq", ".", "REP", ")", "self", ".", "zap_socket", ".", "linger", "=", "1", "zapLoc", "=", "'inproc://zeromq.zap.{}'", ".", "format", "("...
Create and bind the ZAP socket
[ "Create", "and", "bind", "the", "ZAP", "socket" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_zmq/authenticator.py#L25-L31
234,249
hyperledger/indy-plenum
stp_zmq/authenticator.py
MultiZapAuthenticator.stop
def stop(self): """Close the ZAP socket""" if self.zap_socket: self.log.debug( 'Stopping ZAP at {}'.format(self.zap_socket.LAST_ENDPOINT)) super().stop()
python
def stop(self): """Close the ZAP socket""" if self.zap_socket: self.log.debug( 'Stopping ZAP at {}'.format(self.zap_socket.LAST_ENDPOINT)) super().stop()
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "zap_socket", ":", "self", ".", "log", ".", "debug", "(", "'Stopping ZAP at {}'", ".", "format", "(", "self", ".", "zap_socket", ".", "LAST_ENDPOINT", ")", ")", "super", "(", ")", ".", "stop", ...
Close the ZAP socket
[ "Close", "the", "ZAP", "socket" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_zmq/authenticator.py#L33-L38
234,250
hyperledger/indy-plenum
stp_zmq/authenticator.py
AsyncioAuthenticator.start
def start(self): """Start ZAP authentication""" super().start() self.__poller = zmq.asyncio.Poller() self.__poller.register(self.zap_socket, zmq.POLLIN) self.__task = asyncio.ensure_future(self.__handle_zap())
python
def start(self): """Start ZAP authentication""" super().start() self.__poller = zmq.asyncio.Poller() self.__poller.register(self.zap_socket, zmq.POLLIN) self.__task = asyncio.ensure_future(self.__handle_zap())
[ "def", "start", "(", "self", ")", ":", "super", "(", ")", ".", "start", "(", ")", "self", ".", "__poller", "=", "zmq", ".", "asyncio", ".", "Poller", "(", ")", "self", ".", "__poller", ".", "register", "(", "self", ".", "zap_socket", ",", "zmq", ...
Start ZAP authentication
[ "Start", "ZAP", "authentication" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_zmq/authenticator.py#L88-L93
234,251
hyperledger/indy-plenum
stp_zmq/authenticator.py
AsyncioAuthenticator.stop
def stop(self): """Stop ZAP authentication""" if self.__task: self.__task.cancel() if self.__poller: self.__poller.unregister(self.zap_socket) self.__poller = None super().stop()
python
def stop(self): """Stop ZAP authentication""" if self.__task: self.__task.cancel() if self.__poller: self.__poller.unregister(self.zap_socket) self.__poller = None super().stop()
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "__task", ":", "self", ".", "__task", ".", "cancel", "(", ")", "if", "self", ".", "__poller", ":", "self", ".", "__poller", ".", "unregister", "(", "self", ".", "zap_socket", ")", "self", "."...
Stop ZAP authentication
[ "Stop", "ZAP", "authentication" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_zmq/authenticator.py#L95-L102
234,252
hyperledger/indy-plenum
plenum/common/util.py
randomString
def randomString(size: int = 20) -> str: """ Generate a random string in hex of the specified size DO NOT use python provided random class its a Pseudo Random Number Generator and not secure enough for our needs :param size: size of the random string to generate :return: the hexadecimal random...
python
def randomString(size: int = 20) -> str: """ Generate a random string in hex of the specified size DO NOT use python provided random class its a Pseudo Random Number Generator and not secure enough for our needs :param size: size of the random string to generate :return: the hexadecimal random...
[ "def", "randomString", "(", "size", ":", "int", "=", "20", ")", "->", "str", ":", "def", "randomStr", "(", "size", ")", ":", "if", "not", "isinstance", "(", "size", ",", "int", ")", ":", "raise", "PlenumTypeError", "(", "'size'", ",", "size", ",", ...
Generate a random string in hex of the specified size DO NOT use python provided random class its a Pseudo Random Number Generator and not secure enough for our needs :param size: size of the random string to generate :return: the hexadecimal random string
[ "Generate", "a", "random", "string", "in", "hex", "of", "the", "specified", "size" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/util.py#L48-L75
234,253
hyperledger/indy-plenum
plenum/common/util.py
mostCommonElement
def mostCommonElement(elements: Iterable[T], to_hashable_f: Callable=None): """ Find the most frequent element of a collection. :param elements: An iterable of elements :param to_hashable_f: (optional) if defined will be used to get hashable presentation for non-hashable elements. Otherwise jso...
python
def mostCommonElement(elements: Iterable[T], to_hashable_f: Callable=None): """ Find the most frequent element of a collection. :param elements: An iterable of elements :param to_hashable_f: (optional) if defined will be used to get hashable presentation for non-hashable elements. Otherwise jso...
[ "def", "mostCommonElement", "(", "elements", ":", "Iterable", "[", "T", "]", ",", "to_hashable_f", ":", "Callable", "=", "None", ")", ":", "class", "_Hashable", "(", "collections", ".", "abc", ".", "Hashable", ")", ":", "def", "__init__", "(", "self", ",...
Find the most frequent element of a collection. :param elements: An iterable of elements :param to_hashable_f: (optional) if defined will be used to get hashable presentation for non-hashable elements. Otherwise json.dumps is used with sort_keys=True :return: element which is the most frequ...
[ "Find", "the", "most", "frequent", "element", "of", "a", "collection", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/util.py#L92-L122
234,254
hyperledger/indy-plenum
plenum/common/util.py
objSearchReplace
def objSearchReplace(obj: Any, toFrom: Dict[Any, Any], checked: Set[Any]=None, logMsg: str=None, deepLevel: int=None) -> None: """ Search for an attribute in an object and replace it with another. :param obj: the object to ...
python
def objSearchReplace(obj: Any, toFrom: Dict[Any, Any], checked: Set[Any]=None, logMsg: str=None, deepLevel: int=None) -> None: """ Search for an attribute in an object and replace it with another. :param obj: the object to ...
[ "def", "objSearchReplace", "(", "obj", ":", "Any", ",", "toFrom", ":", "Dict", "[", "Any", ",", "Any", "]", ",", "checked", ":", "Set", "[", "Any", "]", "=", "None", ",", "logMsg", ":", "str", "=", "None", ",", "deepLevel", ":", "int", "=", "None...
Search for an attribute in an object and replace it with another. :param obj: the object to search for the attribute :param toFrom: dictionary of the attribute name before and after search and replace i.e. search for the key and replace with the value :param checked: set of attributes of the object for rec...
[ "Search", "for", "an", "attribute", "in", "an", "object", "and", "replace", "it", "with", "another", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/util.py#L131-L174
234,255
hyperledger/indy-plenum
plenum/common/util.py
runall
async def runall(corogen): """ Run an array of coroutines :param corogen: a generator that generates coroutines :return: list or returns of the coroutines """ results = [] for c in corogen: result = await c results.append(result) return results
python
async def runall(corogen): """ Run an array of coroutines :param corogen: a generator that generates coroutines :return: list or returns of the coroutines """ results = [] for c in corogen: result = await c results.append(result) return results
[ "async", "def", "runall", "(", "corogen", ")", ":", "results", "=", "[", "]", "for", "c", "in", "corogen", ":", "result", "=", "await", "c", "results", ".", "append", "(", "result", ")", "return", "results" ]
Run an array of coroutines :param corogen: a generator that generates coroutines :return: list or returns of the coroutines
[ "Run", "an", "array", "of", "coroutines" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/util.py#L186-L197
234,256
hyperledger/indy-plenum
plenum/common/util.py
prime_gen
def prime_gen() -> int: # credit to David Eppstein, Wolfgang Beneicke, Paul Hofstra """ A generator for prime numbers starting from 2. """ D = {} yield 2 for q in itertools.islice(itertools.count(3), 0, None, 2): p = D.pop(q, None) if p is None: D[q * q] = 2 * q ...
python
def prime_gen() -> int: # credit to David Eppstein, Wolfgang Beneicke, Paul Hofstra """ A generator for prime numbers starting from 2. """ D = {} yield 2 for q in itertools.islice(itertools.count(3), 0, None, 2): p = D.pop(q, None) if p is None: D[q * q] = 2 * q ...
[ "def", "prime_gen", "(", ")", "->", "int", ":", "# credit to David Eppstein, Wolfgang Beneicke, Paul Hofstra", "D", "=", "{", "}", "yield", "2", "for", "q", "in", "itertools", ".", "islice", "(", "itertools", ".", "count", "(", "3", ")", ",", "0", ",", "No...
A generator for prime numbers starting from 2.
[ "A", "generator", "for", "prime", "numbers", "starting", "from", "2", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/util.py#L254-L270
234,257
hyperledger/indy-plenum
plenum/common/util.py
untilTrue
async def untilTrue(condition, *args, timeout=5) -> bool: """ Keep checking the condition till it is true or a timeout is reached :param condition: the condition to check (a function that returns bool) :param args: the arguments to the condition :return: True if the condition is met in the given ti...
python
async def untilTrue(condition, *args, timeout=5) -> bool: """ Keep checking the condition till it is true or a timeout is reached :param condition: the condition to check (a function that returns bool) :param args: the arguments to the condition :return: True if the condition is met in the given ti...
[ "async", "def", "untilTrue", "(", "condition", ",", "*", "args", ",", "timeout", "=", "5", ")", "->", "bool", ":", "result", "=", "False", "start", "=", "time", ".", "perf_counter", "(", ")", "elapsed", "=", "0", "while", "elapsed", "<", "timeout", "...
Keep checking the condition till it is true or a timeout is reached :param condition: the condition to check (a function that returns bool) :param args: the arguments to the condition :return: True if the condition is met in the given timeout, False otherwise
[ "Keep", "checking", "the", "condition", "till", "it", "is", "true", "or", "a", "timeout", "is", "reached" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/util.py#L273-L290
234,258
hyperledger/indy-plenum
plenum/common/stacks.py
ClientZStack.transmitToClient
def transmitToClient(self, msg: Any, remoteName: str): """ Transmit the specified message to the remote client specified by `remoteName`. :param msg: a message :param remoteName: the name of the remote """ payload = self.prepForSending(msg) try: if is...
python
def transmitToClient(self, msg: Any, remoteName: str): """ Transmit the specified message to the remote client specified by `remoteName`. :param msg: a message :param remoteName: the name of the remote """ payload = self.prepForSending(msg) try: if is...
[ "def", "transmitToClient", "(", "self", ",", "msg", ":", "Any", ",", "remoteName", ":", "str", ")", ":", "payload", "=", "self", ".", "prepForSending", "(", "msg", ")", "try", ":", "if", "isinstance", "(", "remoteName", ",", "str", ")", ":", "remoteNam...
Transmit the specified message to the remote client specified by `remoteName`. :param msg: a message :param remoteName: the name of the remote
[ "Transmit", "the", "specified", "message", "to", "the", "remote", "client", "specified", "by", "remoteName", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/stacks.py#L139-L158
234,259
hyperledger/indy-plenum
plenum/server/catchup/catchup_rep_service.py
CatchupRepService._has_valid_catchup_replies
def _has_valid_catchup_replies(self, seq_no: int, txns_to_process: List[Tuple[int, Any]]) -> Tuple[bool, str, int]: """ Transforms transactions for ledger! Returns: Whether catchup reply corresponding to seq_no Name of node from which txns came Number of tran...
python
def _has_valid_catchup_replies(self, seq_no: int, txns_to_process: List[Tuple[int, Any]]) -> Tuple[bool, str, int]: """ Transforms transactions for ledger! Returns: Whether catchup reply corresponding to seq_no Name of node from which txns came Number of tran...
[ "def", "_has_valid_catchup_replies", "(", "self", ",", "seq_no", ":", "int", ",", "txns_to_process", ":", "List", "[", "Tuple", "[", "int", ",", "Any", "]", "]", ")", "->", "Tuple", "[", "bool", ",", "str", ",", "int", "]", ":", "# TODO: Remove after sto...
Transforms transactions for ledger! Returns: Whether catchup reply corresponding to seq_no Name of node from which txns came Number of transactions ready to be processed
[ "Transforms", "transactions", "for", "ledger!" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/catchup/catchup_rep_service.py#L374-L425
234,260
hyperledger/indy-plenum
plenum/common/stack_manager.py
TxnStackManager._parse_pool_transaction_file
def _parse_pool_transaction_file( ledger, nodeReg, cliNodeReg, nodeKeys, activeValidators, ledger_size=None): """ helper function for parseLedgerForHaAndKeys """ for _, txn in ledger.getAllTxn(to=ledger_size): if get_type(txn) == NODE: ...
python
def _parse_pool_transaction_file( ledger, nodeReg, cliNodeReg, nodeKeys, activeValidators, ledger_size=None): """ helper function for parseLedgerForHaAndKeys """ for _, txn in ledger.getAllTxn(to=ledger_size): if get_type(txn) == NODE: ...
[ "def", "_parse_pool_transaction_file", "(", "ledger", ",", "nodeReg", ",", "cliNodeReg", ",", "nodeKeys", ",", "activeValidators", ",", "ledger_size", "=", "None", ")", ":", "for", "_", ",", "txn", "in", "ledger", ".", "getAllTxn", "(", "to", "=", "ledger_si...
helper function for parseLedgerForHaAndKeys
[ "helper", "function", "for", "parseLedgerForHaAndKeys" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/common/stack_manager.py#L58-L98
234,261
hyperledger/indy-plenum
ledger/merkle_verifier.py
MerkleVerifier.verify_tree_consistency
def verify_tree_consistency(self, old_tree_size: int, new_tree_size: int, old_root: bytes, new_root: bytes, proof: Sequence[bytes]): """Verify the consistency between two root hashes. old_tree_size must be <= new_tree_size. Args: ...
python
def verify_tree_consistency(self, old_tree_size: int, new_tree_size: int, old_root: bytes, new_root: bytes, proof: Sequence[bytes]): """Verify the consistency between two root hashes. old_tree_size must be <= new_tree_size. Args: ...
[ "def", "verify_tree_consistency", "(", "self", ",", "old_tree_size", ":", "int", ",", "new_tree_size", ":", "int", ",", "old_root", ":", "bytes", ",", "new_root", ":", "bytes", ",", "proof", ":", "Sequence", "[", "bytes", "]", ")", ":", "old_size", "=", ...
Verify the consistency between two root hashes. old_tree_size must be <= new_tree_size. Args: old_tree_size: size of the older tree. new_tree_size: size of the newer_tree. old_root: the root hash of the older tree. new_root: the root hash of the newer tr...
[ "Verify", "the", "consistency", "between", "two", "root", "hashes", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/ledger/merkle_verifier.py#L23-L153
234,262
hyperledger/indy-plenum
plenum/server/has_action_queue.py
HasActionQueue._schedule
def _schedule(self, action: Callable, seconds: int=0) -> int: """ Schedule an action to be executed after `seconds` seconds. :param action: a callable to be scheduled :param seconds: the time in seconds after which the action must be executed """ self.aid += 1 if...
python
def _schedule(self, action: Callable, seconds: int=0) -> int: """ Schedule an action to be executed after `seconds` seconds. :param action: a callable to be scheduled :param seconds: the time in seconds after which the action must be executed """ self.aid += 1 if...
[ "def", "_schedule", "(", "self", ",", "action", ":", "Callable", ",", "seconds", ":", "int", "=", "0", ")", "->", "int", ":", "self", ".", "aid", "+=", "1", "if", "seconds", ">", "0", ":", "nxt", "=", "time", ".", "perf_counter", "(", ")", "+", ...
Schedule an action to be executed after `seconds` seconds. :param action: a callable to be scheduled :param seconds: the time in seconds after which the action must be executed
[ "Schedule", "an", "action", "to", "be", "executed", "after", "seconds", "seconds", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/has_action_queue.py#L23-L48
234,263
hyperledger/indy-plenum
plenum/server/has_action_queue.py
HasActionQueue._cancel
def _cancel(self, action: Callable = None, aid: int = None): """ Cancel scheduled events :param action: (optional) scheduled action. If specified, all scheduled events for the action are cancelled. :param aid: (options) scheduled event id. If specified, ...
python
def _cancel(self, action: Callable = None, aid: int = None): """ Cancel scheduled events :param action: (optional) scheduled action. If specified, all scheduled events for the action are cancelled. :param aid: (options) scheduled event id. If specified, ...
[ "def", "_cancel", "(", "self", ",", "action", ":", "Callable", "=", "None", ",", "aid", ":", "int", "=", "None", ")", ":", "if", "action", "is", "not", "None", ":", "if", "action", "in", "self", ".", "scheduled", ":", "logger", ".", "trace", "(", ...
Cancel scheduled events :param action: (optional) scheduled action. If specified, all scheduled events for the action are cancelled. :param aid: (options) scheduled event id. If specified, scheduled event with the aid is cancelled.
[ "Cancel", "scheduled", "events" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/has_action_queue.py#L50-L72
234,264
hyperledger/indy-plenum
plenum/server/has_action_queue.py
HasActionQueue._serviceActions
def _serviceActions(self) -> int: """ Run all pending actions in the action queue. :return: number of actions executed. """ if self.aqStash: tm = time.perf_counter() if tm > self.aqNextCheck: earliest = float('inf') for d i...
python
def _serviceActions(self) -> int: """ Run all pending actions in the action queue. :return: number of actions executed. """ if self.aqStash: tm = time.perf_counter() if tm > self.aqNextCheck: earliest = float('inf') for d i...
[ "def", "_serviceActions", "(", "self", ")", "->", "int", ":", "if", "self", ".", "aqStash", ":", "tm", "=", "time", ".", "perf_counter", "(", ")", "if", "tm", ">", "self", ".", "aqNextCheck", ":", "earliest", "=", "float", "(", "'inf'", ")", "for", ...
Run all pending actions in the action queue. :return: number of actions executed.
[ "Run", "all", "pending", "actions", "in", "the", "action", "queue", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/has_action_queue.py#L74-L104
234,265
hyperledger/indy-plenum
plenum/server/node.py
Node.execute_pool_txns
def execute_pool_txns(self, three_pc_batch) -> List: """ Execute a transaction that involves consensus pool management, like adding a node, client or a steward. :param ppTime: PrePrepare request time :param reqs_keys: requests keys to be committed """ committed_t...
python
def execute_pool_txns(self, three_pc_batch) -> List: """ Execute a transaction that involves consensus pool management, like adding a node, client or a steward. :param ppTime: PrePrepare request time :param reqs_keys: requests keys to be committed """ committed_t...
[ "def", "execute_pool_txns", "(", "self", ",", "three_pc_batch", ")", "->", "List", ":", "committed_txns", "=", "self", ".", "default_executer", "(", "three_pc_batch", ")", "for", "txn", "in", "committed_txns", ":", "self", ".", "poolManager", ".", "onPoolMembers...
Execute a transaction that involves consensus pool management, like adding a node, client or a steward. :param ppTime: PrePrepare request time :param reqs_keys: requests keys to be committed
[ "Execute", "a", "transaction", "that", "involves", "consensus", "pool", "management", "like", "adding", "a", "node", "client", "or", "a", "steward", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L637-L648
234,266
hyperledger/indy-plenum
plenum/server/node.py
Node.init_state_from_ledger
def init_state_from_ledger(self, state: State, ledger: Ledger, reqHandler): """ If the trie is empty then initialize it by applying txns from ledger. """ if state.isEmpty: logger.info('{} found state to be empty, recreating from ' 'ledger'.form...
python
def init_state_from_ledger(self, state: State, ledger: Ledger, reqHandler): """ If the trie is empty then initialize it by applying txns from ledger. """ if state.isEmpty: logger.info('{} found state to be empty, recreating from ' 'ledger'.form...
[ "def", "init_state_from_ledger", "(", "self", ",", "state", ":", "State", ",", "ledger", ":", "Ledger", ",", "reqHandler", ")", ":", "if", "state", ".", "isEmpty", ":", "logger", ".", "info", "(", "'{} found state to be empty, recreating from '", "'ledger'", "."...
If the trie is empty then initialize it by applying txns from ledger.
[ "If", "the", "trie", "is", "empty", "then", "initialize", "it", "by", "applying", "txns", "from", "ledger", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L663-L674
234,267
hyperledger/indy-plenum
plenum/server/node.py
Node.on_view_change_start
def on_view_change_start(self): """ Notifies node about the fact that view changed to let it prepare for election """ self.view_changer.start_view_change_ts = self.utc_epoch() for replica in self.replicas.values(): replica.on_view_change_start() logge...
python
def on_view_change_start(self): """ Notifies node about the fact that view changed to let it prepare for election """ self.view_changer.start_view_change_ts = self.utc_epoch() for replica in self.replicas.values(): replica.on_view_change_start() logge...
[ "def", "on_view_change_start", "(", "self", ")", ":", "self", ".", "view_changer", ".", "start_view_change_ts", "=", "self", ".", "utc_epoch", "(", ")", "for", "replica", "in", "self", ".", "replicas", ".", "values", "(", ")", ":", "replica", ".", "on_view...
Notifies node about the fact that view changed to let it prepare for election
[ "Notifies", "node", "about", "the", "fact", "that", "view", "changed", "to", "let", "it", "prepare", "for", "election" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L791-L821
234,268
hyperledger/indy-plenum
plenum/server/node.py
Node.on_view_change_complete
def on_view_change_complete(self): """ View change completes for a replica when it has been decided which was the last ppSeqNo and state and txn root for previous view """ self.future_primaries_handler.set_node_state() if not self.replicas.all_instances_have_primary: ...
python
def on_view_change_complete(self): """ View change completes for a replica when it has been decided which was the last ppSeqNo and state and txn root for previous view """ self.future_primaries_handler.set_node_state() if not self.replicas.all_instances_have_primary: ...
[ "def", "on_view_change_complete", "(", "self", ")", ":", "self", ".", "future_primaries_handler", ".", "set_node_state", "(", ")", "if", "not", "self", ".", "replicas", ".", "all_instances_have_primary", ":", "raise", "LogicError", "(", "\"{} Not all replicas have \""...
View change completes for a replica when it has been decided which was the last ppSeqNo and state and txn root for previous view
[ "View", "change", "completes", "for", "a", "replica", "when", "it", "has", "been", "decided", "which", "was", "the", "last", "ppSeqNo", "and", "state", "and", "txn", "root", "for", "previous", "view" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L823-L851
234,269
hyperledger/indy-plenum
plenum/server/node.py
Node.onStopping
def onStopping(self): """ Actions to be performed on stopping the node. - Close the UDP socket of the nodestack """ # Log stats should happen before any kind of reset or clearing if self.config.STACK_COMPANION == 1: add_stop_time(self.ledger_dir, self.utc_epo...
python
def onStopping(self): """ Actions to be performed on stopping the node. - Close the UDP socket of the nodestack """ # Log stats should happen before any kind of reset or clearing if self.config.STACK_COMPANION == 1: add_stop_time(self.ledger_dir, self.utc_epo...
[ "def", "onStopping", "(", "self", ")", ":", "# Log stats should happen before any kind of reset or clearing", "if", "self", ".", "config", ".", "STACK_COMPANION", "==", "1", ":", "add_stop_time", "(", "self", ".", "ledger_dir", ",", "self", ".", "utc_epoch", "(", ...
Actions to be performed on stopping the node. - Close the UDP socket of the nodestack
[ "Actions", "to", "be", "performed", "on", "stopping", "the", "node", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1248-L1275
234,270
hyperledger/indy-plenum
plenum/server/node.py
Node.prod
async def prod(self, limit: int = None) -> int: """.opened This function is executed by the node each time it gets its share of CPU time from the event loop. :param limit: the number of items to be serviced in this attempt :return: total number of messages serviced by this node ...
python
async def prod(self, limit: int = None) -> int: """.opened This function is executed by the node each time it gets its share of CPU time from the event loop. :param limit: the number of items to be serviced in this attempt :return: total number of messages serviced by this node ...
[ "async", "def", "prod", "(", "self", ",", "limit", ":", "int", "=", "None", ")", "->", "int", ":", "c", "=", "0", "if", "self", ".", "last_prod_started", ":", "self", ".", "metrics", ".", "add_event", "(", "MetricsName", ".", "LOOPER_RUN_TIME_SPENT", "...
.opened This function is executed by the node each time it gets its share of CPU time from the event loop. :param limit: the number of items to be serviced in this attempt :return: total number of messages serviced by this node
[ ".", "opened", "This", "function", "is", "executed", "by", "the", "node", "each", "time", "it", "gets", "its", "share", "of", "CPU", "time", "from", "the", "event", "loop", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1309-L1349
234,271
hyperledger/indy-plenum
plenum/server/node.py
Node.serviceNodeMsgs
async def serviceNodeMsgs(self, limit: int) -> int: """ Process `limit` number of messages from the nodeInBox. :param limit: the maximum number of messages to process :return: the number of messages successfully processed """ with self.metrics.measure_time(MetricsName.SE...
python
async def serviceNodeMsgs(self, limit: int) -> int: """ Process `limit` number of messages from the nodeInBox. :param limit: the maximum number of messages to process :return: the number of messages successfully processed """ with self.metrics.measure_time(MetricsName.SE...
[ "async", "def", "serviceNodeMsgs", "(", "self", ",", "limit", ":", "int", ")", "->", "int", ":", "with", "self", ".", "metrics", ".", "measure_time", "(", "MetricsName", ".", "SERVICE_NODE_STACK_TIME", ")", ":", "n", "=", "await", "self", ".", "nodestack",...
Process `limit` number of messages from the nodeInBox. :param limit: the maximum number of messages to process :return: the number of messages successfully processed
[ "Process", "limit", "number", "of", "messages", "from", "the", "nodeInBox", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1368-L1381
234,272
hyperledger/indy-plenum
plenum/server/node.py
Node.serviceClientMsgs
async def serviceClientMsgs(self, limit: int) -> int: """ Process `limit` number of messages from the clientInBox. :param limit: the maximum number of messages to process :return: the number of messages successfully processed """ c = await self.clientstack.service(limit,...
python
async def serviceClientMsgs(self, limit: int) -> int: """ Process `limit` number of messages from the clientInBox. :param limit: the maximum number of messages to process :return: the number of messages successfully processed """ c = await self.clientstack.service(limit,...
[ "async", "def", "serviceClientMsgs", "(", "self", ",", "limit", ":", "int", ")", "->", "int", ":", "c", "=", "await", "self", ".", "clientstack", ".", "service", "(", "limit", ",", "self", ".", "quota_control", ".", "client_quota", ")", "self", ".", "m...
Process `limit` number of messages from the clientInBox. :param limit: the maximum number of messages to process :return: the number of messages successfully processed
[ "Process", "limit", "number", "of", "messages", "from", "the", "clientInBox", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1384-L1395
234,273
hyperledger/indy-plenum
plenum/server/node.py
Node.serviceViewChanger
async def serviceViewChanger(self, limit) -> int: """ Service the view_changer's inBox, outBox and action queues. :return: the number of messages successfully serviced """ if not self.isReady(): return 0 o = self.serviceViewChangerOutBox(limit) i = aw...
python
async def serviceViewChanger(self, limit) -> int: """ Service the view_changer's inBox, outBox and action queues. :return: the number of messages successfully serviced """ if not self.isReady(): return 0 o = self.serviceViewChangerOutBox(limit) i = aw...
[ "async", "def", "serviceViewChanger", "(", "self", ",", "limit", ")", "->", "int", ":", "if", "not", "self", ".", "isReady", "(", ")", ":", "return", "0", "o", "=", "self", ".", "serviceViewChangerOutBox", "(", "limit", ")", "i", "=", "await", "self", ...
Service the view_changer's inBox, outBox and action queues. :return: the number of messages successfully serviced
[ "Service", "the", "view_changer", "s", "inBox", "outBox", "and", "action", "queues", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1398-L1408
234,274
hyperledger/indy-plenum
plenum/server/node.py
Node.service_observable
async def service_observable(self, limit) -> int: """ Service the observable's inBox and outBox :return: the number of messages successfully serviced """ if not self.isReady(): return 0 o = self._service_observable_out_box(limit) i = await self._obser...
python
async def service_observable(self, limit) -> int: """ Service the observable's inBox and outBox :return: the number of messages successfully serviced """ if not self.isReady(): return 0 o = self._service_observable_out_box(limit) i = await self._obser...
[ "async", "def", "service_observable", "(", "self", ",", "limit", ")", "->", "int", ":", "if", "not", "self", ".", "isReady", "(", ")", ":", "return", "0", "o", "=", "self", ".", "_service_observable_out_box", "(", "limit", ")", "i", "=", "await", "self...
Service the observable's inBox and outBox :return: the number of messages successfully serviced
[ "Service", "the", "observable", "s", "inBox", "and", "outBox" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1411-L1421
234,275
hyperledger/indy-plenum
plenum/server/node.py
Node._service_observable_out_box
def _service_observable_out_box(self, limit: int = None) -> int: """ Service at most `limit` number of messages from the observable's outBox. :return: the number of messages successfully serviced. """ msg_count = 0 while True: if limit and msg_count >= limit:...
python
def _service_observable_out_box(self, limit: int = None) -> int: """ Service at most `limit` number of messages from the observable's outBox. :return: the number of messages successfully serviced. """ msg_count = 0 while True: if limit and msg_count >= limit:...
[ "def", "_service_observable_out_box", "(", "self", ",", "limit", ":", "int", "=", "None", ")", "->", "int", ":", "msg_count", "=", "0", "while", "True", ":", "if", "limit", "and", "msg_count", ">=", "limit", ":", "break", "msg", "=", "self", ".", "_obs...
Service at most `limit` number of messages from the observable's outBox. :return: the number of messages successfully serviced.
[ "Service", "at", "most", "limit", "number", "of", "messages", "from", "the", "observable", "s", "outBox", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1423-L1442
234,276
hyperledger/indy-plenum
plenum/server/node.py
Node.service_observer
async def service_observer(self, limit) -> int: """ Service the observer's inBox and outBox :return: the number of messages successfully serviced """ if not self.isReady(): return 0 return await self._observer.serviceQueues(limit)
python
async def service_observer(self, limit) -> int: """ Service the observer's inBox and outBox :return: the number of messages successfully serviced """ if not self.isReady(): return 0 return await self._observer.serviceQueues(limit)
[ "async", "def", "service_observer", "(", "self", ",", "limit", ")", "->", "int", ":", "if", "not", "self", ".", "isReady", "(", ")", ":", "return", "0", "return", "await", "self", ".", "_observer", ".", "serviceQueues", "(", "limit", ")" ]
Service the observer's inBox and outBox :return: the number of messages successfully serviced
[ "Service", "the", "observer", "s", "inBox", "and", "outBox" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1445-L1453
234,277
hyperledger/indy-plenum
plenum/server/node.py
Node._ask_for_ledger_status
def _ask_for_ledger_status(self, node_name: str, ledger_id): """ Ask other node for LedgerStatus """ self.request_msg(LEDGER_STATUS, {f.LEDGER_ID.nm: ledger_id}, [node_name, ]) logger.info("{} asking {} for ledger status of ledger {}".format(self, node_na...
python
def _ask_for_ledger_status(self, node_name: str, ledger_id): """ Ask other node for LedgerStatus """ self.request_msg(LEDGER_STATUS, {f.LEDGER_ID.nm: ledger_id}, [node_name, ]) logger.info("{} asking {} for ledger status of ledger {}".format(self, node_na...
[ "def", "_ask_for_ledger_status", "(", "self", ",", "node_name", ":", "str", ",", "ledger_id", ")", ":", "self", ".", "request_msg", "(", "LEDGER_STATUS", ",", "{", "f", ".", "LEDGER_ID", ".", "nm", ":", "ledger_id", "}", ",", "[", "node_name", ",", "]", ...
Ask other node for LedgerStatus
[ "Ask", "other", "node", "for", "LedgerStatus" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1525-L1531
234,278
hyperledger/indy-plenum
plenum/server/node.py
Node.checkInstances
def checkInstances(self) -> None: # TODO: Is this method really needed? """ Check if this node has the minimum required number of protocol instances, i.e. f+1. If not, add a replica. If no election is in progress, this node will try to nominate one of its replicas as primary. ...
python
def checkInstances(self) -> None: # TODO: Is this method really needed? """ Check if this node has the minimum required number of protocol instances, i.e. f+1. If not, add a replica. If no election is in progress, this node will try to nominate one of its replicas as primary. ...
[ "def", "checkInstances", "(", "self", ")", "->", "None", ":", "# TODO: Is this method really needed?", "logger", ".", "debug", "(", "\"{} choosing to start election on the basis of count {} and nodes {}\"", ".", "format", "(", "self", ",", "self", ".", "connectedNodeCount",...
Check if this node has the minimum required number of protocol instances, i.e. f+1. If not, add a replica. If no election is in progress, this node will try to nominate one of its replicas as primary. This method is called whenever a connection with a new node is established.
[ "Check", "if", "this", "node", "has", "the", "minimum", "required", "number", "of", "protocol", "instances", "i", ".", "e", ".", "f", "+", "1", ".", "If", "not", "add", "a", "replica", ".", "If", "no", "election", "is", "in", "progress", "this", "nod...
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1587-L1597
234,279
hyperledger/indy-plenum
plenum/server/node.py
Node.adjustReplicas
def adjustReplicas(self, old_required_number_of_instances: int, new_required_number_of_instances: int): """ Add or remove replicas depending on `f` """ # TODO: refactor this replica_num = old_required_number_of_instances while...
python
def adjustReplicas(self, old_required_number_of_instances: int, new_required_number_of_instances: int): """ Add or remove replicas depending on `f` """ # TODO: refactor this replica_num = old_required_number_of_instances while...
[ "def", "adjustReplicas", "(", "self", ",", "old_required_number_of_instances", ":", "int", ",", "new_required_number_of_instances", ":", "int", ")", ":", "# TODO: refactor this", "replica_num", "=", "old_required_number_of_instances", "while", "replica_num", "<", "new_requi...
Add or remove replicas depending on `f`
[ "Add", "or", "remove", "replicas", "depending", "on", "f" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1599-L1622
234,280
hyperledger/indy-plenum
plenum/server/node.py
Node._check_view_change_completed
def _check_view_change_completed(self): """ This thing checks whether new primary was elected. If it was not - starts view change again """ logger.info('{} running the scheduled check for view change completion'.format(self)) if not self.view_changer.view_change_in_progre...
python
def _check_view_change_completed(self): """ This thing checks whether new primary was elected. If it was not - starts view change again """ logger.info('{} running the scheduled check for view change completion'.format(self)) if not self.view_changer.view_change_in_progre...
[ "def", "_check_view_change_completed", "(", "self", ")", ":", "logger", ".", "info", "(", "'{} running the scheduled check for view change completion'", ".", "format", "(", "self", ")", ")", "if", "not", "self", ".", "view_changer", ".", "view_change_in_progress", ":"...
This thing checks whether new primary was elected. If it was not - starts view change again
[ "This", "thing", "checks", "whether", "new", "primary", "was", "elected", ".", "If", "it", "was", "not", "-", "starts", "view", "change", "again" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1663-L1674
234,281
hyperledger/indy-plenum
plenum/server/node.py
Node.service_replicas_outbox
def service_replicas_outbox(self, limit: int = None) -> int: """ Process `limit` number of replica messages """ # TODO: rewrite this using Router num_processed = 0 for message in self.replicas.get_output(limit): num_processed += 1 if isinstance(me...
python
def service_replicas_outbox(self, limit: int = None) -> int: """ Process `limit` number of replica messages """ # TODO: rewrite this using Router num_processed = 0 for message in self.replicas.get_output(limit): num_processed += 1 if isinstance(me...
[ "def", "service_replicas_outbox", "(", "self", ",", "limit", ":", "int", "=", "None", ")", "->", "int", ":", "# TODO: rewrite this using Router", "num_processed", "=", "0", "for", "message", "in", "self", ".", "replicas", ".", "get_output", "(", "limit", ")", ...
Process `limit` number of replica messages
[ "Process", "limit", "number", "of", "replica", "messages" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1677-L1708
234,282
hyperledger/indy-plenum
plenum/server/node.py
Node.master_primary_name
def master_primary_name(self) -> Optional[str]: """ Return the name of the primary node of the master instance """ master_primary_name = self.master_replica.primaryName if master_primary_name: return self.master_replica.getNodeName(master_primary_name) return...
python
def master_primary_name(self) -> Optional[str]: """ Return the name of the primary node of the master instance """ master_primary_name = self.master_replica.primaryName if master_primary_name: return self.master_replica.getNodeName(master_primary_name) return...
[ "def", "master_primary_name", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "master_primary_name", "=", "self", ".", "master_replica", ".", "primaryName", "if", "master_primary_name", ":", "return", "self", ".", "master_replica", ".", "getNodeName", ...
Return the name of the primary node of the master instance
[ "Return", "the", "name", "of", "the", "primary", "node", "of", "the", "master", "instance" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1758-L1766
234,283
hyperledger/indy-plenum
plenum/server/node.py
Node.msgHasAcceptableInstId
def msgHasAcceptableInstId(self, msg, frm) -> bool: """ Return true if the instance id of message corresponds to a correct replica. :param msg: the node message to validate :return: """ # TODO: refactor this! this should not do anything except checking! i...
python
def msgHasAcceptableInstId(self, msg, frm) -> bool: """ Return true if the instance id of message corresponds to a correct replica. :param msg: the node message to validate :return: """ # TODO: refactor this! this should not do anything except checking! i...
[ "def", "msgHasAcceptableInstId", "(", "self", ",", "msg", ",", "frm", ")", "->", "bool", ":", "# TODO: refactor this! this should not do anything except checking!", "instId", "=", "getattr", "(", "msg", ",", "f", ".", "INST_ID", ".", "nm", ",", "None", ")", "if"...
Return true if the instance id of message corresponds to a correct replica. :param msg: the node message to validate :return:
[ "Return", "true", "if", "the", "instance", "id", "of", "message", "corresponds", "to", "a", "correct", "replica", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1778-L1796
234,284
hyperledger/indy-plenum
plenum/server/node.py
Node.sendToReplica
def sendToReplica(self, msg, frm): """ Send the message to the intended replica. :param msg: the message to send :param frm: the name of the node which sent this `msg` """ # TODO: discard or stash messages here instead of doing # this in msgHas* methods!!! ...
python
def sendToReplica(self, msg, frm): """ Send the message to the intended replica. :param msg: the message to send :param frm: the name of the node which sent this `msg` """ # TODO: discard or stash messages here instead of doing # this in msgHas* methods!!! ...
[ "def", "sendToReplica", "(", "self", ",", "msg", ",", "frm", ")", ":", "# TODO: discard or stash messages here instead of doing", "# this in msgHas* methods!!!", "if", "self", ".", "msgHasAcceptableInstId", "(", "msg", ",", "frm", ")", ":", "self", ".", "replicas", ...
Send the message to the intended replica. :param msg: the message to send :param frm: the name of the node which sent this `msg`
[ "Send", "the", "message", "to", "the", "intended", "replica", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1831-L1841
234,285
hyperledger/indy-plenum
plenum/server/node.py
Node.sendToViewChanger
def sendToViewChanger(self, msg, frm): """ Send the message to the intended view changer. :param msg: the message to send :param frm: the name of the node which sent this `msg` """ if (isinstance(msg, InstanceChange) or self.msgHasAcceptableViewNo(msg, fr...
python
def sendToViewChanger(self, msg, frm): """ Send the message to the intended view changer. :param msg: the message to send :param frm: the name of the node which sent this `msg` """ if (isinstance(msg, InstanceChange) or self.msgHasAcceptableViewNo(msg, fr...
[ "def", "sendToViewChanger", "(", "self", ",", "msg", ",", "frm", ")", ":", "if", "(", "isinstance", "(", "msg", ",", "InstanceChange", ")", "or", "self", ".", "msgHasAcceptableViewNo", "(", "msg", ",", "frm", ")", ")", ":", "logger", ".", "debug", "(",...
Send the message to the intended view changer. :param msg: the message to send :param frm: the name of the node which sent this `msg`
[ "Send", "the", "message", "to", "the", "intended", "view", "changer", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1843-L1854
234,286
hyperledger/indy-plenum
plenum/server/node.py
Node.send_to_observer
def send_to_observer(self, msg, frm): """ Send the message to the observer. :param msg: the message to send :param frm: the name of the node which sent this `msg` """ logger.debug("{} sending message to observer: {}". format(self, (msg, frm))) ...
python
def send_to_observer(self, msg, frm): """ Send the message to the observer. :param msg: the message to send :param frm: the name of the node which sent this `msg` """ logger.debug("{} sending message to observer: {}". format(self, (msg, frm))) ...
[ "def", "send_to_observer", "(", "self", ",", "msg", ",", "frm", ")", ":", "logger", ".", "debug", "(", "\"{} sending message to observer: {}\"", ".", "format", "(", "self", ",", "(", "msg", ",", "frm", ")", ")", ")", "self", ".", "_observer", ".", "appen...
Send the message to the observer. :param msg: the message to send :param frm: the name of the node which sent this `msg`
[ "Send", "the", "message", "to", "the", "observer", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1856-L1865
234,287
hyperledger/indy-plenum
plenum/server/node.py
Node.handleOneNodeMsg
def handleOneNodeMsg(self, wrappedMsg): """ Validate and process one message from a node. :param wrappedMsg: Tuple of message and the name of the node that sent the message """ try: vmsg = self.validateNodeMsg(wrappedMsg) if vmsg: ...
python
def handleOneNodeMsg(self, wrappedMsg): """ Validate and process one message from a node. :param wrappedMsg: Tuple of message and the name of the node that sent the message """ try: vmsg = self.validateNodeMsg(wrappedMsg) if vmsg: ...
[ "def", "handleOneNodeMsg", "(", "self", ",", "wrappedMsg", ")", ":", "try", ":", "vmsg", "=", "self", ".", "validateNodeMsg", "(", "wrappedMsg", ")", "if", "vmsg", ":", "logger", ".", "trace", "(", "\"{} msg validated {}\"", ".", "format", "(", "self", ","...
Validate and process one message from a node. :param wrappedMsg: Tuple of message and the name of the node that sent the message
[ "Validate", "and", "process", "one", "message", "from", "a", "node", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1867-L1887
234,288
hyperledger/indy-plenum
plenum/server/node.py
Node.validateNodeMsg
def validateNodeMsg(self, wrappedMsg): """ Validate another node's message sent to this node. :param wrappedMsg: Tuple of message and the name of the node that sent the message :return: Tuple of message from node and name of the node """ msg, frm = wrappedMsg ...
python
def validateNodeMsg(self, wrappedMsg): """ Validate another node's message sent to this node. :param wrappedMsg: Tuple of message and the name of the node that sent the message :return: Tuple of message from node and name of the node """ msg, frm = wrappedMsg ...
[ "def", "validateNodeMsg", "(", "self", ",", "wrappedMsg", ")", ":", "msg", ",", "frm", "=", "wrappedMsg", "if", "self", ".", "isNodeBlacklisted", "(", "frm", ")", ":", "self", ".", "discard", "(", "str", "(", "msg", ")", "[", ":", "256", "]", ",", ...
Validate another node's message sent to this node. :param wrappedMsg: Tuple of message and the name of the node that sent the message :return: Tuple of message from node and name of the node
[ "Validate", "another", "node", "s", "message", "sent", "to", "this", "node", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1890-L1916
234,289
hyperledger/indy-plenum
plenum/server/node.py
Node.unpackNodeMsg
def unpackNodeMsg(self, msg, frm) -> None: """ If the message is a batch message validate each message in the batch, otherwise add the message to the node's inbox. :param msg: a node message :param frm: the name of the node that sent this `msg` """ # TODO: why do...
python
def unpackNodeMsg(self, msg, frm) -> None: """ If the message is a batch message validate each message in the batch, otherwise add the message to the node's inbox. :param msg: a node message :param frm: the name of the node that sent this `msg` """ # TODO: why do...
[ "def", "unpackNodeMsg", "(", "self", ",", "msg", ",", "frm", ")", "->", "None", ":", "# TODO: why do we unpack batches here? Batching is a feature of", "# a transport, it should be encapsulated.", "if", "isinstance", "(", "msg", ",", "Batch", ")", ":", "logger", ".", ...
If the message is a batch message validate each message in the batch, otherwise add the message to the node's inbox. :param msg: a node message :param frm: the name of the node that sent this `msg`
[ "If", "the", "message", "is", "a", "batch", "message", "validate", "each", "message", "in", "the", "batch", "otherwise", "add", "the", "message", "to", "the", "node", "s", "inbox", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1918-L1940
234,290
hyperledger/indy-plenum
plenum/server/node.py
Node.postToNodeInBox
def postToNodeInBox(self, msg, frm): """ Append the message to the node inbox :param msg: a node message :param frm: the name of the node that sent this `msg` """ logger.trace("{} appending to nodeInbox {}".format(self, msg)) self.nodeInBox.append((msg, frm))
python
def postToNodeInBox(self, msg, frm): """ Append the message to the node inbox :param msg: a node message :param frm: the name of the node that sent this `msg` """ logger.trace("{} appending to nodeInbox {}".format(self, msg)) self.nodeInBox.append((msg, frm))
[ "def", "postToNodeInBox", "(", "self", ",", "msg", ",", "frm", ")", ":", "logger", ".", "trace", "(", "\"{} appending to nodeInbox {}\"", ".", "format", "(", "self", ",", "msg", ")", ")", "self", ".", "nodeInBox", ".", "append", "(", "(", "msg", ",", "...
Append the message to the node inbox :param msg: a node message :param frm: the name of the node that sent this `msg`
[ "Append", "the", "message", "to", "the", "node", "inbox" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1942-L1950
234,291
hyperledger/indy-plenum
plenum/server/node.py
Node.processNodeInBox
async def processNodeInBox(self): """ Process the messages in the node inbox asynchronously. """ while self.nodeInBox: m = self.nodeInBox.popleft() await self.process_one_node_message(m)
python
async def processNodeInBox(self): """ Process the messages in the node inbox asynchronously. """ while self.nodeInBox: m = self.nodeInBox.popleft() await self.process_one_node_message(m)
[ "async", "def", "processNodeInBox", "(", "self", ")", ":", "while", "self", ".", "nodeInBox", ":", "m", "=", "self", ".", "nodeInBox", ".", "popleft", "(", ")", "await", "self", ".", "process_one_node_message", "(", "m", ")" ]
Process the messages in the node inbox asynchronously.
[ "Process", "the", "messages", "in", "the", "node", "inbox", "asynchronously", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1953-L1959
234,292
hyperledger/indy-plenum
plenum/server/node.py
Node.handleOneClientMsg
def handleOneClientMsg(self, wrappedMsg): """ Validate and process a client message :param wrappedMsg: a message from a client """ try: vmsg = self.validateClientMsg(wrappedMsg) if vmsg: self.unpackClientMsg(*vmsg) except BlowUp: ...
python
def handleOneClientMsg(self, wrappedMsg): """ Validate and process a client message :param wrappedMsg: a message from a client """ try: vmsg = self.validateClientMsg(wrappedMsg) if vmsg: self.unpackClientMsg(*vmsg) except BlowUp: ...
[ "def", "handleOneClientMsg", "(", "self", ",", "wrappedMsg", ")", ":", "try", ":", "vmsg", "=", "self", ".", "validateClientMsg", "(", "wrappedMsg", ")", "if", "vmsg", ":", "self", ".", "unpackClientMsg", "(", "*", "vmsg", ")", "except", "BlowUp", ":", "...
Validate and process a client message :param wrappedMsg: a message from a client
[ "Validate", "and", "process", "a", "client", "message" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L1968-L1986
234,293
hyperledger/indy-plenum
plenum/server/node.py
Node.processClientInBox
async def processClientInBox(self): """ Process the messages in the node's clientInBox asynchronously. All messages in the inBox have already been validated, including signature check. """ while self.clientInBox: m = self.clientInBox.popleft() req,...
python
async def processClientInBox(self): """ Process the messages in the node's clientInBox asynchronously. All messages in the inBox have already been validated, including signature check. """ while self.clientInBox: m = self.clientInBox.popleft() req,...
[ "async", "def", "processClientInBox", "(", "self", ")", ":", "while", "self", ".", "clientInBox", ":", "m", "=", "self", ".", "clientInBox", ".", "popleft", "(", ")", "req", ",", "frm", "=", "m", "logger", ".", "debug", "(", "\"{} processing {} request {}\...
Process the messages in the node's clientInBox asynchronously. All messages in the inBox have already been validated, including signature check.
[ "Process", "the", "messages", "in", "the", "node", "s", "clientInBox", "asynchronously", ".", "All", "messages", "in", "the", "inBox", "have", "already", "been", "validated", "including", "signature", "check", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2120-L2137
234,294
hyperledger/indy-plenum
plenum/server/node.py
Node.is_catchup_needed_during_view_change
def is_catchup_needed_during_view_change(self) -> bool: """ Check if received a quorum of view change done messages and if yes check if caught up till the Check if all requests ordered till last prepared certificate Check if last catchup resulted in no txns """ if...
python
def is_catchup_needed_during_view_change(self) -> bool: """ Check if received a quorum of view change done messages and if yes check if caught up till the Check if all requests ordered till last prepared certificate Check if last catchup resulted in no txns """ if...
[ "def", "is_catchup_needed_during_view_change", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "caught_up_for_current_view", "(", ")", ":", "logger", ".", "info", "(", "'{} is caught up for the current view {}'", ".", "format", "(", "self", ",", "self", "....
Check if received a quorum of view change done messages and if yes check if caught up till the Check if all requests ordered till last prepared certificate Check if last catchup resulted in no txns
[ "Check", "if", "received", "a", "quorum", "of", "view", "change", "done", "messages", "and", "if", "yes", "check", "if", "caught", "up", "till", "the", "Check", "if", "all", "requests", "ordered", "till", "last", "prepared", "certificate", "Check", "if", "...
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2275-L2298
234,295
hyperledger/indy-plenum
plenum/server/node.py
Node.doDynamicValidation
def doDynamicValidation(self, request: Request): """ State based validation """ self.execute_hook(NodeHooks.PRE_DYNAMIC_VALIDATION, request=request) # Digest validation ledger_id, seq_no = self.seqNoDB.get_by_payload_digest(request.payload_digest) if ledger_id is...
python
def doDynamicValidation(self, request: Request): """ State based validation """ self.execute_hook(NodeHooks.PRE_DYNAMIC_VALIDATION, request=request) # Digest validation ledger_id, seq_no = self.seqNoDB.get_by_payload_digest(request.payload_digest) if ledger_id is...
[ "def", "doDynamicValidation", "(", "self", ",", "request", ":", "Request", ")", ":", "self", ".", "execute_hook", "(", "NodeHooks", ".", "PRE_DYNAMIC_VALIDATION", ",", "request", "=", "request", ")", "# Digest validation", "ledger_id", ",", "seq_no", "=", "self"...
State based validation
[ "State", "based", "validation" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2401-L2421
234,296
hyperledger/indy-plenum
plenum/server/node.py
Node.applyReq
def applyReq(self, request: Request, cons_time: int): """ Apply request to appropriate ledger and state. `cons_time` is the UTC epoch at which consensus was reached. """ self.execute_hook(NodeHooks.PRE_REQUEST_APPLICATION, request=request, cons_time=cons...
python
def applyReq(self, request: Request, cons_time: int): """ Apply request to appropriate ledger and state. `cons_time` is the UTC epoch at which consensus was reached. """ self.execute_hook(NodeHooks.PRE_REQUEST_APPLICATION, request=request, cons_time=cons...
[ "def", "applyReq", "(", "self", ",", "request", ":", "Request", ",", "cons_time", ":", "int", ")", ":", "self", ".", "execute_hook", "(", "NodeHooks", ".", "PRE_REQUEST_APPLICATION", ",", "request", "=", "request", ",", "cons_time", "=", "cons_time", ")", ...
Apply request to appropriate ledger and state. `cons_time` is the UTC epoch at which consensus was reached.
[ "Apply", "request", "to", "appropriate", "ledger", "and", "state", ".", "cons_time", "is", "the", "UTC", "epoch", "at", "which", "consensus", "was", "reached", "." ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2423-L2435
234,297
hyperledger/indy-plenum
plenum/server/node.py
Node.processRequest
def processRequest(self, request: Request, frm: str): """ Handle a REQUEST from the client. If the request has already been executed, the node re-sends the reply to the client. Otherwise, the node acknowledges the client request, adds it to its list of client requests, and sends ...
python
def processRequest(self, request: Request, frm: str): """ Handle a REQUEST from the client. If the request has already been executed, the node re-sends the reply to the client. Otherwise, the node acknowledges the client request, adds it to its list of client requests, and sends ...
[ "def", "processRequest", "(", "self", ",", "request", ":", "Request", ",", "frm", ":", "str", ")", ":", "logger", ".", "debug", "(", "\"{} received client request: {} from {}\"", ".", "format", "(", "self", ".", "name", ",", "request", ",", "frm", ")", ")"...
Handle a REQUEST from the client. If the request has already been executed, the node re-sends the reply to the client. Otherwise, the node acknowledges the client request, adds it to its list of client requests, and sends a PROPAGATE to the remaining nodes. :param request: the R...
[ "Handle", "a", "REQUEST", "from", "the", "client", ".", "If", "the", "request", "has", "already", "been", "executed", "the", "node", "re", "-", "sends", "the", "reply", "to", "the", "client", ".", "Otherwise", "the", "node", "acknowledges", "the", "client"...
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2464-L2528
234,298
hyperledger/indy-plenum
plenum/server/node.py
Node.processPropagate
def processPropagate(self, msg: Propagate, frm): """ Process one propagateRequest sent to this node asynchronously - If this propagateRequest hasn't been seen by this node, then broadcast it to all nodes after verifying the the signature. - Add the client to blacklist if its sig...
python
def processPropagate(self, msg: Propagate, frm): """ Process one propagateRequest sent to this node asynchronously - If this propagateRequest hasn't been seen by this node, then broadcast it to all nodes after verifying the the signature. - Add the client to blacklist if its sig...
[ "def", "processPropagate", "(", "self", ",", "msg", ":", "Propagate", ",", "frm", ")", ":", "logger", ".", "debug", "(", "\"{} received propagated request: {}\"", ".", "format", "(", "self", ".", "name", ",", "msg", ")", ")", "request", "=", "TxnUtilConfig",...
Process one propagateRequest sent to this node asynchronously - If this propagateRequest hasn't been seen by this node, then broadcast it to all nodes after verifying the the signature. - Add the client to blacklist if its signature is invalid :param msg: the propagateRequest :...
[ "Process", "one", "propagateRequest", "sent", "to", "this", "node", "asynchronously" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2569-L2610
234,299
hyperledger/indy-plenum
plenum/server/node.py
Node.handle_get_txn_req
def handle_get_txn_req(self, request: Request, frm: str): """ Handle GET_TXN request """ ledger_id = request.operation.get(f.LEDGER_ID.nm, DOMAIN_LEDGER_ID) if ledger_id not in self.ledger_to_req_handler: self.send_nack_to_client((request.identifier, request.reqId), ...
python
def handle_get_txn_req(self, request: Request, frm: str): """ Handle GET_TXN request """ ledger_id = request.operation.get(f.LEDGER_ID.nm, DOMAIN_LEDGER_ID) if ledger_id not in self.ledger_to_req_handler: self.send_nack_to_client((request.identifier, request.reqId), ...
[ "def", "handle_get_txn_req", "(", "self", ",", "request", ":", "Request", ",", "frm", ":", "str", ")", ":", "ledger_id", "=", "request", ".", "operation", ".", "get", "(", "f", ".", "LEDGER_ID", ".", "nm", ",", "DOMAIN_LEDGER_ID", ")", "if", "ledger_id",...
Handle GET_TXN request
[ "Handle", "GET_TXN", "request" ]
dcd144e238af7f17a869ffc9412f13dc488b7020
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/node.py#L2634-L2670