server

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Self     = protocol.ProtoEventBus
	Peer     = protocol.ProtoEvent
	SelfName = "ebus"
	PeerName = "event"
)

Protocol identity information.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address      string        `json:"address" yaml:"address" toml:"address"`
	TraceMessage bool          `json:"trace_message,omitempty" yaml:"trace_message,omitempty" toml:"trace_message,omitempty"`
	SendChanSize int           `json:"send_chan_size" yaml:"send_chan_size" toml:"send_chan_size"`
	RecvChanSize int           `json:"recv_chan_size" yaml:"recv_chan_size" toml:"recv_chan_size"`
	ReadTimeout  time.Duration `json:"read_timeout" yaml:"read_timeout" toml:"read_timeout"`
}

type Pipe

type Pipe struct {
	// contains filtered or unexported fields
}

func (*Pipe) Close

func (p *Pipe) Close() error

func (*Pipe) Event

func (p *Pipe) Event() uint32

func (*Pipe) GetPrivate

func (p *Pipe) GetPrivate() interface{}

func (*Pipe) ID

func (p *Pipe) ID() uint32

func (*Pipe) LocalAddr

func (p *Pipe) LocalAddr() string

func (*Pipe) Pipe

func (p *Pipe) Pipe() mangos.Pipe

func (*Pipe) RecvMsg

func (p *Pipe) RecvMsg() *mproto.Message

func (*Pipe) RemoteAddr

func (p *Pipe) RemoteAddr() string

func (*Pipe) RemoteID

func (p *Pipe) RemoteID() uint32

func (*Pipe) SendMsg

func (p *Pipe) SendMsg(m *mproto.Message) error

func (*Pipe) SetEvent

func (p *Pipe) SetEvent(v uint32)

func (*Pipe) SetPrivate

func (p *Pipe) SetPrivate(v interface{})

func (*Pipe) Stop

func (p *Pipe) Stop()

type Protocol

type Protocol struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewProtocol

func NewProtocol() *Protocol

NewProtocol returns a new protocol implementation.

func (*Protocol) AddPipe

func (s *Protocol) AddPipe(pp mproto.Pipe) error

func (*Protocol) Close

func (s *Protocol) Close() error

func (*Protocol) GetOption

func (s *Protocol) GetOption(option string) (interface{}, error)

func (*Protocol) Info

func (*Protocol) Info() mproto.Info

func (*Protocol) OpenContext

func (s *Protocol) OpenContext() (mproto.Context, error)

func (*Protocol) Pipe

func (s *Protocol) Pipe(id uint32) protocol.Pipe

func (*Protocol) RangePipes

func (s *Protocol) RangePipes(f func(uint32, protocol.Pipe) bool)

func (*Protocol) RecvMsg

func (s *Protocol) RecvMsg() (*mproto.Message, error)

func (*Protocol) RemovePipe

func (s *Protocol) RemovePipe(pp mproto.Pipe)

func (*Protocol) SendMsg

func (s *Protocol) SendMsg(m *mproto.Message) error

func (*Protocol) SetOption

func (s *Protocol) SetOption(name string, value interface{}) error

func (*Protocol) SetPipeEventHook

func (s *Protocol) SetPipeEventHook(v protocol.PipeEventHook)

func (*Protocol) String

func (s *Protocol) String() string

func (*Protocol) WaitAllPipe

func (s *Protocol) WaitAllPipe()

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *Config) *Server

func (*Server) Broadcast

func (s *Server) Broadcast(data []byte) error

func (*Server) Close

func (s *Server) Close() error

func (*Server) Listen

func (s *Server) Listen(addr string) error

func (*Server) Pipe

func (s *Server) Pipe(id uint32) protocol.Pipe

func (*Server) RangePipes

func (s *Server) RangePipes(f func(uint32, protocol.Pipe) bool)

func (*Server) Send

func (s *Server) Send(src, dest uint32, data []byte) error

func (*Server) SendEvent

func (s *Server) SendEvent(src, event uint32, hash uint64, data []byte) error

func (*Server) Serve

func (s *Server) Serve()

func (*Server) SetReadTimeout

func (s *Server) SetReadTimeout(v time.Duration)

func (*Server) SetRecvSize

func (s *Server) SetRecvSize(v int)

func (*Server) SetSendSize

func (s *Server) SetSendSize(v int)

func (*Server) SetTraceMessage

func (s *Server) SetTraceMessage(trace bool)

func (*Server) Stop

func (s *Server) Stop()

func (*Server) String

func (s *Server) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL