Exemplo n.º 1
0
class ExtDocFunction(exttype.ExtStruct):
    name = "doc-function"
    desc = "Top-level struct for documenting a function"

    mandatory = {
        "function": ExtFunctionName,
        "parameters": exttype.ExtList(ExtDocParameter),
        "returns": ExtDocParameter,
        "types": exttype.ExtList(ExtDocTypedef)
    }

    optional = {
        "description": exttype.ExtString,
    }
Exemplo n.º 2
0
class FunServerListAPIVersions(Function):
    extname = 'server_list_api_versions'
    params = []
    returns = exttype.ExtList(default_type.ExtAPIVersionInfo)
    uses_database = False

    desc = """Returns a list of all API versions, together with their
current state and public comments."""

    def do(self):
        ret = []
        states = {
            "X": "Experimental",
            "P": "Production",
            "D": "Deprecated",
            "R": "Removed"
        }
        for api in self.server.api_handler.apis:
            ret.append({
                "version": api.version,
                "state": states[api.state],
                "comment": api.comment
            })

        return ret
Exemplo n.º 3
0
class FunMutexStringsetGet(_MutexStringsetFunction):
    extname = "mutex_stringset_get"
    returns = (exttype.ExtList(exttype.ExtString), "Current values, if any")
    desc = """Return the current values of a mutex stringset variable."""

    def do(self):
        return self.var.get_values()
Exemplo n.º 4
0
class FunMutexList(SessionedFunction):
    extname = "mutex_list"
    params = []
    returns = exttype.ExtList(default_type.ExtMutex)

    def do(self):
        return self.mutex_manager.list_mutex_names()
Exemplo n.º 5
0
class FunMutexWatchdogList(_MutexFunction):
    extname = "mutex_watchdog_list"
    params = []
    returns = exttype.ExtList(default_type.ExtWatchdog)
    desc = """Return all watchdogs belonging to the mutex."""

    def do(self):
        self.mutex.get_all_watchdogs()
Exemplo n.º 6
0
class FunMutexStringsetList(_MutexFunction):
    extname = "mutex_stringset_list"
    params = []
    returns = exttype.ExtList(default_type.ExtMutexVarName)
    desc = """Return the names of all string variables for the mutex."""

    def do(self):
        return self.mutex.get_stringset_variable_names()
Exemplo n.º 7
0
class FunServerListFunctions(Function):
    extname = 'server_list_functions'
    params = []
    returns = exttype.ExtList(exttype.ExtString)
    desc = 'Return a list of function names available on this server.'
    grants = None
    uses_database = False
    log_call_event = False
    creates_event = False

    def do(self):
        return self.api.get_visible_function_names()
Exemplo n.º 8
0
class ExtDocTypedef(exttype.ExtStruct):
    name = "doc-typedef"
    desc = "A type definition, matching a type name to a definition"

    mandatory = {
        "name": ExtDocTypename,
        "base": ExtDocBasetype,
    }

    optional = {
        "regexp": (exttype.ExtString, "For strings: constraining regexp"),
        "maxlen": (exttype.ExtInteger, "For strings: maximum length"),
        "values":
        (exttype.ExtList(exttype.ExtString), "For enums: valid values"),
        "min": (exttype.ExtInteger, "For integers: minimum value (inclusive)"),
        "max": (exttype.ExtInteger, "For integers: maximum value (inclusive)"),
        "subtype":
        (ExtDocTypename,
         "For nullable: type of non-null, for lists: type of elements"),
        "mandatory": (exttype.ExtList(ExtDocParameter),
                      "For structs: list of mandatory members"),
        "optional": (exttype.ExtList(ExtDocParameter),
                     "For structs: list of optional members")
    }