Exemplo n.º 1
0
Arquivo: decode.py Projeto: 6f/Hearthy
def _defservice(name, methods):
    hval = utils.hash(name.encode('ascii'))

    assert hval not in _hash_to_service

    attr = []
    id_to_method = []
        
    for m_name, m_id, req, resp in methods:
        m = ServiceMethod(m_id, m_name, req, resp)
        attr.append((m_name, m))
        id_to_method.append((m_id, m))

    attr.append(('methods', dict(id_to_method)))
    attr.append(('_hash_value_', hval))
    attr.append(('name', name))
    attr.append(('id', len(_hash_to_service) + 1))
    
    t = type(name.split('.')[-1]+'Service', (), dict(attr))
    _hash_to_service[hval] = t
    return t
Exemplo n.º 2
0
def _defservice(name, methods):
    hval = utils.hash(name.encode('ascii'))

    assert hval not in _hash_to_service

    attr = []
    id_to_method = []

    for m_name, m_id, req, resp in methods:
        m = ServiceMethod(m_id, m_name, req, resp)
        attr.append((m_name, m))
        id_to_method.append((m_id, m))

    attr.append(('methods', dict(id_to_method)))
    attr.append(('_hash_value_', hval))
    attr.append(('name', name))
    attr.append(('id', len(_hash_to_service) + 1))

    t = type(name.split('.')[-1] + 'Service', (), dict(attr))
    _hash_to_service[hval] = t
    return t
Exemplo n.º 3
0
def _defservice(name, methods):
    hval = utils.hash(name.encode("ascii"))

    assert hval not in _hash_to_service

    attr = []
    id_to_method = []

    for m_name, m_id, req, resp in methods:
        m = ServiceMethod(m_id, m_name, req, resp)
        attr.append((m_name, m))
        id_to_method.append((m_id, m))

    attr.append(("methods", dict(id_to_method)))
    attr.append(("_hash_value_", hval))
    attr.append(("name", name))
    attr.append(("id", len(_hash_to_service) + 1))

    t = type(name.split(".")[-1] + "Service", (), dict(attr))
    _hash_to_service[hval] = t
    return t
Exemplo n.º 4
0
Arquivo: rpc.py Projeto: 6f/Hearthy
 def __init__(self, name):
     self.name = name
     self.hval = utils.hash(name.encode('ascii'))
     self._id_to_method = {}
     self._method_by_name = {}
Exemplo n.º 5
0
 def __init__(self, name):
     self.name = name
     self.hval = utils.hash(name.encode('ascii'))
     self._id_to_method = {}
     self._method_by_name = {}