proto

package
v0.0.0-...-535fc81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Tdtm_Begin_FullMethodName    = "/proto.Tdtm/Begin"
	Tdtm_Register_FullMethodName = "/proto.Tdtm/Register"
	Tdtm_Start_FullMethodName    = "/proto.Tdtm/Start"
	Tdtm_Commit_FullMethodName   = "/proto.Tdtm/Commit"
	Tdtm_Rollback_FullMethodName = "/proto.Tdtm/Rollback"
	Tdtm_GetState_FullMethodName = "/proto.Tdtm/GetState"
)

Variables

View Source
var (
	TranType_name = map[int32]string{
		0: "UN_KNOW",
		1: "TCC",
		2: "SAGE",
	}
	TranType_value = map[string]int32{
		"UN_KNOW": 0,
		"TCC":     1,
		"SAGE":    2,
	}
)

Enum value maps for TranType.

View Source
var (
	Action_name = map[int32]string{
		0: "UN_KNOW_TRANSACTION_TYPE",
		1: "TRY",
		2: "CONFIRM",
		3: "CANCEL",
		4: "NORMAL",
		5: "COMPENSATION",
	}
	Action_value = map[string]int32{
		"UN_KNOW_TRANSACTION_TYPE": 0,
		"TRY":                      1,
		"CONFIRM":                  2,
		"CANCEL":                   3,
		"NORMAL":                   4,
		"COMPENSATION":             5,
	}
)

Enum value maps for Action.

View Source
var (
	BranchState_name = map[int32]string{
		0: "UN_KNOW_STATE",
		1: "B_INIT",
		2: "RETRYING",
		3: "SUCCEED",
		4: "FAILED",
	}
	BranchState_value = map[string]int32{
		"UN_KNOW_STATE": 0,
		"B_INIT":        1,
		"RETRYING":      2,
		"SUCCEED":       3,
		"FAILED":        4,
	}
)

Enum value maps for BranchState.

View Source
var (
	GlobalState_name = map[int32]string{
		0:  "GLOBAL_DEFAULT",
		1:  "INIT",
		2:  "PHASE1_PROCESSING",
		3:  "PHASE1_RETRYING",
		4:  "PHASE1_FAILED",
		5:  "PHASE1_SUCCESS",
		6:  "PHASE2_COMMITTING",
		7:  "PHASE2_ROLLBACKING",
		8:  "PHASE2_COMMIT_FAILED",
		9:  "PHASE2_ROLLBACK_FAILED",
		10: "COMMITTED",
		11: "ROLLBACKED",
	}
	GlobalState_value = map[string]int32{
		"GLOBAL_DEFAULT":         0,
		"INIT":                   1,
		"PHASE1_PROCESSING":      2,
		"PHASE1_RETRYING":        3,
		"PHASE1_FAILED":          4,
		"PHASE1_SUCCESS":         5,
		"PHASE2_COMMITTING":      6,
		"PHASE2_ROLLBACKING":     7,
		"PHASE2_COMMIT_FAILED":   8,
		"PHASE2_ROLLBACK_FAILED": 9,
		"COMMITTED":              10,
		"ROLLBACKED":             11,
	}
)

Enum value maps for GlobalState.

View Source
var Tdtm_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Tdtm",
	HandlerType: (*TdtmServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Begin",
			Handler:    _Tdtm_Begin_Handler,
		},
		{
			MethodName: "Register",
			Handler:    _Tdtm_Register_Handler,
		},
		{
			MethodName: "Start",
			Handler:    _Tdtm_Start_Handler,
		},
		{
			MethodName: "Commit",
			Handler:    _Tdtm_Commit_Handler,
		},
		{
			MethodName: "Rollback",
			Handler:    _Tdtm_Rollback_Handler,
		},
		{
			MethodName: "GetState",
			Handler:    _Tdtm_GetState_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "tdtm.proto",
}

Tdtm_ServiceDesc is the grpc.ServiceDesc for Tdtm service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterTdtmHandler

func RegisterTdtmHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterTdtmHandler registers the http handlers for service Tdtm to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterTdtmHandlerClient

func RegisterTdtmHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TdtmClient) error

RegisterTdtmHandlerClient registers the http handlers for service Tdtm to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TdtmClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TdtmClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TdtmClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterTdtmHandlerFromEndpoint

func RegisterTdtmHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterTdtmHandlerFromEndpoint is same as RegisterTdtmHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterTdtmHandlerServer

func RegisterTdtmHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TdtmServer) error

RegisterTdtmHandlerServer registers the http handlers for service Tdtm to "mux". UnaryRPC :call TdtmServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTdtmHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterTdtmServer

func RegisterTdtmServer(s grpc.ServiceRegistrar, srv TdtmServer)

Types

type Action

type Action int32

事务状态

const (
	Action_UN_KNOW_TRANSACTION_TYPE Action = 0
	Action_TRY                      Action = 1
	Action_CONFIRM                  Action = 2
	Action_CANCEL                   Action = 3
	Action_NORMAL                   Action = 4
	Action_COMPENSATION             Action = 5
)

func (Action) Descriptor

func (Action) Descriptor() protoreflect.EnumDescriptor

func (Action) Enum

func (x Action) Enum() *Action

func (Action) EnumDescriptor deprecated

func (Action) EnumDescriptor() ([]byte, []int)

Deprecated: Use Action.Descriptor instead.

func (Action) Number

func (x Action) Number() protoreflect.EnumNumber

func (Action) String

func (x Action) String() string

func (Action) Type

func (Action) Type() protoreflect.EnumType

type BeginResp

type BeginResp struct {
	Gid string `protobuf:"bytes,1,opt,name=gid,proto3" json:"gid,omitempty"`
	// contains filtered or unexported fields
}

func (*BeginResp) Descriptor deprecated

func (*BeginResp) Descriptor() ([]byte, []int)

Deprecated: Use BeginResp.ProtoReflect.Descriptor instead.

func (*BeginResp) GetGid

func (x *BeginResp) GetGid() string

func (*BeginResp) ProtoMessage

func (*BeginResp) ProtoMessage()

func (*BeginResp) ProtoReflect

func (x *BeginResp) ProtoReflect() protoreflect.Message

func (*BeginResp) Reset

func (x *BeginResp) Reset()

func (*BeginResp) String

func (x *BeginResp) String() string

func (*BeginResp) Validate

func (m *BeginResp) Validate() error

Validate checks the field values on BeginResp with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*BeginResp) ValidateAll

func (m *BeginResp) ValidateAll() error

ValidateAll checks the field values on BeginResp with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in BeginRespMultiError, or nil if none found.

type BeginRespMultiError

type BeginRespMultiError []error

BeginRespMultiError is an error wrapping multiple validation errors returned by BeginResp.ValidateAll() if the designated constraints aren't met.

func (BeginRespMultiError) AllErrors

