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 string, 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, uid string) error
- func GroupBroadcast(ctx context.Context, frontendType, groupName, route string, v interface{}) error
- func GroupContainsMember(ctx context.Context, groupName, uid string) (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) ([]string, error)
- func GroupRemoveAll(ctx context.Context, groupName string) error
- func GroupRemoveMember(ctx context.Context, groupName, uid string) 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 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 []string, frontendType string) ([]string, error)
- func SendPushToUsers(route string, v interface{}, uids []string, frontendType string) ([]string, 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 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 ¶ added in v0.7.6
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 ¶ added in v0.7.6
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 ¶ added in v0.7.6
Descriptor returns the protobuf message descriptor for a given message name
func Documentation ¶ added in v0.7.6
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 ¶ added in v0.7.6
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 ¶ added in v0.7.6
GroupAddMember adds UID to group
func GroupBroadcast ¶ added in v0.7.6
func GroupBroadcast(ctx context.Context, frontendType, groupName, route string, v interface{}) error
GroupBroadcast pushes the message to all members inside group
func GroupContainsMember ¶ added in v0.7.6
GroupContainsMember checks whether an UID is contained in group or not
func GroupCountMembers ¶ added in v0.7.6
GroupCountMembers get current member amount in group
func GroupCreate ¶ added in v0.7.6
GroupCreate creates a group
func GroupCreateWithTTL ¶ added in v0.7.6
GroupCreateWithTTL creates a group with given TTL
func GroupDelete ¶ added in v0.7.6
GroupDelete deletes whole group, including UIDs and base group
func GroupMembers ¶ added in v0.7.6
GroupMembers returns all member's UIDs
func GroupRemoveAll ¶ added in v0.7.6
GroupRemoveAll clears all UIDs
func GroupRemoveMember ¶ added in v0.7.6
GroupRemoveMember removes specified UID from group
func GroupRenewTTL ¶ added in v0.7.6
GroupRenewTTL renews group with the initial TTL
func InitGroups ¶ added in v0.7.6
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 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 ¶ added in v0.7.6
func RegisterModuleAfter(module interfaces.Module, name string) error
RegisterModuleAfter registers a module after all registered modules
func RegisterModuleBefore ¶ added in v0.7.6
func RegisterModuleBefore(module interfaces.Module, name string) error
RegisterModuleBefore registers a module before all registered modules
func RegisterRPCJob ¶ added in v0.7.6
RegisterRPCJob registers rpc job to execute jobs with retries
func RegisterRemote ¶
RegisterRemote register a remote component with options
func ReliableRPC ¶ added in v0.7.6
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 ¶ added in v0.7.6
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 ¶ added in v0.7.6
SendKickToUsers sends kick to an user array
func SendPushToUsers ¶
func SendPushToUsers(route string, v interface{}, uids []string, frontendType string) ([]string, 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 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 ¶ added in v0.7.6
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 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. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |