getty

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

View Source
const (
	RpcRequestTimeout = 20 * time.Second
)
View Source
const (
	Seatav1HeaderLength = 16
)

*

  • <pre>
  • 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  • +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
  • | magic |Proto | Full length | Head | Msg |Seria|Compr| RequestID |
  • | code |clVer | (head+body) | Length |Type |lizer|ess | |
  • +-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
  • | |
  • | Head Map [Optional] |
  • +-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
  • | |
  • | body |
  • | |
  • | ... ... |
  • +-----------------------------------------------------------------------------------------------+
  • </pre>
  • <p>
  • <li>Full Length: include all data </li>
  • <li>Head Length: include head data from magic code to head map. </li>
  • <li>Body Length: Full Length - Head Length</li>
  • </p>
  • https://github.com/seata/seata/issues/893

Variables

View Source
var (
	ErrNotEnoughStream = errors.New("packet stream is not enough")
	ErrTooLargePackage = errors.New("package length is exceed the getty package's legal maximum length.")
	ErrInvalidPackage  = errors.New("invalid rpc package")
	ErrIllegalMagic    = errors.New("package magic is not right.")
)

Functions

func GetGettyClientHandlerInstance

func GetGettyClientHandlerInstance() *gettyClientHandler

func InitRpcClient

func InitRpcClient(gettyConfig *Config, seataConfig *SeataConfig)

Types

type Config

type Config struct {
	ReconnectInterval int           `yaml:"reconnect-interval" json:"reconnect-interval" koanf:"reconnect-interval"`
	ConnectionNum     int           `yaml:"connection-num" json:"connection-num" koanf:"connection-num"`
	SessionConfig     SessionConfig `yaml:"session" json:"session" koanf:"session"`
}

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix for Config.

type GettyRemoting

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

func GetGettyRemotingInstance

func GetGettyRemotingInstance() *GettyRemoting

func (*GettyRemoting) GetMergedMessage

func (g *GettyRemoting) GetMergedMessage(msgID int32) *message.MergedWarpMessage

func (*GettyRemoting) GetMessageFuture

func (g *GettyRemoting) GetMessageFuture(msgID int32) *message.MessageFuture

func (*GettyRemoting) NotifyRpcMessageResponse

func (g *GettyRemoting) NotifyRpcMessageResponse(rpcMessage message.RpcMessage)

func (*GettyRemoting) RemoveMergedMessageFuture

func (g *GettyRemoting) RemoveMergedMessageFuture(msgID int32)

func (*GettyRemoting) RemoveMessageFuture

func (g *GettyRemoting) RemoveMessageFuture(msgID int32)

func (*GettyRemoting) SendASync

func (g *GettyRemoting) SendASync(msg message.RpcMessage, s getty.Session, callback callbackMethod) error

func (*GettyRemoting) SendSync

func (g *GettyRemoting) SendSync(msg message.RpcMessage, s getty.Session, callback callbackMethod) (interface{}, error)

type GettyRemotingClient

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

func GetGettyRemotingClient

func GetGettyRemotingClient() *GettyRemotingClient

func (*GettyRemotingClient) SendAsyncRequest

func (client *GettyRemotingClient) SendAsyncRequest(msg interface{}) error

func (*GettyRemotingClient) SendAsyncResponse

func (client *GettyRemotingClient) SendAsyncResponse(msgID int32, msg interface{}) error

func (*GettyRemotingClient) SendSyncRequest

func (client *GettyRemotingClient) SendSyncRequest(msg interface{}) (interface{}, error)

type RpcClient

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

type RpcPackageHandler

type RpcPackageHandler struct{}

func (*RpcPackageHandler) Read

func (p *RpcPackageHandler) Read(ss getty.Session, data []byte) (interface{}, int, error)

func (*RpcPackageHandler) Write

func (p *RpcPackageHandler) Write(ss getty.Session, pkg interface{}) ([]byte, error)

Write write rpc message to binary data

type SeataConfig