func (m BeginRespMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (BeginRespMultiError) Error

func (m BeginRespMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type BeginRespValidationError

type BeginRespValidationError struct {
	// contains filtered or unexported fields
}

BeginRespValidationError is the validation error returned by BeginResp.Validate if the designated constraints aren't met.

func (BeginRespValidationError) Cause

func (e BeginRespValidationError) Cause() error

Cause function returns cause value.

func (BeginRespValidationError) Error

func (e BeginRespValidationError) Error() string

Error satisfies the builtin error interface

func (BeginRespValidationError) ErrorName

func (e BeginRespValidationError) ErrorName() string

ErrorName returns error name.

func (BeginRespValidationError) Field

func (e BeginRespValidationError) Field() string

Field function returns field value.

func (BeginRespValidationError) Key

Key function returns key value.

func (BeginRespValidationError) Reason

func (e BeginRespValidationError) Reason() string

Reason function returns reason value.

type BranchState

type BranchState int32
const (
	BranchState_UN_KNOW_STATE BranchState = 0
	BranchState_B_INIT        BranchState = 1
	BranchState_RETRYING      BranchState = 2
	BranchState_SUCCEED       BranchState = 3
	BranchState_FAILED        BranchState = 4
)

func (BranchState) Descriptor

func (BranchState) Enum

func (x BranchState) Enum() *BranchState

func (BranchState) EnumDescriptor deprecated

func (BranchState) EnumDescriptor() ([]byte, []int)

Deprecated: Use BranchState.Descriptor instead.

func (BranchState) Number

func (x BranchState) Number() protoreflect.EnumNumber

func (BranchState) String

func (x BranchState) String() string

func (BranchState) Type

type CommitReq

type CommitReq struct {
	GId string `protobuf:"bytes,1,opt,name=gId,proto3" json:"gId,omitempty"`
	// contains filtered or unexported fields
}

func (*CommitReq) Descriptor deprecated

func (*CommitReq) Descriptor() ([]byte, []int)

Deprecated: Use CommitReq.ProtoReflect.Descriptor instead.

func (*CommitReq) GetGId

func (x *CommitReq) GetGId() string

func (*CommitReq) ProtoMessage

func (*CommitReq) ProtoMessage()

func (*CommitReq) ProtoReflect

func (x *CommitReq) ProtoReflect() protoreflect.Message

func (*CommitReq) Reset

func (x *CommitReq) Reset()

func (*CommitReq) String

func (x *CommitReq) String() string

func (*CommitReq) Validate

func (m *CommitReq) Validate() error

Validate checks the field values on CommitReq with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*CommitReq) ValidateAll

func (m *CommitReq) ValidateAll() error

ValidateAll checks the field values on CommitReq with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CommitReqMultiError, or nil if none found.

type CommitReqMultiError

type CommitReqMultiError []error

CommitReqMultiError is an error wrapping multiple validation errors returned by CommitReq.ValidateAll() if the designated constraints aren't met.

func (CommitReqMultiError) AllErrors

func (m CommitReqMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CommitReqMultiError) Error

func (m CommitReqMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type CommitReqValidationError

type CommitReqValidationError struct {
	// contains filtered or unexported fields
}

CommitReqValidationError is the validation error returned by CommitReq.Validate if the designated constraints aren't met.

func (CommitReqValidationError) Cause

func (e CommitReqValidationError) Cause() error

Cause function returns cause value.

func (CommitReqValidationError) Error

func (e CommitReqValidationError) Error() string

Error satisfies the builtin error interface

func (CommitReqValidationError) ErrorName

func (e CommitReqValidationError) ErrorName() string

ErrorName returns error name.

func (CommitReqValidationError) Field

func (e CommitReqValidationError) Field() string

Field function returns field value.

func (CommitReqValidationError) Key

Key function returns key value.

func (CommitReqValidationError) Reason

func (e CommitReqValidationError) Reason() string

Reason function returns reason value.

type GetStateReq

type GetStateReq struct {
	GId string `protobuf:"bytes,1,opt,name=gId,proto3" json:"gId,omitempty"`
	// contains filtered or unexported fields
}

func (*GetStateReq) Descriptor deprecated

func (*GetStateReq) Descriptor() ([]byte, []int)

Deprecated: Use GetStateReq.ProtoReflect.Descriptor instead.

func (*GetStateReq) GetGId

func (x *GetStateReq) GetGId() string

func (*GetStateReq) ProtoMessage

func (*GetStateReq) ProtoMessage()

func (*GetStateReq) ProtoReflect

func (x *GetStateReq) ProtoReflect() protoreflect.Message

func (*GetStateReq) Reset

func (x *GetStateReq) Reset()

func (*GetStateReq) String

func (x *GetStateReq) String() string

func (*GetStateReq) Validate

func (m *GetStateReq) Validate() error

Validate checks the field values on GetStateReq with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetStateReq) ValidateAll

func (m *GetStateReq) ValidateAll() error

ValidateAll checks the field values on GetStateReq with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetStateReqMultiError, or nil if none found.

type GetStateReqMultiError

type GetStateReqMultiError []error

GetStateReqMultiError is an error wrapping multiple validation errors returned by GetStateReq.ValidateAll() if the designated constraints aren't met.

func (GetStateReqMultiError) AllErrors

func (m GetStateReqMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetStateReqMultiError) Error

func (m GetStateReqMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type GetStateReqValidationError

type GetStateReqValidationError struct {
	// contains filtered or unexported fields
}

GetStateReqValidationError is the validation error returned by GetStateReq.Validate if the designated constraints aren't met.

func (GetStateReqValidationError) Cause

Cause function returns cause value.

func (GetStateReqValidationError) Error

Error satisfies the builtin error interface

func (GetStateReqValidationError) ErrorName

func (e GetStateReqValidationError) ErrorName() string

ErrorName returns error name.

func (GetStateReqValidationError) Field

Field function returns field value.

func (GetStateReqValidationError) Key

Key function returns key value.

func (GetStateReqValidationError) Reason

Reason function returns reason value.

type GetStateResp

type GetStateResp struct {
	GId      string                `protobuf:"bytes,1,opt,name=gId,proto3" json:"gId,omitempty"`
	State    GlobalState           `protobuf:"varint,2,opt,name=state,proto3,enum=proto.GlobalState" json:"state,omitempty"`
	EndTime  int64                 `protobuf:"varint,3,opt,name=endTime,proto3" json:"endTime,omitempty"`
	Branches []*GetStateRespBranch `protobuf:"bytes,4,rep,name=branches,proto3" json:"branches,omitempty"`
	// contains filtered or unexported fields
}

func (*GetStateResp) Descriptor deprecated

func (*GetStateResp) Descriptor() ([]byte, []int)

Deprecated: Use GetStateResp.ProtoReflect.Descriptor instead.

func (*GetStateResp) GetBranches

func (x *GetStateResp) GetBranches() []*GetStateRespBranch

func (*GetStateResp) GetEndTime

func (x *GetStateResp) GetEndTime() int64

func (*GetStateResp) GetGId

func (x *GetStateResp) GetGId() string

func (*GetStateResp) GetState

func (x *GetStateResp) GetState() GlobalState

func (*GetStateResp) ProtoMessage

func (*GetStateResp) ProtoMessage()

func (*GetStateResp) ProtoReflect

func (x *GetStateResp) ProtoReflect() protoreflect.Message

func (*GetStateResp) Reset

func (x *GetStateResp) Reset()

func (*GetStateResp) String

func (x *GetStateResp) String() string

func (*GetStateResp) Validate

func (m *GetStateResp) Validate() error

Validate checks the field values on GetStateResp with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetStateResp) ValidateAll

func (m *GetStateResp) ValidateAll() error

ValidateAll checks the field values on GetStateResp with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetStateRespMultiError, or nil if none found.

type GetStateRespBranch

type GetStateRespBranch struct {
	BranchId   string      `protobuf:"bytes,1,opt,name=branchId,proto3" json:"branchId,omitempty"`
	ReqData    string      `protobuf:"bytes,2,opt,name=reqData,proto3" json:"reqData,omitempty"`
	ReqHeader  string      `protobuf:"bytes,3,opt,name=reqHeader,proto3" json:"reqHeader,omitempty"`
	Uri        string      `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"`
	TranType   TranType    `protobuf:"varint,5,opt,name=tranType,proto3,enum=proto.TranType" json:"tranType,omitempty"`
	Protocol   string      `protobuf:"bytes,6,opt,name=protocol,proto3" json:"protocol,omitempty"`
	Action     Action      `protobuf:"varint,7,opt,name=action,proto3,enum=proto.Action" json:"action,omitempty"`
	State      BranchState `protobuf:"varint,8,opt,name=state,proto3,enum=proto.BranchState" json:"state,omitempty"`
	Level      int64       `protobuf:"varint,9,opt,name=level,proto3" json:"level,omitempty"`
	LastErrMsg string      `protobuf:"bytes,10,opt,name=lastErrMsg,proto3" json:"lastErrMsg,omitempty"`
	// contains filtered or unexported fields
}

func (*GetStateRespBranch) Descriptor deprecated

func (*GetStateRespBranch) Descriptor() ([]byte, []int)

Deprecated: Use GetStateRespBranch.ProtoReflect.Descriptor instead.

func (*GetStateRespBranch) GetAction

func (x *GetStateRespBranch) GetAction() Action

func (*GetStateRespBranch) GetBranchId

func (x *GetStateRespBranch) GetBranchId() string

func (*GetStateRespBranch) GetLastErrMsg

func (x *GetStateRespBranch) GetLastErrMsg() string

func (*GetStateRespBranch) GetLevel

func (x *GetStateRespBranch) GetLevel() int64

func (*GetStateRespBranch) GetProtocol

func (x *GetStateRespBranch) GetProtocol() string

func (*GetStateRespBranch) GetReqData

func (x *GetStateRespBranch) GetReqData() string

func (*GetStateRespBranch) GetReqHeader

func (x *GetStateRespBranch) GetReqHeader() string

func (*GetStateRespBranch) GetState

func (x *GetStateRespBranch) GetState() BranchState

func (*GetStateRespBranch) GetTranType

func (x *GetStateRespBranch) GetTranType() TranType

func (*GetStateRespBranch) GetUri

func (x *GetStateRespBranch) GetUri() string

func (*GetStateRespBranch) ProtoMessage

func (*GetStateRespBranch) ProtoMessage()

func (*GetStateRespBranch) ProtoReflect

func (x *GetStateRespBranch) ProtoReflect() protoreflect.Message

func (*GetStateRespBranch) Reset

func (x *GetStateRespBranch) Reset()

func (*GetStateRespBranch) String

func (x *GetStateRespBranch) String() string

func (*GetStateRespBranch) Validate

func (m *GetStateRespBranch) Validate() error

Validate checks the field values on GetStateRespBranch with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetStateRespBranch) ValidateAll

