<gh_stars>0
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: atomix/membership/membership.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import AsyncGenerator, List, Optional

import betterproto
import grpclib


@dataclass
class GroupId(betterproto.Message):
    """Membership group identifier"""

    name: str = betterproto.string_field(1)
    namespace: str = betterproto.string_field(2)


@dataclass
class MemberId(betterproto.Message):
    """Member identifier"""

    name: str = betterproto.string_field(1)
    namespace: str = betterproto.string_field(2)


@dataclass
class Member(betterproto.Message):
    """Member is a membership member"""

    id: "MemberId" = betterproto.message_field(1)
    host: str = betterproto.string_field(2)
    port: int = betterproto.int32_field(3)


@dataclass
class JoinGroupRequest(betterproto.Message):
    """JoinGroupRequest is a request to join a membership group"""

    member: "Member" = betterproto.message_field(1)
    group_id: "GroupId" = betterproto.message_field(2)


@dataclass
class JoinGroupResponse(betterproto.Message):
    """JoinGroupResponse is a response to joining a membership group"""

    group_id: "GroupId" = betterproto.message_field(1)
    members: List["Member"] = betterproto.message_field(2)


class MembershipServiceStub(betterproto.ServiceStub):
    """Atomix membership service"""

    async def join_group(
        self, *, member: Optional["Member"] = None, group_id: Optional["GroupId"] = None
    ) -> AsyncGenerator[JoinGroupResponse, None]:
        """Joins a member to a cluster"""

        request = JoinGroupRequest()
        if member is not None:
            request.member = member
        if group_id is not None:
            request.group_id = group_id

        async for response in self._unary_stream(
            "/atomix.membership.MembershipService/JoinGroup",
            request,
            JoinGroupResponse,
        ):
            yield response

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: atomix/membership/membership.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import AsyncGenerator, List, Optional

import betterproto
import grpclib


@dataclass
class GroupId(betterproto.Message):
    """Membership group identifier"""

    name: str = betterproto.string_field(1)
    namespace: str = betterproto.string_field(2)


@dataclass
class MemberId(betterproto.Message):
    """Member identifier"""

    name: str = betterproto.string_field(1)
    namespace: str = betterproto.string_field(2)


@dataclass
class Member(betterproto.Message):
    """Member is a membership member"""

    id: "MemberId" = betterproto.message_field(1)
    host: str = betterproto.string_field(2)
    port: int = betterproto.int32_field(3)


@dataclass
class JoinGroupRequest(betterproto.Message):
    """JoinGroupRequest is a request to join a membership group"""

    member: "Member" = betterproto.message_field(1)
    group_id: "GroupId" = betterproto.message_field(2)


@dataclass
class JoinGroupResponse(betterproto.Message):
    """JoinGroupResponse is a response to joining a membership group"""

    group_id: "GroupId" = betterproto.message_field(1)
    members: List["Member"] = betterproto.message_field(2)


class MembershipServiceStub(betterproto.ServiceStub):
    """Atomix membership service"""

    async def join_group(
        self, *, member: Optional["Member"] = None, group_id: Optional["GroupId"] = None
    ) -> AsyncGenerator[JoinGroupResponse, None]:
        """Joins a member to a cluster"""

        request = JoinGroupRequest()
        if member is not None:
            request.member = member
        if group_id is not None:
            request.group_id = group_id

        async for response in self._unary_stream(
            "/atomix.membership.MembershipService/JoinGroup",
            request,
            JoinGroupResponse,
        ):
            yield response
# Generated by the protocol buffer compiler.  DO NOT EDIT! # sources: atomix/membership/membership.proto # plugin: python-betterproto Membership group identifier Member identifier Member is a membership member JoinGroupRequest is a request to join a membership group JoinGroupResponse is a response to joining a membership group Atomix membership service Joins a member to a cluster