Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pub/Sub: surface publish future in documentation #8229

Merged
merged 2 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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