示例#1
0
 def bucket_manager(self):
     """
     Returns a :class:`~.BucketManager` object which may be used to
     perform management operations on the current bucket. These
     operations may create/modify design documents and flush the
     bucket
     """
     return BucketManager(self)
 def _drop_index(self, bucket_name, index_name, *options, **kwargs):
     info = BucketManager._mk_index_def(bucket_name,
                                        index_name,
                                        primary=kwargs.pop(
                                            'primary', False))
     final_args = {
         k.replace('ignore_if_not_exists', 'ignore_missing'): v
         for k, v in forward_args(kwargs, *options).items()
     }
     IxmgmtRequest(self._admin_bucket, 'drop', info, **final_args).execute()
    def build_deferred_indexes(
            self,  # type: QueryIndexManager
            bucket_name,  # type: str
            *options,  # type: BuildQueryIndexOptions
            **kwargs):
        """
        Build Deferred builds all indexes which are currently in deferred state.

        :param bucket_name: name of the bucket.
        :param timeout: the time allowed for the operation to be terminated. This is controlled by the client.

        :raise: InvalidArgumentsException

        """
        return BucketManager._n1ql_index_build_deferred(
            bucket_name, self._admin_bucket, **kwargs)
    def build_deferred_indexes(
            self,  # type: QueryIndexManager
            bucket_name,  # type: str
            *options,  # type: BuildDeferredQueryIndexOptions
            **kwargs):
        """
        Build Deferred builds all indexes which are currently in deferred state.

        :param str bucket_name: name of the bucket.
        :param BuildDeferredQueryIndexOptions options: Options for building deferred indexes.
        :param Any kwargs: Override corresponding value in options.
        :raise: InvalidArgumentsException

        """
        final_args = forward_args(kwargs, *options)
        return BucketManager._n1ql_index_build_deferred(
            bucket_name, self._admin_bucket, **final_args)
    def watch_indexes(
            self,  # type: QueryIndexManager
            bucket_name,  # type: str
            index_names,  # type: Iterable[str]
            *options,  # type: WatchQueryIndexOptions
            **kwargs):
        """
        Watch polls indexes until they are online.

        :param str bucket_name: name of the bucket.
        :param Iterable[str] index_names: name(s) of the index(es).
        :param WatchQueryIndexOptions options: Options for request to watch indexes.
        :param Any kwargs: Override corresponding valud in options.
        :raises: QueryIndexNotFoundException
        :raises: InvalidArgumentsException
        """
        final_args = forward_args(kwargs, *options)
        BucketManager(self._admin_bucket).n1ql_index_watch(
            index_names, **final_args)
    def watch_indexes(
            self,  # type: QueryIndexManager
            bucket_name,  # type: str
            index_names,  # type: Iterable[str]
            *options,  # type: WatchQueryIndexOptions
            **kwargs):
        """
        Watch polls indexes until they are online.

        :param str bucket_name: name of the bucket.
        :param Iteralbe[str] index_names: name(s) of the index(es).
        :param Duration timeout: the time allowed for the operation to be terminated. This is controlled by the client.
        :param: bool watch_primary: whether or not to watch the primary index.

        :raises: QueryIndexNotFoundException
        :raises: InvalidArgumentsException
        """
        final_args = forward_args(kwargs, *options)
        BucketManager(self._admin_bucket).n1ql_index_watch(
            index_names, **final_args)