Documentation ¶
Index ¶
- Constants
- Variables
- func AddAppConfig(filename string) (config string, err error)
- func AddConfig(filename string) (config string, err error)
- func AddHttpServant(mux HttpHandler, obj string)
- func AddHttpServantWithExceptionStatusChecker(mux HttpHandler, obj string, exceptionStatusChecker func(int) bool)
- func AddServant(v dispatch, f interface{}, obj string)
- func AddServantWithProtocol(proto transport.ServerProtocol, obj string)
- func CheckPanic()
- func DefaultExceptionStatusChecker(statusCode int) bool
- func GetBasePath() string
- func GetClientConfig() *clientConfig
- func GetConf() *conf.Conf
- func GetConfigList() (fList []string, err error)
- func GetDayLogger(name string, numDay int) *rogger.Logger
- func GetHourLogger(name string, numHour int) *rogger.Logger
- func GetLogger(name string) *rogger.Logger
- func GetRemoteLogger(name string) *rogger.Logger
- func GetServerConfig() *serverConfig
- func Hash(str string) uint32
- func HashNew(str string) uint32
- func HashString(str string) uint32
- func MagicStringHash(str string) uint32
- func RegisterAdmin(name string, fn adminFn)
- func RegisterEncoder(encoder Encoder)
- func ReportAvg(key string, i int)
- func ReportCount(key string, i int)
- func ReportDistr(key string, in []int, i int)
- func ReportMax(key string, i int)
- func ReportMin(key string, i int)
- func ReportNotifyInfo(level int32, info string)
- func ReportStatBase(head *statf.StatMicMsgHead, body *statf.StatMicMsgBody, FromServer bool)
- func ReportStatFromClient(msg *Message, succ int32, timeout int32, exec int32)
- func ReportStatFromServer(InterfaceName, MasterName string, ReturnValue int32, TotalRspTime int64)
- func ReportSum(key string, i int)
- func Run(opts ...Option)
- func Trace(traceKey, annotation, client, server, funcName string, ret int32, ...)
- func WithClientInterceptor(interceptors ...ClientInterceptor)
- func WithHttpInterceptor(interceptor ...HttpInterceptor)
- func WithServerInterceptor(interceptors ...ServerInterceptor)
- type AdapterProxy
- func (c *AdapterProxy) Close()
- func (c *AdapterProxy) GetPoint() *endpointf.EndpointF
- func (c *AdapterProxy) ParsePackage(buff []byte) (int, int)
- func (c *AdapterProxy) Recv(pkg []byte)
- func (c *AdapterProxy) SendKeepAlive(req *requestf.RequestPacket) error
- func (c *AdapterProxy) SendPacket(req *requestf.RequestPacket) error
- type Admin
- type AppCache
- type Avg
- type ClientInterceptor
- type Communicator
- func (c *Communicator) GetLocator() string
- func (c *Communicator) GetProperty(key string) (string, bool)
- func (c *Communicator) GetPropertyBool(key string) (bool, bool)
- func (c *Communicator) GetPropertyInt(key string) (int, bool)
- func (c *Communicator) SetLocator(obj string)
- func (c *Communicator) SetProperty(key string, value interface{})
- func (c *Communicator) SetTraceParam(name string)
- func (c *Communicator) StringToProxy(servant string, p ProxyPrx, opts ...EndpointManagerOption)
- type Count
- type Dispatch
- type DispatchReporter
- type Distr
- type Encoder
- type EndpointManager
- type EndpointManagerOption
- type HashType
- type HttpHandler
- type HttpInterceptor
- type Invoke
- type Max
- type Message
- type Min
- type NodeFHelper
- type NotifyHelper
- type ObjCache
- type Option
- type OptionFunc
- type PropertyReport
- type PropertyReportHelper
- type Protocol
- type ProxyPrx
- type RConf
- type RemoteTimeWriter
- func (rw *RemoteTimeWriter) EnablePrefix(hasAppNamePrefix bool)
- func (rw *RemoteTimeWriter) EnableSquareWrapper(hasSquareBracket bool)
- func (rw *RemoteTimeWriter) EnableSuffix(hasSuffix bool)
- func (rw *RemoteTimeWriter) InitFormat(s string)
- func (rw *RemoteTimeWriter) InitServerInfo(app string, server string, filename string, setdivision string)
- func (rw *RemoteTimeWriter) NeedPrefix() bool
- func (rw *RemoteTimeWriter) SetFileNameConcatStr(s string)
- func (rw *RemoteTimeWriter) SetLogType(logType string)
- func (rw *RemoteTimeWriter) SetPrefix(enable bool)
- func (rw *RemoteTimeWriter) SetSeparator(s string)
- func (rw *RemoteTimeWriter) Sync2remote()
- func (rw *RemoteTimeWriter) Write(b []byte)
- type ReportMethod
- type ReportPolicy
- type ServantProxy
- func (s *ServantProxy) Endpoints() []*endpoint.Endpoint
- func (s *ServantProxy) Name() string
- func (s *ServantProxy) SetPushCallback(callback func([]byte))
- func (s *ServantProxy) TarsInvoke(ctx context.Context, cType byte, sFuncName string, buf []byte, ...) error
- func (s *ServantProxy) TarsInvokeOri(ctx context.Context, cType byte, ipport string, sFuncName string, buf []byte) (*requestf.ResponsePacket, error)
- func (s *ServantProxy) TarsSetProtocol(proto model.Protocol)
- func (s *ServantProxy) TarsSetTimeout(t int)
- func (s *ServantProxy) TarsSetVersion(iVersion int16)
- type ServerConfOption
- type ServerInterceptor
- type StatFHelper
- type StatInfo
- type Sum
- type TarsHttpConf
- type TarsHttpMux
- type TarsResponseWriter
Constants ¶
const ( NotifyNormal = 0 NotifyWarn = 1 NotifyError = 2 )
const ( StatSuccess = iota StatFailed )
const ( // Version is tars version Version string = "1.4.5" // AcceptTimeout accept timeout,default value is 500 milliseconds AcceptTimeout = 500 // ReadTimeout zero millisecond for not set read deadline for Conn (better performance) ReadTimeout = 0 // WriteTimeout zero millisecond for not set write deadline for Conn (better performance) WriteTimeout = 0 // HandleTimeout zero millisecond for not set deadline for invoke user interface (better performance) HandleTimeout = 0 // IdleTimeout idle timeout,default value is 600000 milliseconds IdleTimeout = 600000 // ZombieTimeout zombie timeout,default value is 10000 milliseconds ZombieTimeout = 10000 // QueueCap queue gap QueueCap int = 10000000 // Stat default value Stat = "tars.tarsstat.StatObj" // Property default value Property = "tars.tarsproperty.PropertyObj" // ModuleName default value ModuleName = "tup_client" ClientMaxConnSize = 0 // ClientQueueLen client queue length ClientQueueLen int = 10000 // ClientIdleTimeout client idle timeout,default value is 600000 milliseconds ClientIdleTimeout = 600000 // ClientReadTimeout client read timeout,default value is 100 milliseconds ClientReadTimeout = 100 // ClientWriteTimeout client write timeout,default value is 3000 milliseconds ClientWriteTimeout = 3000 // ReqDefaultTimeout request default timeout ReqDefaultTimeout int32 = 3000 // ClientDialTimeout connection dial timeout ClientDialTimeout = 3000 // ObjQueueMax obj queue max number ObjQueueMax int32 = 100000 // PropertyReportInterval property report interval,default value is 10000 milliseconds PropertyReportInterval = 10000 // StatReportInterval stat report interval,default value is 10000 milliseconds StatReportInterval = 10000 // StatReportChannelBufLen stat report channel len StatReportChannelBufLen = 100000 // MainLoopTicker main loop ticker,default value is 10000 milliseconds MainLoopTicker = 10000 // AsyncInvokeTimeout async invoke timeout AsyncInvokeTimeout int = 3000 // TCPReadBuffer tcp read buffer length TCPReadBuffer = 128 * 1024 * 1024 // TCPWriteBuffer tcp write buffer length TCPWriteBuffer = 128 * 1024 * 1024 // TCPNoDelay set tcp no delay TCPNoDelay = false // GracedownTimeout set timeout (milliseconds) for grace shutdown GracedownTimeout = 60000 // MaxPackageLength maximum length of the request MaxPackageLength = 10485760 )
Variables ¶
var ( // TLOG is the logger for tars framework. TLOG = rogger.GetLogger("TLOG") ServerConfigPath string )
var MaxInvoke int32
MaxInvoke number of worker routine to handle client request zero means no control, just one goroutine for a client request. runtime.NumCPU() usually the best performance in the benchmark.
var ( // ReportStat set the default stater(default is `ReportStatFromClient`). ReportStat reportStatFunc = ReportStatFromClient )
Functions ¶
func AddAppConfig ¶
AddAppConfig add app level config
func AddHttpServant ¶
func AddHttpServant(mux HttpHandler, obj string)
AddHttpServant add http servant handler with default exceptionStatusChecker for obj.
func AddHttpServantWithExceptionStatusChecker ¶
func AddHttpServantWithExceptionStatusChecker(mux HttpHandler, obj string, exceptionStatusChecker func(int) bool)
AddHttpServantWithExceptionStatusChecker add http servant handler with exceptionStatusChecker for obj.
func AddServant ¶
func AddServant(v dispatch, f interface{}, obj string)
AddServant add dispatch and interface for object.
func AddServantWithProtocol ¶
func AddServantWithProtocol(proto transport.ServerProtocol, obj string)
AddServantWithProtocol adds a servant with protocol and obj
func DefaultExceptionStatusChecker ¶
DefaultExceptionStatusChecker Default Exception Status Checker
func GetBasePath ¶
func GetBasePath() string
func GetConfigList ¶
GetConfigList get server level config list
func GetDayLogger ¶
GetDayLogger Get a logger roll by day
func GetHourLogger ¶
GetHourLogger Get a logger roll by hour
func GetRemoteLogger ¶
GetRemoteLogger returns a remote logger
func HashString ¶
func MagicStringHash ¶
func RegisterAdmin ¶
func RegisterAdmin(name string, fn adminFn)
RegisterAdmin register admin functions
func RegisterEncoder ¶
func RegisterEncoder(encoder Encoder)
func ReportNotifyInfo ¶
ReportNotifyInfo reports notify information with level and info
func ReportStatBase ¶
func ReportStatBase(head *statf.StatMicMsgHead, body *statf.StatMicMsgBody, FromServer bool)
ReportStatBase is base method for report statistics.
func ReportStatFromClient ¶
ReportStatFromClient report the statics from client.
func ReportStatFromServer ¶
ReportStatFromServer reports statics from server side.
func WithClientInterceptor ¶
func WithClientInterceptor(interceptors ...ClientInterceptor)
func WithHttpInterceptor ¶
func WithHttpInterceptor(interceptor ...HttpInterceptor)
func WithServerInterceptor ¶
func WithServerInterceptor(interceptors ...ServerInterceptor)
Types ¶
type AdapterProxy ¶
type AdapterProxy struct {
// contains filtered or unexported fields
}
AdapterProxy : Adapter proxy
func NewAdapterProxy ¶
func NewAdapterProxy(objName string, point *endpointf.EndpointF, comm *Communicator) *AdapterProxy
NewAdapterProxy create an adapter proxy
func (*AdapterProxy) GetPoint ¶
func (c *AdapterProxy) GetPoint() *endpointf.EndpointF
GetPoint get an endpoint
func (*AdapterProxy) ParsePackage ¶
func (c *AdapterProxy) ParsePackage(buff []byte) (int, int)
ParsePackage : Parse packet from bytes
func (*AdapterProxy) Recv ¶
func (c *AdapterProxy) Recv(pkg []byte)
Recv : Recover read channel when closed for timeout
func (*AdapterProxy) SendKeepAlive ¶
func (c *AdapterProxy) SendKeepAlive(req *requestf.RequestPacket) error
Send : Send keepAlive
func (*AdapterProxy) SendPacket ¶
func (c *AdapterProxy) SendPacket(req *requestf.RequestPacket) error
Send : Send packet
type Admin ¶
type Admin struct {
// contains filtered or unexported fields
}
Admin struct
type AppCache ¶
func GetAppCache ¶
func GetAppCache() AppCache
type Avg ¶
type Avg struct {
// contains filtered or unexported fields
}
Avg for counting average for the report value.
type ClientInterceptor ¶
type ClientInterceptor func(ctx context.Context, msg *Message, invoke Invoke, timeout time.Duration) (err error)
ClientInterceptor is used for filter request & response for client, for implementing plugins like opentracing
type Communicator ¶
type Communicator struct { Client *clientConfig // contains filtered or unexported fields }
Communicator struct
func GetCommunicator ¶
func GetCommunicator() *Communicator
GetCommunicator returns a default communicator
func NewCommunicator ¶
func NewCommunicator(opts ...Option) *Communicator
NewCommunicator returns a new communicator. A Communicator is used for communicating with the server side which should only init once and be global!!!
func (*Communicator) GetLocator ¶
func (c *Communicator) GetLocator() string
GetLocator returns locator as string
func (*Communicator) GetProperty ¶
func (c *Communicator) GetProperty(key string) (string, bool)
GetProperty returns communicator property value as string and true for key, or empty string and false for not exists key
func (*Communicator) GetPropertyBool ¶
func (c *Communicator) GetPropertyBool(key string) (bool, bool)
GetPropertyBool returns communicator property value as bool and true for key, or false and false for not exists key
func (*Communicator) GetPropertyInt ¶
func (c *Communicator) GetPropertyInt(key string) (int, bool)
GetPropertyInt returns communicator property value as int and true for key, or 0 and false for not exists key
func (*Communicator) SetLocator ¶
func (c *Communicator) SetLocator(obj string)
SetLocator sets locator with obj
func (*Communicator) SetProperty ¶
func (c *Communicator) SetProperty(key string, value interface{})
SetProperty sets communicator property with a string key and an interface value. var comm *tars.Communicator comm = tars.NewCommunicator() e.g. comm.SetProperty("locator", "tars.tarsregistry.QueryObj@tcp -h ... -p ...")
func (*Communicator) SetTraceParam ¶
func (c *Communicator) SetTraceParam(name string)
func (*Communicator) StringToProxy ¶
func (c *Communicator) StringToProxy(servant string, p ProxyPrx, opts ...EndpointManagerOption)
StringToProxy sets the servant of ProxyPrx p with a string servant
type Count ¶
type Count struct {
// contains filtered or unexported fields
}
Count is for counting the total of reporting
type Dispatch ¶
type Dispatch func(context.Context, interface{}, *requestf.RequestPacket, *requestf.ResponsePacket, bool) error
Dispatch server side Dispatch
type DispatchReporter ¶
type DispatchReporter func(ctx context.Context, req []interface{}, rsp []interface{}, returns []interface{})
DispatchReporter is the reporter in server-side dispatch, and will be used in logging
type Distr ¶
type Distr struct {
// contains filtered or unexported fields
}
Distr is used for counting the distribution of the reporting values.
type Encoder ¶
func GetEncoder ¶
type EndpointManager ¶
type EndpointManager interface { SelectAdapterProxy(msg *Message) (*AdapterProxy, bool) GetAllEndpoint() []*endpoint.Endpoint // contains filtered or unexported methods }
EndpointManager interface of naming system
func GetManager ¶
func GetManager(comm *Communicator, objName string, opts ...EndpointManagerOption) EndpointManager
GetManager return a endpoint manager from global endpoint manager
type EndpointManagerOption ¶
type EndpointManagerOption interface {
// contains filtered or unexported methods
}
type HttpHandler ¶
type HttpHandler interface { http.Handler SetConfig(cfg *TarsHttpConf) }
type HttpInterceptor ¶
type HttpInterceptor func(w http.ResponseWriter, r *http.Request, handler http.HandlerFunc)
type Max ¶
type Max struct {
// contains filtered or unexported fields
}
Max struct is for counting the Max value for the reporting value.
type Message ¶
type Message struct { Req *requestf.RequestPacket Resp *requestf.ResponsePacket Ser *ServantProxy Adp *AdapterProxy BeginTime int64 EndTime int64 Status int32 // contains filtered or unexported fields }
Message is a struct contains servant information
type Min ¶
type Min struct {
// contains filtered or unexported fields
}
Min is the struct for counting the min value.
type NodeFHelper ¶
type NodeFHelper struct {
// contains filtered or unexported fields
}
NodeFHelper is helper struct.
func (*NodeFHelper) KeepAlive ¶
func (n *NodeFHelper) KeepAlive(adapter string)
KeepAlive sends the keepalive package to the node.
func (*NodeFHelper) ReportVersion ¶
func (n *NodeFHelper) ReportVersion(version string)
ReportVersion report the tars version to the node.
func (*NodeFHelper) SetNodeInfo ¶
func (n *NodeFHelper) SetNodeInfo(comm *Communicator, node string, app string, server string, container string)
SetNodeInfo sets node information with communicator, node name, app name, server and container name
type NotifyHelper ¶
type NotifyHelper struct {
// contains filtered or unexported fields
}
NotifyHelper is the helper struct for the Notify service.
func (*NotifyHelper) ReportNotifyInfo ¶
func (n *NotifyHelper) ReportNotifyInfo(level int32, info string)
ReportNotifyInfo reports notify information with level and info
func (*NotifyHelper) SetNotifyInfo ¶
func (n *NotifyHelper) SetNotifyInfo(comm *Communicator, notify string, app string, server string, container string)
SetNotifyInfo sets the communicator's notify info with communicator, notify name, app name, server name, and container name
type OptionFunc ¶
type OptionFunc struct {
// contains filtered or unexported fields
}
func WithSet ¶
func WithSet(setDivision string) OptionFunc
type PropertyReport ¶
type PropertyReport struct {
// contains filtered or unexported fields
}
PropertyReport property report struct
func CreatePropertyReport ¶
func CreatePropertyReport(key string, argv ...ReportMethod) *PropertyReport
CreatePropertyReport creates the property report instance with the key.
func GetPropertyReport ¶
func GetPropertyReport(key string) *PropertyReport
GetPropertyReport gets the property report instance with the key.
type PropertyReportHelper ¶
type PropertyReportHelper struct {
// contains filtered or unexported fields
}
PropertyReportHelper is helper struct for property report.
var ( // ProHelper is global PropertyReportHelper instance ProHelper *PropertyReportHelper )
func (*PropertyReportHelper) AddToReport ¶
func (p *PropertyReportHelper) AddToReport(pr *PropertyReport)
AddToReport adds the user's PropertyReport to the PropertyReportHelper
func (*PropertyReportHelper) Init ¶
func (p *PropertyReportHelper) Init(comm *Communicator, node string)
Init inits the PropertyReportHelper
func (*PropertyReportHelper) ReportToServer ¶
func (p *PropertyReportHelper) ReportToServer()
ReportToServer report to the remote propertyreport server.
func (*PropertyReportHelper) Run ¶
func (p *PropertyReportHelper) Run()
Run start the properting report goroutine.
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol is struct for dispatch with tars protocol.
func NewTarsProtocol ¶
func NewTarsProtocol(dispatcher dispatch, imp interface{}) *Protocol
NewTarsProtocol return a TarsProtocol with dispatcher and implement interface. withContext explain using context or not.
func (*Protocol) GetCloseMsg ¶
GetCloseMsg return a package to close connection
func (*Protocol) Invoke ¶
Invoke puts the request as []byte and call the dispatcher, and then return the response as []byte.
func (*Protocol) InvokeTimeout ¶
InvokeTimeout indicates how to deal with timeout.
type RConf ¶
type RConf struct {
// contains filtered or unexported fields
}
RConf struct for getting remote config.
func (*RConf) GetAppConfig ¶
GetAppConfig gets the remote config and save it to the path, also return the content.
func (*RConf) GetConfig ¶
GetConfig gets the remote config and save it to the path, also return the content.
func (*RConf) GetConfigList ¶
GetConfigList is discarded.
type RemoteTimeWriter ¶
type RemoteTimeWriter struct {
// contains filtered or unexported fields
}
RemoteTimeWriter writer for writing remote log.
func NewRemoteTimeWriter ¶
func NewRemoteTimeWriter() *RemoteTimeWriter
NewRemoteTimeWriter new and init RemoteTimeWriter
func (*RemoteTimeWriter) EnablePrefix ¶
func (rw *RemoteTimeWriter) EnablePrefix(hasAppNamePrefix bool)
EnablePrefix puts prefix before logs.
func (*RemoteTimeWriter) EnableSquareWrapper ¶
func (rw *RemoteTimeWriter) EnableSquareWrapper(hasSquareBracket bool)
EnableSquareWrapper enables SquareBracket wrapper for the logs.
func (*RemoteTimeWriter) EnableSuffix ¶
func (rw *RemoteTimeWriter) EnableSuffix(hasSuffix bool)
EnableSuffix puts suffix after logs.
func (*RemoteTimeWriter) InitFormat ¶
func (rw *RemoteTimeWriter) InitFormat(s string)
InitFormat sets the log format.
func (*RemoteTimeWriter) InitServerInfo ¶
func (rw *RemoteTimeWriter) InitServerInfo(app string, server string, filename string, setdivision string)
InitServerInfo init the remote log server info.
func (*RemoteTimeWriter) NeedPrefix ¶
func (rw *RemoteTimeWriter) NeedPrefix() bool
NeedPrefix return if you need prefix for the logger.
func (*RemoteTimeWriter) SetFileNameConcatStr ¶
func (rw *RemoteTimeWriter) SetFileNameConcatStr(s string)
SetFileNameConcatStr sets the filename concat string.
func (*RemoteTimeWriter) SetLogType ¶
func (rw *RemoteTimeWriter) SetLogType(logType string)
SetLogType sets the log type.
func (*RemoteTimeWriter) SetPrefix ¶
func (rw *RemoteTimeWriter) SetPrefix(enable bool)
SetPrefix set if you need prefix for the logger.
func (*RemoteTimeWriter) SetSeparator ¶
func (rw *RemoteTimeWriter) SetSeparator(s string)
SetSeparator set separator between logs.
func (*RemoteTimeWriter) Sync2remote ¶
func (rw *RemoteTimeWriter) Sync2remote()
Sync2remote syncs the log buffer to remote.
func (*RemoteTimeWriter) Write ¶
func (rw *RemoteTimeWriter) Write(b []byte)
Write the logs to the buffer.
type ReportMethod ¶
type ReportMethod interface { Enum() ReportPolicy Set(int) Get() string // contains filtered or unexported methods }
ReportMethod is the interface for all kinds of report methods.
type ReportPolicy ¶
type ReportPolicy int
ReportPolicy is report policy
const ( ReportPolicyUnknown ReportPolicy = iota ReportPolicySum // 1 ReportPolicyAvg // 2 ReportPolicyDistr // 3 ReportPolicyMax // 4 ReportPolicyMin // 5 ReportPolicyCount // 6 )
func (ReportPolicy) String ¶
func (p ReportPolicy) String() string
type ServantProxy ¶
type ServantProxy struct {
// contains filtered or unexported fields
}
ServantProxy tars servant proxy instance
func NewServantProxy ¶
func NewServantProxy(comm *Communicator, objName string, opts ...EndpointManagerOption) *ServantProxy
NewServantProxy creates and initializes a servant proxy
func (*ServantProxy) Endpoints ¶
func (s *ServantProxy) Endpoints() []*endpoint.Endpoint
Endpoints returns all active endpoint.Endpoint
func (*ServantProxy) SetPushCallback ¶
func (s *ServantProxy) SetPushCallback(callback func([]byte))
SetPushCallback set callback function for pushing
func (*ServantProxy) TarsInvoke ¶
func (s *ServantProxy) TarsInvoke(ctx context.Context, cType byte, sFuncName string, buf []byte, status map[string]string, reqContext map[string]string, resp *requestf.ResponsePacket) error
TarsInvoke is used for client invoking server.
func (*ServantProxy) TarsInvokeOri ¶
func (s *ServantProxy) TarsInvokeOri(ctx context.Context, cType byte, ipport string, sFuncName string, buf []byte) (*requestf.ResponsePacket, error)
func (*ServantProxy) TarsSetProtocol ¶
func (s *ServantProxy) TarsSetProtocol(proto model.Protocol)
TarsSetProtocol tars set model protocol
func (*ServantProxy) TarsSetTimeout ¶
func (s *ServantProxy) TarsSetTimeout(t int)
TarsSetTimeout sets the timeout for client calling the server , which is in ms.
func (*ServantProxy) TarsSetVersion ¶
func (s *ServantProxy) TarsSetVersion(iVersion int16)
TarsSetVersion set tars version
type ServerConfOption ¶
type ServerConfOption func(*transport.TarsServerConf)
func WithMaxInvoke ¶
func WithMaxInvoke(maxInvoke int32) ServerConfOption
func WithQueueCap ¶
func WithQueueCap(queueCap int) ServerConfOption
func WithTlsConfig ¶
func WithTlsConfig(tlsConfig *tls.Config) ServerConfOption
type ServerInterceptor ¶
type ServerInterceptor func(ctx context.Context, dispatch Dispatch, impl interface{}, req *requestf.RequestPacket, resp *requestf.ResponsePacket) (err error)
ServerInterceptor is used for add Filter for server dispatcher ,for implementing plugins like opentracing.
type StatFHelper ¶
type StatFHelper struct {
// contains filtered or unexported fields
}
StatFHelper is helper struct for stat reporting.
var (
StatReport *StatFHelper
)
StatReport instance pointer of StatFHelper
func (*StatFHelper) Init ¶
func (s *StatFHelper) Init(comm *Communicator, servant string)
Init the StatFHelper
func (*StatFHelper) ReportMicMsg ¶
func (s *StatFHelper) ReportMicMsg(stStatInfo StatInfo, fromServer bool)
ReportMicMsg report the StatInfo ,from server shows whether it comes from server.
type StatInfo ¶
type StatInfo struct { Head statf.StatMicMsgHead Body statf.StatMicMsgBody }
StatInfo struct contains stat info head and body.
type TarsHttpConf ¶
type TarsHttpConf struct { Container string AppName string IP string Port int32 Version string SetId string ExceptionStatusChecker func(int) bool }
TarsHttpConf is configuration for tars http server.
type TarsHttpMux ¶
TarsHttpMux is http.ServeMux for tars http server.
func (*TarsHttpMux) ServeHTTP ¶
func (mux *TarsHttpMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP is the server for the TarsHttpMux.
func (*TarsHttpMux) SetConfig ¶
func (mux *TarsHttpMux) SetConfig(cfg *TarsHttpConf)
SetConfig sets the cfg tho the TarsHttpMux.
type TarsResponseWriter ¶
type TarsResponseWriter struct { http.ResponseWriter StatusCode int }
TarsResponseWriter is http.ResponseWriter for tars.
func (*TarsResponseWriter) Hijack ¶
func (w *TarsResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack add Hijack method for TarsResponseWriter
func (*TarsResponseWriter) WriteHeader ¶
func (w *TarsResponseWriter) WriteHeader(code int)
WriteHeader is used for write the http header with the http code.
Source Files ¶
- adapter.go
- admin.go
- appcache.go
- application.go
- communicator.go
- config.go
- encoder.go
- endpointmanager.go
- filter.go
- hash_func.go
- httpserver.go
- logger.go
- message.go
- nodef.go
- notifyf.go
- options.go
- panic.go
- propertyf.go
- rconfig.go
- registry.go
- remotelogger.go
- servant.go
- servanthandle.go
- setting.go
- statf.go
- tarsprotocol.go
- transport.go
Directories ¶
Path | Synopsis |
---|---|
res/adminf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/authf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/basef
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/configf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/endpointf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/logf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/nodef
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/notifyf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/propertyf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/queryf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/requestf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
res/statf
Code generated by tars2go 1.2.3, DO NOT EDIT.
|
Code generated by tars2go 1.2.3, DO NOT EDIT. |
util
|
|
conf
Package conf implements parse the taf config.
|
Package conf implements parse the taf config. |
set
Package set implement
|
Package set implement |