Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func Ready() <-chan struct{}
- func Serve(opts ...Option)
- func Stopping() bool
- type Group
- func (c *Group) Add(s *session.Session) error
- func (c *Group) Broadcast(route string, v interface{}) error
- func (c *Group) Close() error
- func (c *Group) Contains(uid int64) bool
- func (c *Group) Count() int
- func (c *Group) Leave(s *session.Session) error
- func (c *Group) LeaveAll() error
- func (c *Group) Member(uid int64) (*session.Session, error)
- func (c *Group) Members() []int64
- func (c *Group) Multicast(route string, v interface{}, filter SessionFilter) error
- type Option
- func WithAdvertiseAddr(addr string, retryInterval ...time.Duration) Option
- func WithCodec(c codec.Codec) Option
- func WithComponents(components *component.Components) Option
- func WithDebugAddr(addr string) Option
- func WithDebugMode(debug bool) Option
- func WithEtcd() Option
- func WithGrpcOptions(opts ...grpc.DialOption) Option
- func WithHttpAddr(httpAddr string) Option
- func WithLabel(label string) Option
- func WithLogger(l log.Logger) Option
- func WithMaster() Option
- func WithMasterPersist(persist persist.Persist) Option
- func WithMemberAddr(addr string) Option
- func WithPipeline(pipeline pipeline.Pipeline) Option
- func WithSafeMode(safe bool) Option
- func WithTCPAddr(addr string) Option
- func WithTSLConfig(certificate, key string) Option
- func WithTimerPrecision(precision time.Duration) Option
- func WithVersion(version string) Option
- func WithWebSocketCompression() Option
- type SessionFilter
Constants ¶
const ( Cluster = "cluster" Singleton = "singleton" Frontend = "frontend" Backend = "backend" )
Variables ¶
var ( ErrCloseClosedGroup = errors.New("close closed group") ErrClosedGroup = errors.New("group closed") ErrMemberNotFound = errors.New("member not found in the group") ErrSessionDuplication = errors.New("session is already in the current group") ErrNilSession = errors.New("nil session") )
Errors that could be occurred during message handling.
Functions ¶
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a session group which used to manage a number of sessions, data send to the group will send to all session in it.
type Option ¶
Option defines a type for option, an option is a func operate options.NodeOptions
func WithAdvertiseAddr ¶ added in v1.0.0
WithAdvertiseAddr sets the advertise address option, it will be the listen address in master node and an advertise address which cluster member to connect
func WithComponents ¶ added in v1.0.0
func WithComponents(components *component.Components) Option
WithComponents sets the Components
func WithDebugAddr ¶ added in v1.0.0
WithDebugAddr works with debug http addr
func WithDebugMode ¶ added in v1.0.0
WithDebugMode makes 'nano' run under Debug mode.
func WithGrpcOptions ¶ added in v1.0.0
func WithGrpcOptions(opts ...grpc.DialOption) Option
WithGrpcOptions sets the grpc dial options
func WithHttpAddr ¶ added in v1.0.0
WithHttpAddr sets the independent http address
func WithLogger ¶ added in v1.0.0
WithLogger overrides the default logger
func WithMaster ¶ added in v1.0.0
func WithMaster() Option
WithMaster sets the option to indicate whether the current node is master node
func WithMasterPersist ¶ added in v1.0.0
WithMasterPersist sets the persist of cluster
func WithMemberAddr ¶ added in v1.0.1
func WithPipeline ¶
WithPipeline sets the pipeline option.
func WithSafeMode ¶ added in v1.0.0
WithSafeMode makes 'nano' run under Safe mode.
func WithTCPAddr ¶ added in v1.0.1
WithTCPAddr sets the listen address which is used to establish connection between cluster members. Will select an available port automatically if no member address setting and panic if no available port
func WithTSLConfig ¶ added in v1.0.0
WithTSLConfig sets the `key` and `certificate` of TSL
func WithTimerPrecision ¶ added in v1.0.0
WithTimerPrecision sets 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 WithVersion ¶ added in v1.0.0
WithVersion sets the current node version in cluster
func WithWebSocketCompression ¶ added in v1.1.32
func WithWebSocketCompression() Option
type SessionFilter ¶
SessionFilter represents a filter which was used to filter session when Multicast, the session will receive the message while filter returns true.
Directories ¶
Path | Synopsis |
---|---|
benchmark
|
|
env represents the environment of the current process, includes work path and config path etc.
|
env represents the environment of the current process, includes work path and config path etc. |