How to use the aiomas.rpc.Service function in aiomas

To help you get started, we’ve selected a few aiomas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gdassori / spruned / spruned / daemon / electrum / connectrum_reactor.py View on Github external
for response in responses:
            if len(responses) == 1 or responses.count(response) > len(responses) / 2 + .1:
                pass

    async def _getblockheaderatheight(self, blockheight):
        pass

    async def _getblockheaderforhash(self, blockhash):
        pass

    async def _sendrawtransaction(self, rawtransaction):
        pass


class RPCServer:
    router = aiomas.rpc.Service()

    @router.expose
    def getrawtransaction(self, a, b):
        return a + b


if __name__ == '__main__':
    rpc_server = RPCServer()
    headers_repository = HeadersSQLiteRepository(database.session)
    interface = ConnectrumInterface(settings.NETWORK, connections_concurrency_ratio=4, concurrency=3)
    interface.add_headers_repository(headers_repository)
    reactor = ConnectrumReactor(headers_repository, interface, rpc_server)
    reactor.start()
github gdassori / spruned / spruned / daemon / electrod / electrod_rpc_server.py View on Github external
from typing import Tuple, Dict
import aiomas


class ElectrodRPCServer:
    router = aiomas.rpc.Service()

    def __init__(self, endpoint: (str, Tuple), repository):
        self.endpoint = endpoint
        self.interface = None
        self.repo = repository
        self._server_instance = None

    def set_interface(self, interface):
        assert not self.interface, "RPC Server already initialized"
        self.interface = interface

    def enable_blocks_api(self):
        pass

    def disable_blocks_api(self):
        pass

aiomas

Asyncio-based, layered networking library providing request-reply channels, RPC, and multi-agent systems.

MIT
Latest version published 7 years ago

Package Health Score

42 / 100
Full package analysis