毕业 oslo.context

https://blueprints.launchpad.net/oslo-incubator/+spec/graduate-oslo-context

oslo.context 包含上下文基类,它定义了 oslo.messaging 和 oslo.log 使用的 API。

库名称

新库的名称是什么?: oslo.context

内容

  • openstack/common/context.py

  • tests/unit/test_context.py

早期采用者

  • oslo.log

  • oslo.messaging

公共 API

import oslo_context

所有现有的公共函数和类将保持公共。

def generate_request_id():
    "Return a unique request identifier."

class RequestContext(object):

    """Helper class to represent useful information about a request context.

    Stores information about the security context under which the user
    accesses the system, as well as additional request information.
    """

def get_admin_context(show_deleted=False):
    "Return a RequestContext configured as an admin user"

def get_context_from_function_and_args(function, args, kwargs):
    """Find an arg of type RequestContext and return it.

       This is useful in a couple of decorators where we don't
       know much about the function we're wrapping.
    """

def is_user_context(context):
    """Indicates if the request context is a normal user."""

将使用 threading.local() 实例和基于 nova.context.RequestContext 的逻辑来维护上下文对象的私有注册表。将添加一个新的公共 API 来访问上下文

def get_current():
    "Return this thread's current context"

实现

负责人

主要负责人

doug-hellmann

其他贡献者

主要维护者

主要维护者

未知

其他贡献者

安全联系人

安全联系人

doug-hellmann

里程碑

完成目标里程碑: kilo-1

工作项

采用说明

使用 oslo.context 的项目应继承 oslo_context.RequestContext 并创建自己特定的应用程序上下文类。

依赖项

参考资料

注意

本作品采用知识共享署名 3.0 非移植许可协议授权。 http://creativecommons.org/licenses/by/3.0/legalcode