func (m *GetStateRespBranch) ValidateAll() error

ValidateAll checks the field values on GetStateRespBranch with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetStateRespBranchMultiError, or nil if none found.

type GetStateRespBranchMultiError

type GetStateRespBranchMultiError []error

GetStateRespBranchMultiError is an error wrapping multiple validation errors returned by GetStateRespBranch.ValidateAll() if the designated constraints aren't met.

func (GetStateRespBranchMultiError) AllErrors

func (m GetStateRespBranchMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetStateRespBranchMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetStateRespBranchValidationError

type GetStateRespBranchValidationError struct {
	// contains filtered or unexported fields
}

GetStateRespBranchValidationError is the validation error returned by GetStateRespBranch.Validate if the designated constraints aren't met.

func (GetStateRespBranchValidationError) Cause

Cause function returns cause value.

func (GetStateRespBranchValidationError) Error

Error satisfies the builtin error interface

func (GetStateRespBranchValidationError) ErrorName

ErrorName returns error name.

func (GetStateRespBranchValidationError) Field

Field function returns field value.

func (GetStateRespBranchValidationError) Key

Key function returns key value.

func (GetStateRespBranchValidationError) Reason

Reason function returns reason value.

type GetStateRespMultiError

type GetStateRespMultiError []error

GetStateRespMultiError is an error wrapping multiple validation errors returned by GetStateResp.ValidateAll() if the designated constraints aren't met.

func (GetStateRespMultiError) AllErrors

func (m GetStateRespMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetStateRespMultiError) Error

func (m GetStateRespMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type GetStateRespValidationError

type GetStateRespValidationError struct {
	// contains filtered or unexported fields
}

GetStateRespValidationError is the validation error returned by GetStateResp.Validate if the designated constraints aren't met.

func (GetStateRespValidationError) Cause

Cause function returns cause value.

func (GetStateRespValidationError) Error

Error satisfies the builtin error interface

func (GetStateRespValidationError) ErrorName

func (e GetStateRespValidationError) ErrorName() string

ErrorName returns error name.

func (GetStateRespValidationError) Field

Field function returns field value.

func (GetStateRespValidationError) Key

Key function returns key value.

func (GetStateRespValidationError) Reason

Reason function returns reason value.

type GlobalState

type GlobalState int32
const (
	GlobalState_GLOBAL_DEFAULT         GlobalState = 0
	GlobalState_INIT                   GlobalState = 1
	GlobalState_PHASE1_PROCESSING      GlobalState = 2
	GlobalState_PHASE1_RETRYING        GlobalState = 3
	GlobalState_PHASE1_FAILED          GlobalState = 4
	GlobalState_PHASE1_SUCCESS         GlobalState = 5
	GlobalState_PHASE2_COMMITTING      GlobalState = 6
	GlobalState_PHASE2_ROLLBACKING     GlobalState = 7
	GlobalState_PHASE2_COMMIT_FAILED   GlobalState = 8
	GlobalState_PHASE2_ROLLBACK_FAILED GlobalState = 9
	GlobalState_COMMITTED              GlobalState = 10
	GlobalState_ROLLBACKED             GlobalState = 11
)

func (GlobalState) Descriptor

func (GlobalState) Enum

func (x GlobalState) Enum() *GlobalState

func (GlobalState) EnumDescriptor deprecated

func (GlobalState) EnumDescriptor() ([]byte, []int)

Deprecated: Use GlobalState.Descriptor instead.

func (GlobalState) Number

func (x GlobalState) Number() protoreflect.EnumNumber

func (GlobalState) String

func (x GlobalState) String() string

func (GlobalState) Type

type RegisterReq

type RegisterReq struct {
	GId      string                `protobuf:"bytes,1,opt,name=gId,proto3" json:"gId,omitempty"`
	Branches []*RegisterReq_Branch `protobuf:"bytes,2,rep,name=branches,proto3" json:"branches,omitempty"`
	// contains filtered or unexported fields
}

Register

func (*RegisterReq) Descriptor deprecated

func (*RegisterReq) Descriptor() ([]byte, []int)

Deprecated: Use RegisterReq.ProtoReflect.Descriptor instead.

func (*RegisterReq) GetBranches

func (x *RegisterReq) GetBranches() []*RegisterReq_Branch

func (*RegisterReq) GetGId

func (x *RegisterReq) GetGId() string

func (*RegisterReq) ProtoMessage

func (*RegisterReq) ProtoMessage()

func (*RegisterReq) ProtoReflect

func (x *RegisterReq) ProtoReflect() protoreflect.Message

func (*RegisterReq) Reset

func (x *RegisterReq) Reset()

func (*RegisterReq) String

func (x *RegisterReq) String() string

func (*RegisterReq) Validate

func (m *RegisterReq) Validate() error

Validate checks the field values on RegisterReq with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RegisterReq) ValidateAll

func (m *RegisterReq) ValidateAll() error

ValidateAll checks the field values on RegisterReq with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RegisterReqMultiError, or nil if none found.

type RegisterReqMultiError

type RegisterReqMultiError []error

RegisterReqMultiError is an error wrapping multiple validation errors returned by RegisterReq.ValidateAll() if the designated constraints aren't met.

func (RegisterReqMultiError) AllErrors

func (m RegisterReqMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RegisterReqMultiError) Error

func (m RegisterReqMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type RegisterReqValidationError

type RegisterReqValidationError struct {
	// contains filtered or unexported fields
}

RegisterReqValidationError is the validation error returned by RegisterReq.Validate if the designated constraints aren't met.

func (RegisterReqValidationError) Cause

Cause function returns cause value.

func (RegisterReqValidationError) Error

Error satisfies the builtin error interface

func (RegisterReqValidationError) ErrorName

func (e RegisterReqValidationError) ErrorName() string

ErrorName returns error name.

func (RegisterReqValidationError) Field

Field function returns field value.

func (RegisterReqValidationError) Key

Key function returns key value.

func (RegisterReqValidationError) Reason

Reason function returns reason value.

type RegisterReq_Branch

type RegisterReq_Branch struct {
	Uri       string   `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"`
	ReqData   string   `protobuf:"bytes,2,opt,name=reqData,proto3" json:"reqData,omitempty"`
	ReqHeader string   `protobuf:"bytes,3,opt,name=reqHeader,proto3" json:"reqHeader,omitempty"`
	TranType  TranType `protobuf:"varint,4,opt,name=tranType,proto3,enum=proto.TranType" json:"tranType,omitempty"`
	Protocol  string   `protobuf:"bytes,5,opt,name=protocol,proto3" json:"protocol,omitempty"`
	Action    Action   `protobuf:"varint,6,opt,name=action,proto3,enum=proto.Action" json:"action,omitempty"`
	Level     int32    `protobuf:"varint,7,opt,name=level,proto3" json:"level,omitempty"`
	Timeout   int32    `protobuf:"varint,8,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisterReq_Branch) Descriptor deprecated

func (*RegisterReq_Branch) Descriptor() ([]byte, []int)

Deprecated: Use RegisterReq_Branch.ProtoReflect.Descriptor instead.

func (*RegisterReq_Branch) GetAction

func (x *RegisterReq_Branch) GetAction() Action

func (*RegisterReq_Branch) GetLevel

func (x *RegisterReq_Branch) GetLevel() int32

func (*RegisterReq_Branch) GetProtocol

func (x *RegisterReq_Branch) GetProtocol() string

func (*RegisterReq_Branch) GetReqData

func (x *RegisterReq_Branch) GetReqData() string

func (*RegisterReq_Branch) GetReqHeader

func (x *RegisterReq_Branch) GetReqHeader() string

func (*RegisterReq_Branch) GetTimeout

func (x *RegisterReq_Branch) GetTimeout() int32

func (*RegisterReq_Branch) GetTranType

func (x *RegisterReq_Branch) GetTranType() TranType

func (*RegisterReq_Branch) GetUri

func (x *RegisterReq_Branch) GetUri() string

func (*RegisterReq_Branch) ProtoMessage

func (*RegisterReq_Branch) ProtoMessage()

func (*RegisterReq_Branch) ProtoReflect

func (x *RegisterReq_Branch) ProtoReflect() protoreflect.Message

func (*RegisterReq_Branch) Reset

func (x *RegisterReq_Branch) Reset()

func (*RegisterReq_Branch) String

func (x *RegisterReq_Branch) String() string

func (*RegisterReq_Branch) Validate

func (m *RegisterReq_Branch) Validate() error

Validate checks the field values on RegisterReq_Branch with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RegisterReq_Branch) ValidateAll

func (m *RegisterReq_Branch) ValidateAll() error

ValidateAll checks the field values on RegisterReq_Branch with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RegisterReq_BranchMultiError, or nil if none found.

type RegisterReq_BranchMultiError

type RegisterReq_BranchMultiError []error

RegisterReq_BranchMultiError is an error wrapping multiple validation errors returned by RegisterReq_Branch.ValidateAll() if the designated constraints aren't met.

func (RegisterReq_BranchMultiError) AllErrors

func (m RegisterReq_BranchMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RegisterReq_BranchMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type RegisterReq_BranchValidationError

type RegisterReq_BranchValidationError struct {
	// contains filtered or unexported fields
}

RegisterReq_BranchValidationError is the validation error returned by RegisterReq_Branch.Validate if the designated constraints aren't met.

func (RegisterReq_BranchValidationError) Cause

Cause function returns cause value.

func (RegisterReq_BranchValidationError) Error

Error satisfies the builtin error interface

func (RegisterReq_BranchValidationError) ErrorName

ErrorName returns error name.

func (RegisterReq_BranchValidationError) Field

Field function returns field value.

func (RegisterReq_BranchValidationError) Key

Key function returns key value.

func (RegisterReq_BranchValidationError) Reason

Reason function returns reason value.

type RegisterResp

type RegisterResp struct {
	// contains filtered or unexported fields
}

func (*RegisterResp) Descriptor deprecated

func (*RegisterResp) Descriptor() ([]byte, []int)

Deprecated: Use RegisterResp.ProtoReflect.Descriptor instead.

func (*RegisterResp) ProtoMessage

func (*RegisterResp) ProtoMessage()

func (*RegisterResp) ProtoReflect

func (x *RegisterResp) ProtoReflect() protoreflect.Message

func (*RegisterResp) Reset

func (x *RegisterResp) Reset()

func (*RegisterResp) String

func (x *RegisterResp) String() string

func (*RegisterResp) Validate

func (m *RegisterResp) Validate() error

Validate checks the field values on RegisterResp with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RegisterResp) ValidateAll

func (m *RegisterResp) ValidateAll() error

ValidateAll checks the field values on RegisterResp with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RegisterRespMultiError, or nil if none found.

type RegisterRespMultiError

type RegisterRespMultiError []error

RegisterRespMultiError is an error wrapping multiple validation errors returned by RegisterResp.ValidateAll() if the designated constraints aren't met.

func (RegisterRespMultiError) AllErrors

func (m RegisterRespMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RegisterRespMultiError) Error

func (m RegisterRespMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type RegisterRespValidationError

type RegisterRespValidationError struct {
	// contains filtered or unexported fields
}

RegisterRespValidationError is the validation error returned by RegisterResp.Validate if the designated constraints aren't met.

func (RegisterRespValidationError) Cause

Cause function returns cause value.

func (RegisterRespValidationError) Error

Error satisfies the builtin error interface

func (RegisterRespValidationError) ErrorName

func (e RegisterRespValidationError) ErrorName() string

ErrorName returns error name.

func (RegisterRespValidationError) Field

Field function returns field value.

func (RegisterRespValidationError) Key

Key function returns key value.

func (RegisterRespValidationError) Reason

Reason function returns reason value.

type RollBckReq

type RollBckReq struct {
	GId string `protobuf:"bytes,1,opt,name=gId,proto3" json:"gId,omitempty"`
	// contains filtered or unexported fields
}

func (*RollBckReq) Descriptor deprecated

func (*RollBckReq) Descriptor() ([]byte, []int)

Deprecated: Use RollBckReq.ProtoReflect.Descriptor instead.

func (*RollBckReq) GetGId

func (x *RollBckReq) GetGId() string

func (*RollBckReq) ProtoMessage

func (*RollBckReq) ProtoMessage()

func (*RollBckReq) ProtoReflect

func (x *RollBckReq) ProtoReflect() protoreflect.Message

func (*RollBckReq) Reset

func (x *RollBckReq) Reset()

func (*RollBckReq) String

func (x *RollBckReq) String() string

func (*RollBckReq) Validate

func (m *RollBckReq) Validate() error

Validate checks the field values on RollBckReq with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*RollBckReq) ValidateAll

func (m *RollBckReq) ValidateAll() error

ValidateAll checks the field values on RollBckReq with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in RollBckReqMultiError, or nil if none found.

type RollBckReqMultiError

type RollBckReqMultiError []error

RollBckReqMultiError is an error wrapping multiple validation errors returned by RollBckReq.ValidateAll() if the designated constraints aren't met.

func (RollBckReqMultiError) AllErrors

func (m RollBckReqMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RollBckReqMultiError) Error

func (m RollBckReqMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type RollBckReqValidationError

type RollBckReqValidationError struct {
	// contains filtered or unexported fields
}

RollBckReqValidationError is the validation error returned by RollBckReq.Validate if the designated constraints aren't met.

func (RollBckReqValidationError) Cause

func (e RollBckReqValidationError) Cause() error

Cause function returns cause value.

func (RollBckReqValidationError) Error

Error satisfies the builtin error interface

func (RollBckReqValidationError) ErrorName

func (e RollBckReqValidationError) ErrorName() string

ErrorName returns error name.

func (RollBckReqValidationError) Field

Field function returns field value.

func (RollBckReqValidationError) Key

Key function returns key value.

func (RollBckReqValidationError) Reason

func (e RollBckReqValidationError) Reason() string

Reason function returns reason value.

type StartReq

type StartReq struct {
	GId string `protobuf:"bytes,1,opt,name=gId,proto3" json:"gId,omitempty"`
	// contains filtered or unexported fields
}

func (*StartReq) Descriptor deprecated

func (*StartReq) Descriptor() ([]byte, []int)

Deprecated: Use StartReq.ProtoReflect.Descriptor instead.

func (*StartReq) GetGId

func (x *StartReq) GetGId() string

func (*StartReq) ProtoMessage

func (*StartReq) ProtoMessage()

func (*StartReq) ProtoReflect

func (x *StartReq) ProtoReflect() protoreflect.Message

func (*StartReq) Reset

func (x *StartReq) Reset()

func (*StartReq) String

func (x *StartReq) String() string

func (*StartReq) Validate

func (m *StartReq) Validate() error

Validate checks the field values on StartReq with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*StartReq) ValidateAll

func (m *StartReq) ValidateAll() error

ValidateAll checks the field values on StartReq with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StartReqMultiError, or nil if none found.

type StartReqMultiError

type StartReqMultiError []error

StartReqMultiError is an error wrapping multiple validation errors returned by StartReq.ValidateAll() if the designated constraints aren't met.

func (StartReqMultiError) AllErrors

func (m StartReqMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (StartReqMultiError) Error

func (m StartReqMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type StartReqValidationError

type StartReqValidationError struct {
	// contains filtered or unexported fields
}

StartReqValidationError is the validation error returned by StartReq.Validate if the designated constraints aren't met.

func (StartReqValidationError) Cause

func (e StartReqValidationError) Cause() error

Cause function returns cause value.

func (StartReqValidationError) Error

func (e StartReqValidationError) Error() string

Error satisfies the builtin error interface

func (StartReqValidationError) ErrorName

func (e StartReqValidationError) ErrorName() string

ErrorName returns error name.

func (StartReqValidationError) Field

func (e StartReqValidationError) Field() string

Field function returns field value.

func (StartReqValidationError) Key

func (e StartReqValidationError) Key() bool

Key function returns key value.

func (StartReqValidationError) Reason

func (e StartReqValidationError) Reason() string

Reason function returns reason value.

type TdtmClient

type TdtmClient interface {
	Begin(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*BeginResp, error)
	Register(ctx context.Context, in *RegisterReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// phase1
	Start(ctx context.Context, in *StartReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// phase2 for commit
	Commit(ctx context.Context, in *CommitReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// phase2 for rollback
	Rollback(ctx context.Context, in *RollBckReq, opts ...grpc.CallOption) (*emptypb.Empty, error)
	GetState(ctx context.Context, in *GetStateReq, opts ...grpc.CallOption) (*GetStateResp, error)
}

TdtmClient is the client API for Tdtm service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewTdtmClient

func NewTdtmClient(cc grpc.ClientConnInterface) TdtmClient

type TdtmServer

type TdtmServer interface {
	Begin(context.Context, *emptypb.Empty) (*BeginResp, error)
	Register(context.Context, *RegisterReq) (*emptypb.Empty, error)
	// phase1
	Start(context.Context, *StartReq) (*emptypb.Empty, error)
	// phase2 for commit
	Commit(context.Context, *CommitReq) (*emptypb.Empty, error)
	// phase2 for rollback
	Rollback(context.Context, *RollBckReq) (*emptypb.Empty, error)
	GetState(context.Context, *GetStateReq) (*GetStateResp, error)
	// contains filtered or unexported methods
}

TdtmServer is the server API for Tdtm service. All implementations must embed UnimplementedTdtmServer for forward compatibility.

type TranType

type TranType int32

事务类型

const (
	TranType_UN_KNOW TranType = 0
	TranType_TCC     TranType = 1
	TranType_SAGE    TranType = 2
)

func (TranType) Descriptor

func (TranType) Descriptor() protoreflect.EnumDescriptor

func (TranType) Enum

func (x TranType) Enum() *TranType

func (TranType) EnumDescriptor deprecated

func (TranType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TranType.Descriptor instead.

func (TranType) Number

func (x TranType) Number() protoreflect.EnumNumber

func (TranType) String

func (x TranType) String() string

func (TranType) Type

type UnimplementedTdtmServer

type UnimplementedTdtmServer struct{}

UnimplementedTdtmServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedTdtmServer) Begin

func (UnimplementedTdtmServer) Commit

func (UnimplementedTdtmServer) GetState

func (UnimplementedTdtmServer) Register

func (UnimplementedTdtmServer) Rollback

func (UnimplementedTdtmServer) Start

type UnsafeTdtmServer

type UnsafeTdtmServer interface {
	// contains filtered or unexported methods
}

UnsafeTdtmServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TdtmServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL