当前位置: 首页>>代码示例>>Python>>正文


Python riak_object.RiakObject类代码示例

本文整理汇总了Python中riak_object.RiakObject的典型用法代码示例。如果您正苦于以下问题:Python RiakObject类的具体用法?Python RiakObject怎么用?Python RiakObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RiakObject类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

    def get(self, key, r=None, pr=None, timeout=None, include_context=None,
            basic_quorum=None, notfound_ok=None):
        """
        Retrieve an object or datatype from Riak.

        :param key: Name of the key.
        :type key: string
        :param r: R-Value of the request (defaults to bucket's R)
        :type r: integer
        :param pr: PR-Value of the request (defaults to bucket's PR)
        :type pr: integer
        :param timeout: a timeout value in milliseconds
        :type timeout: int
        :param include_context: if the bucket contains datatypes, include
           the opaque context in the result
        :type include_context: bool
        :param basic_quorum: whether to use the "basic quorum" policy
           for not-founds
        :type basic_quorum: bool
        :param notfound_ok: whether to treat not-found responses as successful
        :type notfound_ok: bool
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>` or
           :class:`~riak.datatypes.Datatype`
        """
        if self.bucket_type.datatype:
            return self._client.fetch_datatype(self, key, r=r, pr=pr,
                                               timeout=timeout,
                                               include_context=include_context,
                                               basic_quorum=basic_quorum,
                                               notfound_ok=notfound_ok)
        else:
            obj = RiakObject(self._client, self, key)
            return obj.reload(r=r, pr=pr, timeout=timeout,
                              basic_quorum=basic_quorum,
                              notfound_ok=notfound_ok)
开发者ID:serenabiodec,项目名称:riak-python-client,代码行数:35,代码来源:bucket.py

示例2: new

    def new(self, key=None, data=None, content_type='application/json',
            encoded_data=None):
        """
        Create a new :class:`RiakObject <riak.riak_object.RiakObject>`
        that will be stored as JSON. A shortcut for manually
        instantiating a :class:`RiakObject
        <riak.riak_object.RiakObject>`.

        :param key: Name of the key. Leaving this to be None (default)
                    will make Riak generate the key on store.
        :type key: string
        :param data: The data to store.
        :type data: object
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        try:
            if isinstance(data, basestring):
                data = data.encode('ascii')
        except UnicodeError:
            raise TypeError('Unicode data values are not supported.')

        obj = RiakObject(self._client, self, key)
        obj.content_type = content_type
        if data is not None:
            obj.data = data
        if encoded_data is not None:
            obj.encoded_data = encoded_data
        return obj
开发者ID:ThoughtLeadr,项目名称:riak-python-client,代码行数:28,代码来源:bucket.py

示例3: get_binary

 def get_binary(self, key, r=None):
     """
     Retrieve a binary/string object from Riak.
     @param string key - Name of the key.
     @param int r - R-Value of the request (defaults to bucket's R)
     @return RiakObject
     """
     obj = RiakObject(self._client, self, key)
     obj._encode_data = False
     r = self.get_r(r)
     return obj.reload(r)
开发者ID:PharkMillups,项目名称:riak-python-client,代码行数:11,代码来源:bucket.py

示例4: get_binary

    def get_binary(self, key, r=None):
        """
        Retrieve a binary/string object from Riak.

        :param key: Name of the key.
        :type key: string
        :param r: R-Value of the request (defaults to bucket's R)
        :type r: integer
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        obj = RiakObject(self._client, self, key)
        obj._encode_data = False
        r = self.get_r(r)
        return obj.reload(r)
开发者ID:thanhnamit,项目名称:riak-python-client,代码行数:14,代码来源:bucket.py

示例5: get

    def get(self, key, r=None, pr=None):
        """
        Retrieve a JSON-encoded object from Riak.

        :param key: Name of the key.
        :type key: string
        :param r: R-Value of the request (defaults to bucket's R)
        :type r: integer
        :param pr: PR-Value of the request (defaults to bucket's PR)
        :type pr: integer
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        obj = RiakObject(self._client, self, key)
        return obj.reload(r=r, pr=pr)
开发者ID:Atilla,项目名称:riak-python-client,代码行数:14,代码来源:bucket.py

示例6: get

    def get(self, key, r=None, pr=None, timeout=None):
        """
        Retrieve an object from Riak.

        :param key: Name of the key.
        :type key: string
        :param r: R-Value of the request (defaults to bucket's R)
        :type r: integer
        :param pr: PR-Value of the request (defaults to bucket's PR)
        :type pr: integer
        :param timeout: a timeout value in milliseconds
        :type timeout: int
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        obj = RiakObject(self._client, self, key)
        return obj.reload(r=r, pr=pr, timeout=timeout)
开发者ID:ThoughtLeadr,项目名称:riak-python-client,代码行数:16,代码来源:bucket.py

示例7: new_binary

    def new_binary(self, key, data, content_type='application/octet-stream'):
        """
        Create a new :class:`RiakObject <riak.riak_object.RiakObject>`
        that will be stored as plain text/binary. A shortcut for
        manually instantiating a :class:`RiakObject
        <riak.riak_object.RiakObject>`.

        :param key: Name of the key.
        :type key: string
        :param data: The data to store.
        :type data: object
        :param content_type: The content type of the object.
        :type content_type: string
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        obj = RiakObject(self._client, self, key)
        obj.data = data
        obj.content_type = content_type
        obj._encode_data = False
        return obj
开发者ID:coderoshi,项目名称:riak-python-client,代码行数:20,代码来源:bucket.py

示例8: new

 def new(self, key, data=None, content_type='application/json'):
     """
     Create a new Riak object that will be stored as JSON.
     @param string key - Name of the key.
     @param object data - The data to store. (default None)
     @return RiakObject
     """
     obj = RiakObject(self._client, self, key)
     obj.set_data(data)
     obj.set_content_type(content_type)
     obj._encode_data = True
     return obj
开发者ID:PharkMillups,项目名称:riak-python-client,代码行数:12,代码来源:bucket.py

示例9: new_binary

 def new_binary(self, key, data, content_type='application/octet-stream'):
     """
     Create a new Riak object that will be stored as plain text/binary.
     @param string key - Name of the key.
     @param object data - The data to store.
     @param string content_type - The content type of the object.
            (default 'application/octet-stream')
     @return RiakObject
     """
     obj = RiakObject(self._client, self, key)
     obj.set_data(data)
     obj.set_content_type(content_type)
     obj._encode_data = False
     return obj
开发者ID:PharkMillups,项目名称:riak-python-client,代码行数:14,代码来源:bucket.py

示例10: new

    def new(self, key, data=None, content_type='application/json'):
        """
        Create a new :class:`RiakObject <riak.riak_object.RiakObject>` that will be stored as JSON. A shortcut for
        manually instantiating a :class:`RiakObject <riak.riak_object.RiakObject>`.

        :param key: Name of the key.
        :type key: string
        :param data: The data to store.
        :type data: object
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        obj = RiakObject(self._client, self, key)
        obj.set_data(data)
        obj.set_content_type(content_type)
        obj._encode_data = True
        return obj
开发者ID:allancaffee,项目名称:riak-python-client,代码行数:16,代码来源:bucket.py

示例11: new

    def new(self, key, data=None, content_type="application/json"):
        """
        Create a new :class:`RiakObject <riak.riak_object.RiakObject>` that will be stored as JSON. A shortcut for
        manually instantiating a :class:`RiakObject <riak.riak_object.RiakObject>`.

        :param key: Name of the key.
        :type key: string
        :param data: The data to store.
        :type data: object
        :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
        """
        try:
            if isinstance(data, basestring):
                data = data.encode("ascii")
        except UnicodeError:
            raise TypeError("Unicode data values are not supported.")

        obj = RiakObject(self._client, self, key)
        obj.set_data(data)
        obj.set_content_type(content_type)
        obj._encode_data = True
        return obj
开发者ID:semk,项目名称:riak-python-client,代码行数:22,代码来源:bucket.py


注:本文中的riak_object.RiakObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。