def address(self): """ Node address as elliptics.Address """ if hasattr(cls, 'group_id'): return Address.from_host_port(self.__address__, self.__group_id__) else: return Address.from_host_port(self.__address__)
def address(self): """ Node address as elliptics.Address """ if hasattr(self, '__group_id__'): return Address.from_host_port(self.__address__, self.__group_id__) else: return Address.from_host_port(self.__address__)
def lookup_address(self, key, group_id): """ Returns address of node from specified group_id which is responsible for the key\n address = session.lookup_address('looking up key') print '\'looking up key\' should lives on node:', address """ return Address.from_host_port(super(Session, self).lookup_address(key, group_id))
def add_remote(self, remotes, port=None, family=AF_UNSPEC): ''' Adds connections to Elliptics node @remotes -- elliptics.Address's of server node node.add_remote("host.com:1025:2") node.add_remote("host.com", 1025, 2) node.add_remote("host.com", 1025) node.add_remote(Address.from_host_port("host.com:1025")) node.add_remote([ Address.from_host_port("host.com:1025"), Address.from_host_port_family("host.com:1026:2"), "host.com:1027:2" ]) ''' if port is not None: remotes = Address(remotes, port, family) if type(remotes) in [str, Address]: super(Node, self).add_remote((str(remotes), )) elif hasattr(remotes, '__iter__'): super(Node, self).add_remote(map(str, remotes)) else: raise ValueError("Couldn't convert {0} to [elliptics.Address]".format(repr(remotes)))
def convert(address, b_raised=True): if type(address) is str: return tuple(Address.from_host_port_family(address)) elif type(address) is Address: return tuple(address) elif b_raised: raise ValueError("Couldn't convert {0} to elliptics.Address".format(repr(address)))
def forward(self): """ If is set stick session to particular remote address. This remote won't handle request but will resend it to proper server node. If proper server node isn't available on forward node, forward node will fail request with -ENOTSUP error. """ if self.__forward is None: return None return Address.from_host_port_family(self.__forward)
def storage_address(self): """ Node address as elliptics.Address """ return Address.from_host_port(self.__storage_address__)
def address(self): """ Node address as elliptics.Address """ return Address.from_host_port(self.__address__)
def address(self): """ Node address as elliptics.Address """ return Address.from_host_port(self.__address__, self.__group_id__)