Source code for python_pachyderm.experimental.proto.v2.transaction_v2

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: python_pachyderm/proto/v2/transaction/transaction.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, List, Optional

import betterproto
from betterproto.grpc.grpclib_server import ServiceBase
import grpclib


[docs]@dataclass(eq=False, repr=False) class DeleteAllRequest(betterproto.Message): pass
[docs]@dataclass(eq=False, repr=False) class TransactionRequest(betterproto.Message): # Exactly one of these fields should be set create_repo: "_pfs_v2__.CreateRepoRequest" = betterproto.message_field(1) delete_repo: "_pfs_v2__.DeleteRepoRequest" = betterproto.message_field(2) start_commit: "_pfs_v2__.StartCommitRequest" = betterproto.message_field(3) finish_commit: "_pfs_v2__.FinishCommitRequest" = betterproto.message_field(4) squash_commit_set: "_pfs_v2__.SquashCommitSetRequest" = betterproto.message_field(5) create_branch: "_pfs_v2__.CreateBranchRequest" = betterproto.message_field(6) delete_branch: "_pfs_v2__.DeleteBranchRequest" = betterproto.message_field(7) update_job_state: "_pps_v2__.UpdateJobStateRequest" = betterproto.message_field(8) create_pipeline: "_pps_v2__.CreatePipelineRequest" = betterproto.message_field(9) stop_job: "_pps_v2__.StopJobRequest" = betterproto.message_field(10)
[docs]@dataclass(eq=False, repr=False) class TransactionResponse(betterproto.Message): # At most, one of these fields should be set (most responses are empty) commit: "_pfs_v2__.Commit" = betterproto.message_field(1)
[docs]@dataclass(eq=False, repr=False) class Transaction(betterproto.Message): id: str = betterproto.string_field(1)
[docs]@dataclass(eq=False, repr=False) class TransactionInfo(betterproto.Message): transaction: "Transaction" = betterproto.message_field(1) requests: List["TransactionRequest"] = betterproto.message_field(2) responses: List["TransactionResponse"] = betterproto.message_field(3) started: datetime = betterproto.message_field(4) version: int = betterproto.uint64_field(5)
[docs]@dataclass(eq=False, repr=False) class TransactionInfos(betterproto.Message): transaction_info: List["TransactionInfo"] = betterproto.message_field(1)
[docs]@dataclass(eq=False, repr=False) class BatchTransactionRequest(betterproto.Message): requests: List["TransactionRequest"] = betterproto.message_field(1)
[docs]@dataclass(eq=False, repr=False) class StartTransactionRequest(betterproto.Message): pass
[docs]@dataclass(eq=False, repr=False) class InspectTransactionRequest(betterproto.Message): transaction: "Transaction" = betterproto.message_field(1)
[docs]@dataclass(eq=False, repr=False) class DeleteTransactionRequest(betterproto.Message): transaction: "Transaction" = betterproto.message_field(1)
[docs]@dataclass(eq=False, repr=False) class ListTransactionRequest(betterproto.Message): pass
[docs]@dataclass(eq=False, repr=False) class FinishTransactionRequest(betterproto.Message): transaction: "Transaction" = betterproto.message_field(1)
[docs]class ApiStub(betterproto.ServiceStub):
[docs] async def batch_transaction( self, *, requests: Optional[List["TransactionRequest"]] = None ) -> "TransactionInfo": requests = requests or [] request = BatchTransactionRequest() if requests is not None: request.requests = requests return await self._unary_unary( "/transaction_v2.API/BatchTransaction", request, TransactionInfo )
[docs] async def start_transaction(self) -> "Transaction": request = StartTransactionRequest() return await self._unary_unary( "/transaction_v2.API/StartTransaction", request, Transaction )
[docs] async def inspect_transaction( self, *, transaction: "Transaction" = None ) -> "TransactionInfo": request = InspectTransactionRequest() if transaction is not None: request.transaction = transaction return await self._unary_unary( "/transaction_v2.API/InspectTransaction", request, TransactionInfo )
[docs] async def delete_transaction( self, *, transaction: "Transaction" = None ) -> "betterproto_lib_google_protobuf.Empty": request = DeleteTransactionRequest() if transaction is not None: request.transaction = transaction return await self._unary_unary( "/transaction_v2.API/DeleteTransaction", request, betterproto_lib_google_protobuf.Empty, )
[docs] async def list_transaction(self) -> "TransactionInfos": request = ListTransactionRequest() return await self._unary_unary( "/transaction_v2.API/ListTransaction", request, TransactionInfos )
[docs] async def finish_transaction( self, *, transaction: "Transaction" = None ) -> "TransactionInfo": request = FinishTransactionRequest() if transaction is not None: request.transaction = transaction return await self._unary_unary( "/transaction_v2.API/FinishTransaction", request, TransactionInfo )
[docs] async def delete_all(self) -> "betterproto_lib_google_protobuf.Empty": request = DeleteAllRequest() return await self._unary_unary( "/transaction_v2.API/DeleteAll", request, betterproto_lib_google_protobuf.Empty, )
[docs]class ApiBase(ServiceBase):
[docs] async def batch_transaction( self, requests: Optional[List["TransactionRequest"]] ) -> "TransactionInfo": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def start_transaction(self) -> "Transaction": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def inspect_transaction( self, transaction: "Transaction" ) -> "TransactionInfo": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def delete_transaction( self, transaction: "Transaction" ) -> "betterproto_lib_google_protobuf.Empty": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def list_transaction(self) -> "TransactionInfos": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def finish_transaction(self, transaction: "Transaction") -> "TransactionInfo": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
[docs] async def delete_all(self) -> "betterproto_lib_google_protobuf.Empty": raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
async def __rpc_batch_transaction(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = { "requests": request.requests, } response = await self.batch_transaction(**request_kwargs) await stream.send_message(response) async def __rpc_start_transaction(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = {} response = await self.start_transaction(**request_kwargs) await stream.send_message(response) async def __rpc_inspect_transaction(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = { "transaction": request.transaction, } response = await self.inspect_transaction(**request_kwargs) await stream.send_message(response) async def __rpc_delete_transaction(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = { "transaction": request.transaction, } response = await self.delete_transaction(**request_kwargs) await stream.send_message(response) async def __rpc_list_transaction(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = {} response = await self.list_transaction(**request_kwargs) await stream.send_message(response) async def __rpc_finish_transaction(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = { "transaction": request.transaction, } response = await self.finish_transaction(**request_kwargs) await stream.send_message(response) async def __rpc_delete_all(self, stream: grpclib.server.Stream) -> None: request = await stream.recv_message() request_kwargs = {} response = await self.delete_all(**request_kwargs) await stream.send_message(response) def __mapping__(self) -> Dict[str, grpclib.const.Handler]: return { "/transaction_v2.API/BatchTransaction": grpclib.const.Handler( self.__rpc_batch_transaction, grpclib.const.Cardinality.UNARY_UNARY, BatchTransactionRequest, TransactionInfo, ), "/transaction_v2.API/StartTransaction": grpclib.const.Handler( self.__rpc_start_transaction, grpclib.const.Cardinality.UNARY_UNARY, StartTransactionRequest, Transaction, ), "/transaction_v2.API/InspectTransaction": grpclib.const.Handler( self.__rpc_inspect_transaction, grpclib.const.Cardinality.UNARY_UNARY, InspectTransactionRequest, TransactionInfo, ), "/transaction_v2.API/DeleteTransaction": grpclib.const.Handler( self.__rpc_delete_transaction, grpclib.const.Cardinality.UNARY_UNARY, DeleteTransactionRequest, betterproto_lib_google_protobuf.Empty, ), "/transaction_v2.API/ListTransaction": grpclib.const.Handler( self.__rpc_list_transaction, grpclib.const.Cardinality.UNARY_UNARY, ListTransactionRequest, TransactionInfos, ), "/transaction_v2.API/FinishTransaction": grpclib.const.Handler( self.__rpc_finish_transaction, grpclib.const.Cardinality.UNARY_UNARY, FinishTransactionRequest, TransactionInfo, ), "/transaction_v2.API/DeleteAll": grpclib.const.Handler( self.__rpc_delete_all, grpclib.const.Cardinality.UNARY_UNARY, DeleteAllRequest, betterproto_lib_google_protobuf.Empty, ), }
from .. import pfs_v2 as _pfs_v2__ from .. import pps_v2 as _pps_v2__ import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf