Documentation ¶
Index ¶
- func AddAcceptor(ac acceptor.Acceptor)
- func AddGRPCInfoToMetadata(metadata map[string]string, region string, host, port string, ...) map[string]string
- func AddMetricTagsToPropagateCtx(ctx context.Context, tags map[string]string) context.Context
- func AddMetricsReporter(mr metrics.Reporter)
- func AddRoute(serverType string, routingFunction router.RoutingFunc) error
- func AddToPropagateCtx(ctx context.Context, key string, val interface{}) context.Context
- func AfterHandler(h pipeline.AfterHandlerTempl)
- func BeforeHandler(h pipeline.HandlerTempl)
- func Configure(isFrontend bool, serverType string, serverMode ServerMode, ...)
- func Descriptor(protoName string) ([]byte, error)
- func Documentation(getPtrNames bool) (map[string]interface{}, error)
- func Error(err error, code uint32, metadata ...map[string]string) *errors.Error
- func ExtractSpan(ctx context.Context) (opentracing.SpanContext, error)
- func GetConfig() *config.Config
- func GetDefaultLoggerFromCtx(ctx context.Context) *logger.Logger
- func GetDieChan() chan bool
- func GetFromPropagateCtx(ctx context.Context, key string) interface{}
- func GetMetricsReporters() []metrics.Reporter
- func GetModule(name string) (interfaces.Module, error)
- func GetSerializer() serialize.Serializer
- func GetServer() *cluster.Server
- func GetServerByID(id string) (*cluster.Server, error)
- func GetServerID() string
- func GetServers() []*cluster.Server
- func GetServersByType(t string) (map[string]*cluster.Server, error)
- func GetSessionFromCtx(ctx context.Context) *session.Session
- func GroupAddMember(ctx context.Context, groupName string, uid uint32) error
- func GroupBroadcast(ctx context.Context, frontendType, groupName, route string, v interface{}) error
- func GroupContainsMember(ctx context.Context, groupName string, uid uint32) (bool, error)
- func GroupCountMembers(ctx context.Context, groupName string) (int, error)
- func GroupCreate(ctx context.Context, groupName string) error
- func GroupCreateWithTTL(ctx context.Context, groupName string, ttlTime time.Duration) error
- func GroupDelete(ctx context.Context, groupName string) error
- func GroupMembers(ctx context.Context, groupName string) ([]uint32, error)
- func GroupRemoveAll(ctx context.Context, groupName string) error
- func GroupRemoveMember(ctx context.Context, groupName string, uid uint32) error
- func GroupRenewTTL(ctx context.Context, groupName string) error
- func InitGroups(groupService groups.GroupService)
- func NewAfterTimer(duration time.Duration, fn timer.Func) *timer.Timer
- func NewCondTimer(condition timer.Condition, fn timer.Func) (*timer.Timer, error)
- func NewCountTimer(interval time.Duration, count int, fn timer.Func) *timer.Timer
- func NewSessionTimer(session *session.Session, interval time.Duration, fn timer.Func) *timer.Timer
- func NewTimer(interval time.Duration, fn timer.Func) *timer.Timer
- func RPC(ctx context.Context, routeStr string, reply proto.Message, arg proto.Message) error
- func RPCTo(ctx context.Context, serverID, routeStr string, reply proto.Message, ...) error
- func Register(c component.Component, options ...component.Option)
- func RegisterModule(module interfaces.Module, name string) error
- func RegisterModuleAfter(module interfaces.Module, name string) error
- func RegisterModuleBefore(module interfaces.Module, name string) error
- func RegisterRPCJob(rpcJob worker.RPCJob) error
- func RegisterRemote(c component.Component, options ...component.Option)
- func ReliableRPC(routeStr string, metadata map[string]interface{}, reply, arg proto.Message) (jid string, err error)
- func ReliableRPCWithOptions(routeStr string, metadata map[string]interface{}, reply, arg proto.Message, ...) (jid string, err error)
- func SendKickToUsers(uids []uint32, frontendType string) ([]uint32, error)
- func SendPushToUsers(route string, v interface{}, uids []uint32, frontendType string) ([]uint32, error)
- func SetDebug(debug bool)
- func SetDictionary(dict map[string]uint16) error
- func SetHeartbeatTime(interval time.Duration)
- func SetLogger(l *logger.Logger)
- func SetPacketDecoder(d codec.PacketDecoder)
- func SetPacketEncoder(e codec.PacketEncoder)
- func SetRPCClient(s cluster.RPCClient)
- func SetRPCServer(s cluster.RPCServer)
- func SetRateLimiter(wrapper *acceptor.RateLimiter)
- func SetSerializer(seri serialize.Serializer)
- func SetServiceDiscoveryClient(s cluster.ServiceDiscovery)
- func SetTimerBacklog(c int)
- func SetTimerPrecision(precision time.Duration)
- func Shutdown()
- func Start()
- func StartWorker(config *config.Config) error
- type App
- type ServerMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddGRPCInfoToMetadata ¶
func AddGRPCInfoToMetadata( metadata map[string]string, region string, host, port string, externalHost, externalPort string, ) map[string]string
AddGRPCInfoToMetadata adds host, external host and port into metadata
func AddMetricTagsToPropagateCtx ¶
AddMetricTagsToPropagateCtx adds a key and metric tags that will be propagated through RPC calls. Use the same tags that are at 'pitaya.metrics.additionalTags' config
func AddMetricsReporter ¶
AddMetricsReporter to be used
func AddRoute ¶
func AddRoute( serverType string, routingFunction router.RoutingFunc, ) error
AddRoute adds a routing function to a server type
func AddToPropagateCtx ¶
AddToPropagateCtx adds a key and value that will be propagated through RPC calls
func AfterHandler ¶
func AfterHandler(h pipeline.AfterHandlerTempl)
AfterHandler pushs a function to the back of the functions pipeline that will be executed after the handler method
func BeforeHandler ¶
func BeforeHandler(h pipeline.HandlerTempl)
BeforeHandler pushs a function to the back of the functions pipeline that will be executed before the handler method
func Configure ¶
func Configure( isFrontend bool, serverType string, serverMode ServerMode, serverMetadata map[string]string, cfgs ...*viper.Viper, )
Configure configures the app
func Descriptor ¶
Descriptor returns the protobuf message descriptor for a given message name
func Documentation ¶
Documentation returns handler and remotes documentacion
func ExtractSpan ¶
func ExtractSpan(ctx context.Context) (opentracing.SpanContext, error)
ExtractSpan retrieves an opentracing span context from the given context The span context can be received directly or via an RPC call
func GetDefaultLoggerFromCtx ¶
GetDefaultLoggerFromCtx returns the default logger from the given context
func GetDieChan ¶
func GetDieChan() chan bool
GetDieChan gets the channel that the app sinalizes when its going to die
func GetFromPropagateCtx ¶
GetFromPropagateCtx adds a key and value that came through RPC calls
func GetMetricsReporters ¶
GetMetricsReporters gets registered metrics reporters
func GetModule ¶
func GetModule(name string) (interfaces.Module, error)
GetModule gets a module with a name
func GetSerializer ¶
func GetSerializer() serialize.Serializer
GetSerializer gets the app serializer
func GetServerByID ¶
GetServerByID returns the server with the specified id
func GetServersByType ¶
GetServersByType get all servers of type
func GetSessionFromCtx ¶
GetSessionFromCtx retrieves a session from a given context
func GroupAddMember ¶
GroupAddMember adds UID to group
func GroupBroadcast ¶
func GroupBroadcast(ctx context.Context, frontendType, groupName, route string, v interface{}) error
GroupBroadcast pushes the message to all members inside group
func GroupContainsMember ¶
GroupContainsMember checks whether an UID is contained in group or not
func GroupCountMembers ¶
GroupCountMembers get current member amount in group
func GroupCreate ¶
GroupCreate creates a group
func GroupCreateWithTTL ¶
GroupCreateWithTTL creates a group with given TTL
func GroupDelete ¶
GroupDelete deletes whole group, including UIDs and base group
func GroupMembers ¶
GroupMembers returns all member's UIDs
func GroupRemoveAll ¶
GroupRemoveAll clears all UIDs
func GroupRemoveMember ¶
GroupRemoveMember removes specified UID from group
func GroupRenewTTL ¶
GroupRenewTTL renews group with the initial TTL
func InitGroups ¶
func InitGroups(groupService groups.GroupService)
InitGroups should be called once at the beginning of the application to setup the service type that will manage the groups
func NewAfterTimer ¶
NewAfterTimer returns a new Timer containing a function that will be called after duration that specified by the duration argument. The duration d must be greater than zero; if not, NewAfterTimer will panic. Stop the timer to release associated resources.
func NewCondTimer ¶
NewCondTimer returns a new Timer containing a function that will be called when condition satisfied that specified by the condition argument. The duration d must be greater than zero; if not, NewCondTimer will panic. Stop the timer to release associated resources.
func NewCountTimer ¶
NewCountTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. After count times, timer will be stopped automatically, It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewCountTimer will panic. Stop the timer to release associated resources.
func NewSessionTimer ¶
func NewTimer ¶
NewTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewTimer will panic. Stop the timer to release associated resources.
func RPCTo ¶
func RPCTo(ctx context.Context, serverID, routeStr string, reply proto.Message, arg proto.Message) error
RPCTo send a rpc to a specific server
func RegisterModule ¶
func RegisterModule(module interfaces.Module, name string) error
RegisterModule registers a module, by default it register after registered modules
func RegisterModuleAfter ¶
func RegisterModuleAfter(module interfaces.Module, name string) error
RegisterModuleAfter registers a module after all registered modules
func RegisterModuleBefore ¶
func RegisterModuleBefore(module interfaces.Module, name string) error
RegisterModuleBefore registers a module before all registered modules
func RegisterRPCJob ¶
RegisterRPCJob registers rpc job to execute jobs with retries
func RegisterRemote ¶
RegisterRemote register a remote component with options
func ReliableRPC ¶
func ReliableRPC( routeStr string, metadata map[string]interface{}, reply, arg proto.Message, ) (jid string, err error)
ReliableRPC enqueues RPC to worker so it's executed asynchronously Default enqueue options are used
func ReliableRPCWithOptions ¶
func ReliableRPCWithOptions( routeStr string, metadata map[string]interface{}, reply, arg proto.Message, opts *worker.EnqueueOpts, ) (jid string, err error)
ReliableRPCWithOptions enqueues RPC to worker Receive worker options for this specific RPC
func SendKickToUsers ¶
SendKickToUsers sends kick to an user array
func SendPushToUsers ¶
func SendPushToUsers(route string, v interface{}, uids []uint32, frontendType string) ([]uint32, error)
SendPushToUsers sends a message to the given list of users
func SetHeartbeatTime ¶
SetHeartbeatTime sets the heartbeat time
func SetPacketDecoder ¶
func SetPacketDecoder(d codec.PacketDecoder)
SetPacketDecoder changes the decoder used to parse messages received
func SetPacketEncoder ¶
func SetPacketEncoder(e codec.PacketEncoder)
SetPacketEncoder changes the encoder used to package outgoing messages
func SetRateLimiter ¶
func SetRateLimiter(wrapper *acceptor.RateLimiter)
func SetSerializer ¶
func SetSerializer(seri serialize.Serializer)
SetSerializer customize application serializer, which automatically Marshal and UnMarshal handler payload
func SetServiceDiscoveryClient ¶
func SetServiceDiscoveryClient(s cluster.ServiceDiscovery)
SetServiceDiscoveryClient to be used
func SetTimerBacklog ¶
func SetTimerBacklog(c int)
SetTimerBacklog set the timer created/closing channel backlog, A small backlog may cause the logic to be blocked when call NewTimer/NewCountTimer/timer.Stop in main logic gorontine.
func SetTimerPrecision ¶
SetTimerPrecision set the ticker precision, and time precision can not less than a Millisecond, and can not change after application running. The default precision is time.Second
func StartWorker ¶
StartWorker configures, starts and returns pitaya worker
Types ¶
type ServerMode ¶
type ServerMode byte
ServerMode represents a server mode
const ( // Cluster represents a server running with connection to other servers Cluster ServerMode // Standalone represents a server running without connection to other servers Standalone )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
conn
|
|
codec/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
message/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
examples
|
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package mock_acceptor is a generated GoMock package.
|
Package mock_acceptor is a generated GoMock package. |
pkg
|
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |