Skip to content

Commit

Permalink
Pub/Sub: surface publish future in documentation (#8229)
Browse files Browse the repository at this point in the history
* surface publish future in documentation

* Update class definition
  • Loading branch information
anguillanneuf authored and plamut committed Jun 6, 2019
1 parent 4b5b2a1 commit cd57e65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
6 changes: 6 additions & 0 deletions pubsub/docs/publisher/api/futures.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Futures
=======

.. automodule:: google.cloud.pubsub_v1.publisher.futures
:members:
:inherited-members:
3 changes: 2 additions & 1 deletion pubsub/docs/publisher/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Futures
-------

Every call to :meth:`~.pubsub_v1.publisher.client.Client.publish` returns
an instance of :class:`google.api_core.future.Future`.
an instance of :class:`~.pubsub_v1.publisher.futures.Future`.

.. note::

Expand Down Expand Up @@ -135,3 +135,4 @@ API Reference
:maxdepth: 2

api/client
api/futures
23 changes: 6 additions & 17 deletions pubsub/google/cloud/pubsub_v1/publisher/futures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, Google LLC All rights reserved.
# Copyright 2019, Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,22 +18,11 @@


class Future(futures.Future):
"""Encapsulation of the asynchronous execution of an action.
This object is returned from asychronous Pub/Sub publishing calls, and is
the interface to determine the status of those calls.
This object should not be created directly, but is returned by other
methods in this library.
Args:
completed (Optional[Any]): An event, with the same interface as
:class:`threading.Event`. This is provided so that callers
with different concurrency models (e.g. ``threading`` or
``multiprocessing``) can supply an event that is compatible
with that model. The ``wait()`` and ``set()`` methods will be
used. If this argument is not provided, then a new
:class:`threading.Event` will be created and used.
"""This future object is returned from asychronous Pub/Sub publishing
calls.
Calling :meth:`result` will resolve the future by returning the message
ID, unless an error occurs.
"""

def result(self, timeout=None):
Expand Down

0 comments on commit cd57e65

Please sign in to comment.