type SeataConfig struct {
	ApplicationID        string
	TxServiceGroup       string
	ServiceVgroupMapping flagext.StringMap
	ServiceGrouplist     flagext.StringMap
}

todo refactor config

type SeataV1PackageHeader

type SeataV1PackageHeader struct {
	Magic0       byte
	Magic1       byte
	Version      byte
	TotalLength  uint32
	HeadLength   uint16
	MessageType  message.GettyRequestType
	CodecType    byte
	CompressType byte
	RequestID    uint32
	Meta         map[string]string
	BodyLength   uint32
	Body         interface{}
}

type SessionConfig

type SessionConfig struct {
	CompressEncoding bool          `yaml:"compress-encoding" json:"compress-encoding" koanf:"compress-encoding"`
	TCPNoDelay       bool          `yaml:"tcp-no-delay" json:"tcp-no-delay" koanf:"tcp-no-delay"`
	TCPKeepAlive     bool          `yaml:"tcp-keep-alive" json:"tcp-keep-alive" koanf:"tcp-keep-alive"`
	KeepAlivePeriod  time.Duration `yaml:"keep-alive-period" json:"keep-alive-period" koanf:"keep-alive-period"`
	TCPRBufSize      int           `yaml:"tcp-r-buf-size" json:"tcp-r-buf-size" koanf:"tcp-r-buf-size"`
	TCPWBufSize      int           `yaml:"tcp-w-buf-size" json:"tcp-w-buf-size" koanf:"tcp-w-buf-size"`
	TCPReadTimeout   time.Duration `yaml:"tcp-read-timeout" json:"tcp-read-timeout" koanf:"tcp-read-timeout"`
	TCPWriteTimeout  time.Duration `yaml:"tcp-write-timeout" json:"tcp-write-timeout" koanf:"tcp-write-timeout"`
	WaitTimeout      time.Duration `yaml:"wait-timeout" json:"wait-timeout" koanf:"wait-timeout"`
	MaxMsgLen        int           `yaml:"max-msg-len" json:"max-msg-len" koanf:"max-msg-len"`
	SessionName      string        `yaml:"session-name" json:"session-name" koanf:"session-name"`
	CronPeriod       time.Duration `yaml:"cron-period" json:"cron-period" koanf:"cron-period"`
}

func (*SessionConfig) RegisterFlagsWithPrefix

func (cfg *SessionConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix for Config.

type SessionManager

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

type ShutdownConfig

type ShutdownConfig struct {
	Wait time.Duration `yaml:"wait" json:"wait" konaf:"wait"`
}

func (*ShutdownConfig) RegisterFlagsWithPrefix

func (cfg *ShutdownConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

type TransportConfig

type TransportConfig struct {
	ShutdownConfig                 ShutdownConfig `yaml:"shutdown" json:"shutdown" koanf:"shutdown"`
	Type                           string         `yaml:"type" json:"type" koanf:"type"`
	Server                         string         `yaml:"server" json:"server" koanf:"server"`
	Heartbeat                      bool           `yaml:"heartbeat" json:"heartbeat" koanf:"heartbeat"`
	Serialization                  string         `yaml:"serialization" json:"serialization" koanf:"serialization"`
	Compressor                     string         `yaml:"compressor" json:"compressor" koanf:"compressor"`
	EnableTmClientBatchSendRequest bool           `` /* 129-byte string literal not displayed */
	EnableRmClientBatchSendRequest bool           `` /* 129-byte string literal not displayed */
	RPCRmRequestTimeout            time.Duration  `yaml:"rpc-rm-request-timeout" json:"rpc-rm-request-timeout" koanf:"rpc-rm-request-timeout"`
	RPCTmRequestTimeout            time.Duration  `yaml:"rpc-tm-request-timeout" json:"rpc-tm-request-timeout" koanf:"rpc-tm-request-timeout"`
}

func (*TransportConfig) RegisterFlagsWithPrefix

func (cfg *TransportConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

Jump to

Keyboard shortcuts

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