Example #1
0
    def execute(self):
        """Statistics on the Fabric node.

        It returns information on the Fabric node, specifically a list with
        the following fileds: node identification, how long it is running,
        when it was started.
        """
        return Command.generate_output_pattern(_node_view)
Example #2
0
    def execute(self):
        """The method returns all the shard mapping definitions.

        :return: A list of shard mapping definitions
                    An Empty List if no shard mapping definition is found.
        """
        return Command.generate_output_pattern(
                            ShardMapping.list_shard_mapping_defn)
Example #3
0
    def execute(self, address, timeout=5):
        """Return server's UUID.

        :param address: Server's address.
        :param timeout: Time in seconds after which an error is reported
                        if the UUID is not retrieved.
        :return: UUID.
        """
        return Command.generate_output_pattern(_lookup_uuid, address, timeout)
Example #4
0
    def execute(self, group_id=None):
        """Return information on existing group(s).

        :param group_id: None if one wants to list the existing groups or
                         group's id if one wants information on a group.
        :return: List with {"group_id" : group_id, "failure_detector": ON/OFF,
                 "description" : description}.
        """
        return Command.generate_output_pattern(
            _lookup_groups, group_id)
Example #5
0
    def execute(self, table_name):
        """Fetch the shard specification mapping for the given table

        :param table_name: The name of the table for which the sharding
                           specification is being queried.

        :return: The a dictionary that contains the shard mapping information
                 for the given table.
        """
        return Command.generate_output_pattern(_lookup_shard_mapping,
                                               table_name)
Example #6
0
    def execute(self, table_name):
        """Fetch the shard specification mapping for the given table

        :param table_name: The name of the table for which the sharding
                           specification is being queried.

        :return: The a dictionary that contains the shard mapping information
                 for the given table.
        """
        return Command.generate_output_pattern(_lookup_shard_mapping,
                                               table_name)
Example #7
0
    def execute(self, group_id=None):
        """Statistics on a Group.

        It returns how many promotions and demotions were executed within a
        group. Specifically, a list with the following fields are returned:
        group_id, number of promotions, number of demotions.

        :param group_id: Group one wants to retrieve information on.
        """
        return Command.generate_output_pattern(
            MySQLHandler.group_view, group_id
        )
Example #8
0
    def execute(self, procedure_name=None):
        """Statistics on the Fabric node.

        It returns information on procedures that match the %procedure_name%
        pattern. The information is returned is a list in which each member
        of the list is also a list with the following fields: procedure name,
        number of successful calls, number of unsuccessful calls.

        :param procedure_name: Procedure one wants to retrieve information on.
        """
        return Command.generate_output_pattern(
            MySQLHandler.procedure_view, procedure_name
        )
Example #9
0
    def execute(self, table_name, key, hint="LOCAL"):
        """Given a table name and a key return the server where the shard of
        this table can be found.

        :param table_name: The table whose sharding specification needs to be
                            looked up.
        :param key: The key value that needs to be looked up
        :param hint: A hint indicates if the query is LOCAL or GLOBAL

        :return: The Group UUID that contains the range in which the key
                 belongs.
        """
        return Command.generate_output_pattern(_lookup, table_name, key, hint)
Example #10
0
    def execute(self, sharding_type):
        """The method returns all the shard mappings (names) of a
        particular sharding_type. For example if the method is called
        with 'range' it returns all the sharding specifications that exist
        of type range.

        :param sharding_type: The sharding type for which the sharding
                              specification needs to be returned.

        :return: A list of dictionaries of shard mappings that are of
                     the sharding type
                     An empty list of the sharding type is valid but no
                     shard mapping definition is found
                     An error if the sharding type is invalid.
        """
        return Command.generate_output_pattern(_list, sharding_type)
Example #11
0
    def execute(self, group_id, server_id=None, status=None, mode=None):
        """Return information on existing server(s) in a group.

        :param group_id: Group's id.
        :param uuid: None if one wants to list the existing servers
                     in a group or server's id if one wants information
                     on a server in a group.
        :server_id type: Servers's UUID or HOST:PORT.
        :param status: Server's status one is searching for.
        :param mode: Server's mode one is searching for.
        :return: Information on servers.
        :rtype: List with [uuid, address, status, mode, weight]
        """
        return Command.generate_output_pattern(
            _lookup_servers, group_id, server_id, status, mode
        )
Example #12
0
    def execute(self, sharding_type):
        """The method returns all the shard mappings (names) of a
        particular sharding_type. For example if the method is called
        with 'range' it returns all the sharding specifications that exist
        of type range.

        :param sharding_type: The sharding type for which the sharding
                              specification needs to be returned.

        :return: A list of dictionaries of shard mappings that are of
                     the sharding type
                     An empty list of the sharding type is valid but no
                     shard mapping definition is found
                     An error if the sharding type is invalid.
        """
        return Command.generate_output_pattern(_list, sharding_type)
Example #13
0
    def execute(self, group_id):
        """Check if any server within a group has failed.

        :param group_id: Group's id.
        """
        return Command.generate_output_pattern(_health, group_id)