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

Changing the master/slave phrasing #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"
# The main toctree document.
main_doc = "index"

# General information about the project.
project = "photon-pump"
Expand Down Expand Up @@ -132,15 +132,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "photon-pump.tex", "photon-pump Documentation", "Made.com", "manual")
(main_doc, "photon-pump.tex", "photon-pump Documentation", "Made.com", "manual")
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "photon-pump", "photon-pump Documentation", [author], 1)]
man_pages = [(main_doc, "photon-pump", "photon-pump Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -150,7 +150,7 @@
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
main_doc,
"photon-pump",
"photon-pump Documentation",
author,
Expand Down
2 changes: 1 addition & 1 deletion photonpump/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
# refs/heads/ and refs/tags/ prefixes that would let us distinguish
# between branches and tags. By ignoring refnames without digits, we
# filter out many common branch names like "release" and
# "stabilization", as well as "HEAD" and "master".
# "stabilization", as well as "HEAD" and "main".
tags = set([r for r in refs if re.search(r'\d', r)])
if verbose:
print("discarding '%s', no digits" % ",".join(refs - tags))
Expand Down
70 changes: 35 additions & 35 deletions photonpump/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ async def publish_event(
id: Optional[uuid.UUID] = None,
metadata: Optional[Any] = None,
expected_version: int = -2,
require_master: bool = False,
require_main: bool = False,
) -> None:
"""
Publish a single event to the EventStore.
Expand All @@ -637,7 +637,7 @@ async def publish_event(
-1: NoStream. Checks that the stream does not yet exist.
0: EmptyStream. Checks that the stream has been explicitly created but
does not yet contain any events.
require_master: If true, slave nodes will reject this message.
require_main: If true, subordinate nodes will reject this message.

Examples:

Expand All @@ -661,7 +661,7 @@ async def publish_event(
stream,
[event],
expected_version=expected_version,
require_master=require_master,
require_main=require_main,
credential=self.credential,
)
result = await self.dispatcher.start_conversation(conversation)
Expand All @@ -673,13 +673,13 @@ async def publish(
stream: str,
events: Sequence[msg.NewEventData],
expected_version=msg.ExpectedVersion.Any,
require_master=False,
require_main=False,
):
cmd = convo.WriteEvents(
stream,
events,
expected_version=expected_version,
require_master=require_master,
require_main=require_main,
credential=self.credential,
)
result = await self.dispatcher.start_conversation(cmd)
Expand All @@ -690,7 +690,7 @@ async def get_event(
stream: str,
event_number: int,
resolve_links=True,
require_master=False,
require_main=False,
correlation_id: uuid.UUID = None,
) -> msg.Event:
"""
Expand All @@ -701,8 +701,8 @@ async def get_event(
event_number: The sequence number of the event to read.
resolve_links (optional): True if eventstore should
automatically resolve Link Events, otherwise False.
required_master (optional): True if this command must be
sent direct to the master node, otherwise False.
required_main (optional): True if this command must be
sent direct to the main node, otherwise False.
correlation_id (optional): A unique identifer for this
command.

Expand All @@ -721,7 +721,7 @@ async def get_event(
stream,
event_number,
resolve_links,
require_master,
require_main,
conversation_id=correlation_id,
credential=self.credential,
)
Expand All @@ -737,7 +737,7 @@ async def get(
from_event: int = 0,
max_count: int = 100,
resolve_links: bool = True,
require_master: bool = False,
require_main: bool = False,
correlation_id: uuid.UUID = None,
):
"""
Expand All @@ -753,8 +753,8 @@ async def get(
max_count (optional): The maximum number of events to return.
resolve_links (optional): True if eventstore should
automatically resolve Link Events, otherwise False.
required_master (optional): True if this command must be
sent direct to the master node, otherwise False.
required_main (optional): True if this command must be
sent direct to the main node, otherwise False.
correlation_id (optional): A unique identifer for this command.

Examples:
Expand Down Expand Up @@ -785,7 +785,7 @@ async def get(
from_event,
max_count,
resolve_links,
require_master,
require_main,
direction=direction,
credential=self.credential,
)
Expand All @@ -799,7 +799,7 @@ async def get_all(
from_position: Optional[Union[msg.Position, msg._PositionSentinel]] = None,
max_count: int = 100,
resolve_links: bool = True,
require_master: bool = False,
require_main: bool = False,
correlation_id: uuid.UUID = None,
):
"""
Expand All @@ -814,8 +814,8 @@ async def get_all(
max_count (optional): The maximum number of events to return.
resolve_links (optional): True if eventstore should
automatically resolve Link Events, otherwise False.
required_master (optional): True if this command must be
sent direct to the master node, otherwise False.
required_main (optional): True if this command must be
sent direct to the main node, otherwise False.
correlation_id (optional): A unique identifer for this command.

Examples:
Expand All @@ -839,7 +839,7 @@ async def get_all(
msg.Position.for_direction(direction, from_position),
max_count,
resolve_links,
require_master,
require_main,
direction=direction,
credential=self.credential,
)
Expand All @@ -854,7 +854,7 @@ async def iter(
from_event: int = None,
batch_size: int = 100,
resolve_links: bool = True,
require_master: bool = False,
require_main: bool = False,
correlation_id: uuid.UUID = None,
):
"""
Expand All @@ -869,8 +869,8 @@ async def iter(
batch_size: The maximum number of events to read at a time.
resolve_links (optional): True if eventstore should
automatically resolve Link Events, otherwise False.
required_master (optional): True if this command must be
sent direct to the master node, otherwise False.
required_main (optional): True if this command must be
sent direct to the main node, otherwise False.
correlation_id (optional): A unique identifer for this
command.

Expand Down Expand Up @@ -915,7 +915,7 @@ async def iter_all(
from_position: Optional[Union[msg.Position, msg._PositionSentinel]] = None,
batch_size: int = 100,
resolve_links: bool = True,
require_master: bool = False,
require_main: bool = False,
correlation_id: Optional[uuid.UUID] = None,
):
"""
Expand All @@ -930,8 +930,8 @@ async def iter_all(
batch_size (optional): The maximum number of events to read at a time.
resolve_links (optional): True if eventstore should
automatically resolve Link Events, otherwise False.
required_master (optional): True if this command must be
sent direct to the master node, otherwise False.
required_main (optional): True if this command must be
sent direct to the main node, otherwise False.
correlation_id (optional): A unique identifer for this
command.

Expand Down Expand Up @@ -962,7 +962,7 @@ async def iter_all(
msg.Position.for_direction(direction, from_position),
batch_size,
resolve_links,
require_master,
require_main,
direction,
self.credential,
correlation_id,
Expand Down Expand Up @@ -1054,8 +1054,8 @@ async def subscribe_to(

resolve_links (optional): True if eventstore should
automatically resolve Link Events, otherwise False.
required_master (optional): True if this command must be
sent direct to the master node, otherwise False.
required_main (optional): True if this command must be
sent direct to the main node, otherwise False.
correlation_id (optional): A unique identifer for this
command.
batch_size (optioal): The number of events to pull down from
Expand Down Expand Up @@ -1236,21 +1236,21 @@ def connect(

If you're using
:meth:`persistent subscriptions <photonpump.connection.Client.create_subscription>`
you will always want to connect to the master node of the cluster.
you will always want to connect to the main node of the cluster.
The selector parameter is a function that chooses an available node from
the gossip result. To select the master node, use the
:func:`photonpump.discovery.prefer_master` function. This function will return
the master node if there is a live master, and a random replica otherwise.
All requests to the server can be made with the require_master flag which
will raise an error if the current node is not a master.
the gossip result. To select the main node, use the
:func:`photonpump.discovery.prefer_main` function. This function will return
the main node if there is a live main, and a random replica otherwise.
All requests to the server can be made with the require_main flag which
will raise an error if the current node is not a main.

>>> async with connect(
>>> discovery_host="eventstore.test",
>>> selector=discovery.prefer_master,
>>> selector=discovery.prefer_main,
>>> ) as c:
>>> await c.ping(require_master=True)
>>> await c.ping(require_main=True)

Conversely, you might want to avoid connecting to the master node for reasons
Conversely, you might want to avoid connecting to the main node for reasons
of scalability. For this you can use the
:func:`photonpump.discovery.prefer_replica` function.

Expand Down
Loading