Documentation ΒΆ
Index ΒΆ
- Constants
- Variables
- func AppDebug() *zerolog.Event
- func AppError() *zerolog.Event
- func AppFatal() *zerolog.Event
- func AppInfo() *zerolog.Event
- func AppPanic() *zerolog.Event
- func AppTrace() *zerolog.Event
- func AppWarn() *zerolog.Event
- func DebugEnabled() bool
- func DeleteSession(n *Session)
- func DumpDebug() *zerolog.Event
- func DumpError() *zerolog.Event
- func DumpFatal() *zerolog.Event
- func DumpInfo() *zerolog.Event
- func DumpPanic() *zerolog.Event
- func DumpTrace() *zerolog.Event
- func DumpWarn() *zerolog.Event
- func ErrorEnabled() bool
- func FatalEnabled() bool
- func GetBaseAndConfig() (base string, config string)
- func GetBasename(path string) string
- func GetBasepath(path string) string
- func GetFdFromConn(conn net.Conn) int
- func GetFdFromLisener(listener net.Listener) int
- func GetMaxInCount(io string) (c int)
- func InfoEnabled() bool
- func InitLog(level string, outs []string, json bool)
- func LogDebug(name string) *zerolog.Event
- func LogError(name string) *zerolog.Event
- func LogFatal(name string) *zerolog.Event
- func LogInfo(name string) *zerolog.Event
- func LogPanic(name string) *zerolog.Event
- func LogParams() *logParams
- func LogTrace(name string) *zerolog.Event
- func LogWarn(name string) *zerolog.Event
- func NewIoDefault() *ioDefault
- func NewIoPoll() *ioPoll
- func PacketDebug() *zerolog.Event
- func PacketError() *zerolog.Event
- func PacketFatal() *zerolog.Event
- func PacketInfo() *zerolog.Event
- func PacketPanic() *zerolog.Event
- func PacketTrace() *zerolog.Event
- func PacketWarn() *zerolog.Event
- func PanicEnabled() bool
- func PanicParse() (string, error)
- func SetLimit() (err error)
- func StackParse(in string) (out string, err error)
- func StartUp()
- func StopDown(exit func())
- func T2PParse(in []byte) (out []string)
- func T2pOnParse(in []byte) (lenParsed, lenDelimit int, ok bool)
- func T2pParseCommand(in []byte) (out []byte)
- func TraceEnabled() bool
- func WarnEnabled() bool
- func WithLevel(level zerolog.Level) *zerolog.Event
- type Action
- type Alarm
- type App
- func (a *App) Config() *Config
- func (a *App) End()
- func (a *App) MetricCounter(name string) metrics.Counter
- func (a *App) MetricGauge(name string) metrics.Gauge
- func (a *App) MetricMeter(name string) metrics.Meter
- func (a *App) Metrics() *AppMetrics
- func (a *App) Register(s Service)
- func (a *App) Run()
- func (a *App) String() string
- func (a *App) Wait()
- type AppMetrics
- func (m *AppMetrics) GetOrRegisterCounter(name string) metrics.Counter
- func (m *AppMetrics) GetOrRegisterEwma(name string) metrics.EWMA
- func (m *AppMetrics) GetOrRegisterGauge(name string) metrics.Gauge
- func (m *AppMetrics) GetOrRegisterGaugeFloat64(name string) metrics.GaugeFloat64
- func (m *AppMetrics) GetOrRegisterHistogram(name string, s metrics.Sample) metrics.Histogram
- func (m *AppMetrics) GetOrRegisterMeter(name string) metrics.Meter
- func (m *AppMetrics) GetOrRegisterTimer(name string) metrics.Timer
- func (m *AppMetrics) Init(inMetric int)
- func (m *AppMetrics) String() string
- type Buffer
- func (b *Buffer) Begin(pos int) []byte
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Clear(pos int)
- func (b *Buffer) Get(begin, end int) []byte
- func (b *Buffer) GetFrom(begin int) []byte
- func (b *Buffer) GetTo(end int) []byte
- func (b *Buffer) Len() int
- func (b *Buffer) Put(data []byte) ([]byte, int)
- type ByteBuffer
- type Clock
- func (c *Clock) Count() int
- func (c *Clock) Register(name string, alarm Alarm) bool
- func (c *Clock) RegisterWithTime(name string, alarm Alarm, t time.Time) bool
- func (c *Clock) Reset(name string) bool
- func (c *Clock) Unregister(name string) bool
- func (c *Clock) UnregisterAll()
- func (c *Clock) Update(t time.Time)
- type Config
- func (c *Config) Exists(path string) bool
- func (c *Config) Get(key string) interface{}
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetBoolOrDefault(key string, d bool) (bool, bool)
- func (c *Config) GetFloat64(key string) float64
- func (c *Config) GetFloat64OrDefault(key string, d float64) (float64, bool)
- func (c *Config) GetInt(key string) int
- func (c *Config) GetInt32(key string) int32
- func (c *Config) GetInt32OrDefault(key string, d int32) (int32, bool)
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetInt64OrDefault(key string, d int64) (int64, bool)
- func (c *Config) GetIntOrDefault(key string, d int) (int, bool)
- func (c *Config) GetOrDefault(key string, d interface{}) (interface{}, bool)
- func (c *Config) GetString(key string) string
- func (c *Config) GetStringOrDefault(key string, d string) (string, bool)
- func (c *Config) GetUint(key string) uint
- func (c *Config) GetUint32(key string) uint32
- func (c *Config) GetUint32OrDefault(key string, d uint32) (uint32, bool)
- func (c *Config) GetUint64(key string) uint64
- func (c *Config) GetUint64OrDefault(key string, d uint64) (uint64, bool)
- func (c *Config) GetUintOrDefault(key string, d uint) (uint, bool)
- func (c *Config) Load(path string) (err error)
- func (c *Config) Set(key string, value interface{})
- func (c *Config) SetBool(key string, value bool)
- func (c *Config) String() string
- type ConfigIo
- type Context
- type Contexter
- type DivCallback
- type DivMap
- func (d *DivMap) Count() int
- func (d *DivMap) Del(i uint32, k uint64) (v interface{}, ok bool)
- func (d *DivMap) Get(i uint32) (s *UnsafeMap, err error)
- func (d *DivMap) GetCounts() []int
- func (d *DivMap) GetCurrent() (c uint32, s *UnsafeMap)
- func (d *DivMap) GetLeast() (i uint32, s *UnsafeMap)
- func (d *DivMap) IsValidIndex(i uint32) bool
- func (d *DivMap) Set(k uint64, v interface{}) (uint32, *UnsafeMap)
- type EnvApp
- type Event
- type EventQueue
- func (q *EventQueue) AppendAll(events ...interface{})
- func (q *EventQueue) Convey() int
- func (q *EventQueue) ConveySlice(s ...interface{})
- func (q *EventQueue) Dispatching(t time.Time, l int) (int, int)
- func (q *EventQueue) GetClock() *Clock
- func (q *EventQueue) Inject(event interface{})
- func (q *EventQueue) InjectToAwait(event interface{})
- func (q *EventQueue) Paste(events []interface{})
- type Fnv32
- type Fnv64
- type IOs
- type Io
- func (i *Io) End()
- func (i *Io) GetIoModel() IoModel
- func (i *Io) Init()
- func (i *Io) Listen(addr *net.TCPAddr) (ok bool)
- func (i *Io) Run(addr *net.TCPAddr) (ok bool)
- func (i *Io) SetIoModel(ioModel IoModel)
- func (i *Io) Shut()
- func (i *Io) Shutdown(n *Session, how int) error
- func (i *Io) String() string
- func (i *Io) Terminate()
- type IoHost
- func (h *IoHost) AddRoom(key string, room interface{})
- func (h *IoHost) CountUser() int
- func (h *IoHost) DelDivision(d uint32, k uint64) (ok bool)
- func (h *IoHost) DelRoom(key string) bool
- func (h *IoHost) Dispatching(t time.Time, limit int) (int, int)
- func (h *IoHost) End()
- func (h *IoHost) EnterUser(uid UID, i interface{})
- func (h *IoHost) FindOrEnterUser(uid UID, i interface{}) bool
- func (h *IoHost) FindRoom(key string) interface{}
- func (h *IoHost) FindUser(uid UID) (interface{}, bool)
- func (h *IoHost) GetDivision() *DivMap
- func (h *IoHost) GetEventQueue() *EventQueue
- func (h *IoHost) LeaveUser(uid UID)
- func (h *IoHost) ListUser() (out string)
- func (h *IoHost) PostAllToQueue(l []interface{})
- func (h *IoHost) PostToQueue(i interface{})
- func (h *IoHost) Register(p unsafe.Pointer, v interface{}) (d uint32, ok bool)
- func (h *IoHost) RunDivision(t time.Time, callback DivCallback)
- func (h *IoHost) SetDivision(k uint64, v interface{}) (d uint32, ok bool)
- func (h *IoHost) String() string
- func (h *IoHost) Terminate(safe bool)
- func (h *IoHost) Unregister(p unsafe.Pointer, d uint32) (ok bool)
- type IoModel
- type Job
- type Listener
- type MqttClient
- func (m *MqttClient) Close()
- func (m *MqttClient) Connect() (err error)
- func (m *MqttClient) IsConnected() bool
- func (m *MqttClient) Publish(topic string, retained bool, payload []byte) (err error)
- func (m *MqttClient) PublishNoWait(topic string, retained bool, payload []byte)
- func (m *MqttClient) SafeClose()
- func (m *MqttClient) String() string
- func (m *MqttClient) Subscribe(topic string, callback mqtt.MessageHandler) (err error)
- func (m *MqttClient) SubscribeMulti(topics map[string]byte, callback mqtt.MessageHandler) (err error)
- func (m *MqttClient) SubscribeMultiNoWait(topics map[string]byte, callback mqtt.MessageHandler)
- func (m *MqttClient) SubscribeNoWait(topic string, callback mqtt.MessageHandler)
- func (m *MqttClient) Unsubscribe(topics ...string) (err error)
- func (m *MqttClient) UnsubscribeNoWait(topics ...string)
- type OnFilter
- type Poll
- func (p *Poll) Begin() (err error)
- func (p *Poll) ControlAdd(fd int, events uint32) error
- func (p *Poll) ControlDel(fd int, events uint32) error
- func (p *Poll) ControlMod(fd int, events uint32) error
- func (p *Poll) End()
- func (p *Poll) String() string
- func (p *Poll) Trigger(job interface{}) error
- func (p *Poll) Wait(events []unix.EpollEvent, timeout int) (waits int, err error)
- type PollEvent
- type SafeSlice
- func (s *SafeSlice) Append(item interface{})
- func (s *SafeSlice) AppendAll(items ...interface{})
- func (s *SafeSlice) AppendSlice(ss *SafeSlice)
- func (s *SafeSlice) Count() int
- func (s *SafeSlice) Fetch() []interface{}
- func (s *SafeSlice) FetchWithLimit(limit int) []interface{}
- func (s *SafeSlice) FilterOut(f OnFilter) []interface{}
- func (s *SafeSlice) Iterate() <-chan SafeSliceItem
- func (s *SafeSlice) Paste(items []interface{})
- func (s *SafeSlice) Prepend(item interface{})
- func (s *SafeSlice) Shift() (front interface{}, count int)
- type SafeSliceItem
- type Service
- type Session
- func (n *Session) Close() error
- func (n *Session) CountOutQueue() int
- func (n *Session) DecRef() int32
- func (n *Session) GetAddr() (string, bool)
- func (n *Session) GetConn() net.Conn
- func (n *Session) GetContext() interface{}
- func (n *Session) GetFd() int
- func (n *Session) GetIo() *Io
- func (n *Session) GetKeepBuffer() *Buffer
- func (n *Session) GetRemoteIP() string
- func (n *Session) GetStats() interface{}
- func (n *Session) IncRef() int32
- func (n *Session) PostWrite(out []byte) (sent int, err error)
- func (n *Session) SetContext(c interface{})
- func (n *Session) SetStats(s interface{})
- func (n *Session) Shutdown(how int) error
- func (n *Session) String() string
- func (n *Session) SubRef(ref int32) int32
- func (n *Session) Write(out []byte) (sent int, err error)
- type Sockaddr
- type UID
- type UnsafeMap
- func (m *UnsafeMap) Count() int
- func (m *UnsafeMap) Del(key uint64)
- func (m *UnsafeMap) Fetch() map[uint64]interface{}
- func (m *UnsafeMap) Get(key uint64) (interface{}, bool)
- func (m *UnsafeMap) Init()
- func (m *UnsafeMap) Iterate() <-chan UnsafeMapItem
- func (m *UnsafeMap) MarshalJSON() ([]byte, error)
- func (m *UnsafeMap) Set(key uint64, value interface{})
- func (m *UnsafeMap) ToSlice() []UnsafeMapItem
- func (m *UnsafeMap) Upsert(key uint64, new interface{}, callback cmap.UpsertCb) (value interface{})
- type UnsafeMapItem
- type UnsafeSlice
- func (s *UnsafeSlice) Append(item interface{})
- func (s *UnsafeSlice) AppendAll(items ...interface{})
- func (s *UnsafeSlice) AppendSlice(ss *UnsafeSlice)
- func (s *UnsafeSlice) Count() int
- func (s *UnsafeSlice) Fetch() []interface{}
- func (s *UnsafeSlice) FetchWithLimit(limit int) []interface{}
- func (s *UnsafeSlice) FilterOut(f OnFilter) []interface{}
- func (s *UnsafeSlice) Iterate() <-chan UnsafeSliceItem
- func (s *UnsafeSlice) Paste(items []interface{})
- func (s *UnsafeSlice) Prepend(item interface{})
- func (s *UnsafeSlice) Shift() (front interface{}, count int)
- type UnsafeSliceItem
- type WaitResult
- type WriteJob
Constants ΒΆ
const ( // CaptureInterval capture interval CaptureInterval = 100 * time.Millisecond // StatsDInterval capture interval StatsDInterval = 2500 * time.Millisecond // StatsDAddress statsd address StatsDAddress = "127.0.0.1:8125" )
const ( // MetricAppSessionsf app session metric MetricAppSessionsf = "%s.sessions" // MetricAppIoInCountf app io in count metric MetricAppIoInCountf = "%s.io.incount" // MetricAppIoInSizef app io in size metric MetricAppIoInSizef = "%s.io.insize" // MetricAppIoOutCountf app io out count metric MetricAppIoOutCountf = "%s.io.outcount" // MetricAppIoOutSizef app io out size metric MetricAppIoOutSizef = "%s.io.outsize" // MetricPubAppStatesf publish app state metric MetricPubAppStatesf = "%s.pub.appstates" // MetricSubAppStatesf subscribe app state metric MetricSubAppStatesf = "%s.sub.appstates" )
const ( Success int32 = 0 CurlSuccess int32 = 200 ResponseCodeUnpackError int32 = 11 // packet unpack error ResponseCodeMarshalError int32 = 12 // message marshal error ResponseCodeHttpError int32 = 13 // http ν΅μ μλ¬ )
todo range λ³ ν΄λΌ μ‘μ μ μ νλκ²..? ex) 100λ²λλ μλ¬λ¦¬ν΄ ν νμ΄νλ‘ μ΄λ 200λ²λλ μλ¬λ§ μΆλ ₯ μ΄λ°μμΌλ‘... Common
const ( ResponseCodeNotLoggedIn int32 = 101 // λ‘κ·ΈμΈ μνκ° μλ κ²½μ° ResponseCodeAlreadyLoggedOn int32 = 102 // μ΄λ―Έ λ‘κ·ΈμΈ μνμΈ κ²½μ° ResponseCodeDuplicateLogin int32 = 103 // μ€λ³΅λ‘κ·ΈμΈ. ν΄λΌμ΄μΈνΈλ μ΄ μλ¬μ½λλ₯Ό λ°μΌλ©΄ νμ΄νλ‘ μ΄λ. ResponseCodeNotInTheRoom int32 = 104 // λ°©μμ μλ μνκ° μλ κ²½μ° ResponseCodeAlreadyInTheRoom int32 = 105 // μ΄λ―Έ λ°©μμ μλ μνμΈ κ²½μ° ResponseCodeNotWaitingRoom int32 = 104 // λ°©μ΄ μ‘΄μ¬ & μ μ λ₯Ό κΈ°λ€λ¦¬λ μνκ° μλ κ²½μ° ResponseCodeFailToLogon int32 = 201 ResponseCodeFailToLogoff int32 = 202 ResponseCodeFailToReqPvPRandomMatching int32 = 203 ResponseCodeFailToEnterRoom int32 = 204 ResponseCodeFailToReadyPvPGame int32 = 205 )
Frontend & Relayer
const ( ErrNotLoggedon int32 = 101 ErrFailToFindRoom int32 = 103 ErrAlreadyLoginUser int32 = 301 ErrNotExistInRoom int32 = 313 )
todo μΆν μμ μμ , μν μλ²μμ μ¬μ©νλ μ½λλ μλ¨μ μ½λλ‘ κ΅μ²΄ νμ (μ¬μ©νλ μ½λλ μλ¨μλ§ μ‘΄μ¬)
const ( // DefaultDefIOInCount default def IO in count DefaultDefIOInCount = 1 // DefaultPollInCount default poll in count DefaultPollInCount = 4 )
const ( // LogDump dump LogDump = "dump" // LogName name LogName = "name" // LogProject project LogProject = "project" // LogService service LogService = "service" // LogStage stage LogStage = "stage" // LogSuid server unique id LogSuid = "suid" // LogHost host LogHost = "host" // LogObject object LogObject = "object" // LogSession session LogSession = "session" // LogUuid user unique id LogUuid = "uuid" // LogIP ip LogIP = "ip" // LogCode code LogCode = "code" // LogMatchKey match key LogMatchKey = "matchkey" // LogState state LogState = "state" // LogWalltime walltime LogWalltime = "walltime" // LogErrorCode errorcode LogErrorCode = "errorcode" // LogRoom room LogRoom = "room" // LogContext context LogContext = "context" // LogPayload payload LogPayload = "payload" // LogGitHash git last commit hash LogGitHash = "githash" // LogRecover recover LogRecover = "recover" )
const ( // FlagNone default none flag FlagNone int = iota // FlagTerminate terminate flag FlagTerminate // FlagSafeTerminate safe terminate flag FlagSafeTerminate // FlagStop stop listen flag FlagStop // FlagAllout disconnect all flag FlagAllout // FlagTerminateAfter5m exit after 5 minute flag FlagTerminateAfter5m )
const ( // ProdLogger production logger ProdLogger = "prod" // DevLogger development logger DevLogger = "dev" // ExamLogger example logger ExamLogger = "dev" )
const ( // ShutRd shut rd ShutRd = unix.SHUT_RD // ShutWr shut wr ShutWr = unix.SHUT_WR // ShutRdWr shut rdwr ShutRdWr = unix.SHUT_RDWR // SigInt sig int SigInt = syscall.SIGINT // SigTerm sig term SigTerm = syscall.SIGTERM )
const DefaultCapacity int = 5000
DefaultCapacity default capacity
const ( // DefaultInterval default interval DefaultInterval time.Duration = 20 * time.Millisecond )
const ( // Duration5m duration 5 minute Duration5m time.Duration = 5 * time.Second )
const ( // InvalidDivIndex partition invalid index InvalidDivIndex uint32 = ^uint32(0) )
const QueueCapacity int = 5000
QueueCapacity queue default capacity
Variables ΒΆ
var ( // GetByteBuffer returns an empty byte buffer from the pool, exported from gnet/bytebuffer. GetByteBuffer = bytebufferpool.Get // PutByteBuffer returns byte buffer to the pool, exported from gnet/bytebuffer. PutByteBuffer = func(b *ByteBuffer) { if b != nil { bytebufferpool.Put(b) } } )
var UIDInvalid = UID(0)
UIDInvalid uid invalid
Functions ΒΆ
func GetBaseAndConfig ΒΆ
GetBaseAndConfig get base and config
func GetFdFromConn ΒΆ
GetFdFromConn this function is linux only
func GetFdFromLisener ΒΆ
GetFdFromLisener this function is linux only
func T2pOnParse ΒΆ
T2pOnParse control on parse
Types ΒΆ
type Action ΒΆ
type Action int
Action is an action that occurs after the completion of an event.
const ( // None indicates that no action should occur following an event. None Action = iota // Listen listen. Listen // Shut close the listen. Shut // SafeTermiate close the listen and exit when no user. SafeTermiate // Termiate terminate the server. Termiate // TermiateAfter5m shutdown after 5 minute. TermiateAfter5m // CloseAll disconnect all connections. CloseAll // Close disconnect connection. Close )
type Alarm ΒΆ
type Alarm interface { Reset() Check(t time.Time, d time.Duration) bool Ring(name string, t time.Time, c *Clock) bool // returns continue flag }
Alarm alarm interface
type App ΒΆ
type App struct {
// contains filtered or unexported fields
}
App app
func (*App) MetricCounter ΒΆ
MetricCounter get metric counter
func (*App) MetricGauge ΒΆ
MetricGauge get metric gauge
func (*App) MetricMeter ΒΆ
MetricMeter get metric meter
type AppMetrics ΒΆ
type AppMetrics struct {
Registry metrics.Registry
}
AppMetrics app metrics
func (*AppMetrics) GetOrRegisterCounter ΒΆ
func (m *AppMetrics) GetOrRegisterCounter(name string) metrics.Counter
GetOrRegisterCounter get or register counter // // Counters hold an int64 value that can be incremented and decremented.
type Counter interface { Clear() Count() int64 Dec(int64) Inc(int64) Snapshot() Counter }
//
func (*AppMetrics) GetOrRegisterEwma ΒΆ
func (m *AppMetrics) GetOrRegisterEwma(name string) metrics.EWMA
GetOrRegisterEwma get or register EWMA // // EWMAs continuously calculate an exponentially-weighted moving average // based on an outside source of clock ticks.
type EWMA interface { Rate() float64 Snapshot() EWMA Tick() Update(int64) }
//
func (*AppMetrics) GetOrRegisterGauge ΒΆ
func (m *AppMetrics) GetOrRegisterGauge(name string) metrics.Gauge
GetOrRegisterGauge get or register gauge // // Gauges hold an int64 value that can be set arbitrarily.
type Gauge interface { Snapshot() Gauge Update(int64) Value() int64 }
//
func (*AppMetrics) GetOrRegisterGaugeFloat64 ΒΆ
func (m *AppMetrics) GetOrRegisterGaugeFloat64(name string) metrics.GaugeFloat64
GetOrRegisterGaugeFloat64 get or register gauge float64 // // GaugeFloat64s hold a float64 value that can be set arbitrarily.
type GaugeFloat64 interface { Snapshot() GaugeFloat64 Update(float64) Value() float64 }
//
func (*AppMetrics) GetOrRegisterHistogram ΒΆ
func (m *AppMetrics) GetOrRegisterHistogram(name string, s metrics.Sample) metrics.Histogram
GetOrRegisterHistogram get or register histogram // // Histograms calculate distribution statistics from a series of int64 values.
type Histogram interface { Clear() Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 Sample() Sample Snapshot() Histogram StdDev() float64 Sum() int64 Update(int64) Variance() float64 }
//
func (*AppMetrics) GetOrRegisterMeter ΒΆ
func (m *AppMetrics) GetOrRegisterMeter(name string) metrics.Meter
GetOrRegisterMeter get or register meter // // Meters count events to produce exponentially-weighted moving average rates // at one-, five-, and fifteen-minutes and a mean rate.
type Meter interface { Count() int64 Mark(int64) Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64 Snapshot() Meter Stop() }
//
func (*AppMetrics) GetOrRegisterTimer ΒΆ
func (m *AppMetrics) GetOrRegisterTimer(name string) metrics.Timer
GetOrRegisterTimer get or register timer // // Timers capture the duration and rate of events.
type Timer interface { Count() int64 Max() int64 Mean() float64 Min() int64 Percentile(float64) float64 Percentiles([]float64) []float64 Rate1() float64 Rate5() float64 Rate15() float64 RateMean() float64 Snapshot() Timer StdDev() float64 Stop() Sum() int64 Time(func()) Update(time.Duration) UpdateSince(time.Time) Variance() float64 }
//
type Buffer ΒΆ
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a helper type for managing input streams from inside the Data event.
func (*Buffer) Begin ΒΆ
Begin accepts a new packet and returns a working sequence of unprocessed bytes.
type ByteBuffer ΒΆ
type ByteBuffer = bytebufferpool.ByteBuffer
ByteBuffer is the alias of bytebufferpool.ByteBuffer.
type Clock ΒΆ
type Clock struct {
// contains filtered or unexported fields
}
Clock clock
func (*Clock) RegisterWithTime ΒΆ
RegisterWithTime regiseter alarm with time
func (*Clock) Unregister ΒΆ
Unregister unregister alarm
type Config ΒΆ
type Config struct {
// contains filtered or unexported fields
}
Config config
func (*Config) GetBoolOrDefault ΒΆ
GetBoolOrDefault get bool or default value or of key
func (*Config) GetFloat64 ΒΆ
GetFloat64 get float64 value of key
func (*Config) GetFloat64OrDefault ΒΆ
GetFloat64OrDefault get float64 or default value of key
func (*Config) GetInt32OrDefault ΒΆ
GetInt32OrDefault get int32 or default value of key
func (*Config) GetInt64OrDefault ΒΆ
GetInt64OrDefault get int64 or default value of key
func (*Config) GetIntOrDefault ΒΆ
GetIntOrDefault get int or default value of key
func (*Config) GetOrDefault ΒΆ
GetOrDefault get or default
func (*Config) GetStringOrDefault ΒΆ
GetStringOrDefault get string or default value of key
func (*Config) GetUint32OrDefault ΒΆ
GetUint32OrDefault get uint32 or default value of key
func (*Config) GetUint64OrDefault ΒΆ
GetUint64OrDefault get uint64 or default value of key
func (*Config) GetUintOrDefault ΒΆ
GetUintOrDefault get uint or default value of key
type ConfigIo ΒΆ
type ConfigIo struct { ReadBufferLen int InURL string InModel string InCount int InWaitCount int InNoDelay bool InRecvTimeo int InRcvBuff int InSndBuff int InReusePort bool }
ConfigIo config service
func ProvideConfigIo ΒΆ
ProvideConfigIo returns service config
type DivCallback ΒΆ
DivCallback metric callback
type DivMap ΒΆ
type DivMap struct {
// contains filtered or unexported fields
}
DivMap division map
func (*DivMap) GetCurrent ΒΆ
GetCurrent get current partition
func (*DivMap) IsValidIndex ΒΆ
IsValidIndex is valid index
type EnvApp ΒΆ
type EnvApp struct {
// contains filtered or unexported fields
}
EnvApp env app
ELIO_LOG_LEVEL ELIO_LOG_OUTS ELIO_LOG_JSON ELIO_LOG_NOCOLOR ELIO_IN_METRIC ELIO_IN_PPROF
type EventQueue ΒΆ
type EventQueue struct {
// contains filtered or unexported fields
}
EventQueue event queue
func (*EventQueue) AppendAll ΒΆ
func (q *EventQueue) AppendAll(events ...interface{})
AppendAll append all
func (*EventQueue) ConveySlice ΒΆ
func (q *EventQueue) ConveySlice(s ...interface{})
ConveySlice convey slice to event queue
func (*EventQueue) Dispatching ΒΆ
Dispatching dispatching
func (*EventQueue) InjectToAwait ΒΆ
func (q *EventQueue) InjectToAwait(event interface{})
InjectToAwait inject to await
type Io ΒΆ
type Io struct { Listener *Listener //net.Listener Config ConfigIo Host *IoHost Service Service InAddr atomic.String //*net.TCPAddr InCount atomic.Int32 // contains filtered or unexported fields }
Io IO
func (*Io) SetIoModel ΒΆ added in v0.1.2
SetIoModel set IO model
type IoHost ΒΆ
type IoHost struct { Ios []*Io Wg *sync.WaitGroup Url *net.TCPAddr Users map[UID]interface{} Rooms map[string]interface{} //*Room EventQueue *EventQueue Divs *DivMap DivChecked uint32 }
IoHost host
func (*IoHost) DelDivision ΒΆ
DelDivision del division
func (*IoHost) Dispatching ΒΆ
Dispatching dispatching
func (*IoHost) FindOrEnterUser ΒΆ
FindOrEnterUser find or add user
func (*IoHost) GetEventQueue ΒΆ
func (h *IoHost) GetEventQueue() *EventQueue
GetEventQueue get event queue
func (*IoHost) PostAllToQueue ΒΆ
func (h *IoHost) PostAllToQueue(l []interface{})
PostAllToQueue post all to queue
func (*IoHost) PostToQueue ΒΆ
func (h *IoHost) PostToQueue(i interface{})
PostToQueue post to event queue
func (*IoHost) RunDivision ΒΆ
func (h *IoHost) RunDivision(t time.Time, callback DivCallback)
RunDivision run division
func (*IoHost) SetDivision ΒΆ
SetDivision set division
type IoModel ΒΆ added in v0.1.2
type IoModel interface { GetIo() *Io SetIo(c *Io) Listen(addr string) bool Run() bool Shut() // close listen End() // end service Read(n *Session, in []byte) (receipt int, err error) Write(n *Session, out []byte) (sent int, err error) PostWrite(n *Session, out []byte) (sent int, err error) Trigger(job interface{}) error Close(n *Session) error Shutdown(n *Session, how int) error CloseAll() }
Io I/O model
type MqttClient ΒΆ added in v0.1.6
type MqttClient struct {
// contains filtered or unexported fields
}
MqttClient mqtt client
func NewMqttClient ΒΆ added in v0.1.6
func NewMqttClient(broker string, onConnect mqtt.OnConnectHandler) (m *MqttClient)
NewMqttClient new mqtt client
func (*MqttClient) Connect ΒΆ added in v0.1.6
func (m *MqttClient) Connect() (err error)
Connect connect
func (*MqttClient) IsConnected ΒΆ added in v0.1.6
func (m *MqttClient) IsConnected() bool
IsConnected is connected
func (*MqttClient) Publish ΒΆ added in v0.1.6
func (m *MqttClient) Publish(topic string, retained bool, payload []byte) (err error)
Publish publish
token.Wait(): Can also use '<-t.Done()' in releases > 1.2.0
func (*MqttClient) PublishNoWait ΒΆ added in v0.1.6
func (m *MqttClient) PublishNoWait(topic string, retained bool, payload []byte)
PublishNoWait publish no wait
func (*MqttClient) SafeClose ΒΆ added in v0.1.6
func (m *MqttClient) SafeClose()
SafeClose safe close
func (*MqttClient) String ΒΆ added in v0.1.6
func (m *MqttClient) String() string
String object to string
func (*MqttClient) Subscribe ΒΆ added in v0.1.6
func (m *MqttClient) Subscribe(topic string, callback mqtt.MessageHandler) (err error)
Subscribe subscribe
func (*MqttClient) SubscribeMulti ΒΆ added in v0.1.6
func (m *MqttClient) SubscribeMulti(topics map[string]byte, callback mqtt.MessageHandler) (err error)
SubscribeMulti subscribe multi
func (*MqttClient) SubscribeMultiNoWait ΒΆ added in v0.1.6
func (m *MqttClient) SubscribeMultiNoWait(topics map[string]byte, callback mqtt.MessageHandler)
SubscribeMultiNoWait subscribe multi no wait
func (*MqttClient) SubscribeNoWait ΒΆ added in v0.1.6
func (m *MqttClient) SubscribeNoWait(topic string, callback mqtt.MessageHandler)
SubscribeNoWait subscribe async no wait
func (*MqttClient) Unsubscribe ΒΆ added in v0.1.6
func (m *MqttClient) Unsubscribe(topics ...string) (err error)
Unsubscribe unsubscribe
func (*MqttClient) UnsubscribeNoWait ΒΆ added in v0.1.6
func (m *MqttClient) UnsubscribeNoWait(topics ...string)
UnsubscribeNoWait unsubscribe no wait
type Poll ΒΆ
type Poll struct {
// contains filtered or unexported fields
}
Poll event poll object
func (*Poll) ControlAdd ΒΆ
ControlAdd control add
func (*Poll) ControlDel ΒΆ
ControlDel control del
func (*Poll) ControlMod ΒΆ
ControlMod control mod
type SafeSlice ΒΆ
SafeSlice safe slice
func (*SafeSlice) Append ΒΆ
func (s *SafeSlice) Append(item interface{})
Append adds an item to the concurrent slice
func (*SafeSlice) AppendAll ΒΆ
func (s *SafeSlice) AppendAll(items ...interface{})
AppendAll adds an items to the concurrent slice
func (*SafeSlice) AppendSlice ΒΆ
AppendSlice adds an items to the concurrent slice
func (*SafeSlice) FetchWithLimit ΒΆ
FetchWithLimit fetch slice with limit
func (*SafeSlice) Iterate ΒΆ
func (s *SafeSlice) Iterate() <-chan SafeSliceItem
Iterate iterates over the items in the concurrent slice Each item is sent over a channel, so that we can iterate over the slice using the builin range keyword
func (*SafeSlice) Paste ΒΆ
func (s *SafeSlice) Paste(items []interface{})
Paste paste an items to the concurrent slice
type SafeSliceItem ΒΆ
type SafeSliceItem struct { Index int Value interface{} }
SafeSliceItem contains the index/value pair of an item in a concurrent slice
type Service ΒΆ
type Service interface { Name() string OnInit(ctx context.Context, cancel context.CancelFunc) error OnExit() //OnListen(i *IoCore) //OnShut(i *IoCore) OnOpen(s *Session) error OnClose(s *Session, err error) OnError(s *Session, err error) OnRead(s *Session, in []byte) int OnWrite(s *Session, out []byte) OnLoop(host *IoHost, t time.Time, d time.Duration) }
Service service
type Session ΒΆ
type Session struct {
// contains filtered or unexported fields
}
Session session
func (*Session) CountOutQueue ΒΆ
CountOutQueue count out queue
func (*Session) GetKeepBuffer ΒΆ
GetKeepBuffer get keep buffer
type UnsafeMap ΒΆ
type UnsafeMap struct {
Map map[uint64]interface{}
}
UnsafeMap safe map
func (*UnsafeMap) Iterate ΒΆ
func (m *UnsafeMap) Iterate() <-chan UnsafeMapItem
Iterate iterates over the items in a concurrent map Each item is sent over a channel, so that we can iterate over the map using the builtin range keyword
func (*UnsafeMap) MarshalJSON ΒΆ
MarshalJSON marshal json
type UnsafeMapItem ΒΆ
type UnsafeMapItem struct { Key uint64 Value interface{} }
UnsafeMapItem contains a key/value pair item of a concurrent map
type UnsafeSlice ΒΆ
type UnsafeSlice struct {
// contains filtered or unexported fields
}
UnsafeSlice safe slice
func NewUnsafeSlice ΒΆ
func NewUnsafeSlice(c int) *UnsafeSlice
NewUnsafeSlice creates a new concurrent slice
func (*UnsafeSlice) Append ΒΆ
func (s *UnsafeSlice) Append(item interface{})
Append adds an item to the concurrent slice
func (*UnsafeSlice) AppendAll ΒΆ
func (s *UnsafeSlice) AppendAll(items ...interface{})
AppendAll adds an items to the concurrent slice
func (*UnsafeSlice) AppendSlice ΒΆ
func (s *UnsafeSlice) AppendSlice(ss *UnsafeSlice)
AppendSlice adds an items to the concurrent slice
func (*UnsafeSlice) Fetch ΒΆ
func (s *UnsafeSlice) Fetch() []interface{}
Fetch fetch slice and renew
func (*UnsafeSlice) FetchWithLimit ΒΆ
func (s *UnsafeSlice) FetchWithLimit(limit int) []interface{}
FetchWithLimit fetch slice with limit
func (*UnsafeSlice) FilterOut ΒΆ
func (s *UnsafeSlice) FilterOut(f OnFilter) []interface{}
FilterOut filter an items out from the concurrent slice
func (*UnsafeSlice) Iterate ΒΆ
func (s *UnsafeSlice) Iterate() <-chan UnsafeSliceItem
Iterate iterates over the items in the concurrent slice Each item is sent over a channel, so that we can iterate over the slice using the builin range keyword
func (*UnsafeSlice) Paste ΒΆ
func (s *UnsafeSlice) Paste(items []interface{})
Paste paste an items to the concurrent slice
func (*UnsafeSlice) Prepend ΒΆ
func (s *UnsafeSlice) Prepend(item interface{})
Prepend prepend an item to the concurrent slice
func (*UnsafeSlice) Shift ΒΆ
func (s *UnsafeSlice) Shift() (front interface{}, count int)
Shift shift slice and renew
type UnsafeSliceItem ΒΆ
type UnsafeSliceItem struct { Index int Value interface{} }
UnsafeSliceItem contains the index/value pair of an item in a concurrent slice
type WaitResult ΒΆ
type WaitResult struct {
// contains filtered or unexported fields
}
WaitResult wait result
Source Files ΒΆ
- app.go
- app.metrics.go
- buffer.go
- byte.buffer.go
- clock.alarm.go
- config.go
- config.io.go
- context.go
- debug.go
- div.map.go
- elio.go
- env.app.go
- error.code.go
- event.clock.go
- event.go
- event.queue.go
- io.env.go
- io.env.linux.go
- io.go
- io.host.go
- io.listener.go
- io.listener.linux.go
- io.model.default.go
- io.model.go
- io.model.poll.go
- io.poll.go
- io.provider.go
- job.go
- job.linux.go
- log.go
- log.params.go
- mqtt.client.go
- safe.slice.go
- service.go
- session.go
- session.linux.go
- sys.const.linux.go
- t2p.parse.go
- types.go
- unsafe.map.go
- unsafe.slice.go
- util.fnv.go
- util.path.go