Documentation ¶
Overview ¶
Package server implements a publisher/consumer ring-buffer experiment.
Index ¶
Constants ¶
const ( DefaultHostname = "localhost" // The hostname of the server. DefaultPort = 6660 // Port to receive requests: see IANA Port Numbers. DefaultProfPort = 0 // Profiler port to receive requests. * DefaultConsumerHostname = "localhost" // The hostname of the remote consumer server. DefaultConsumerPort = 6660 // The port of the remote consumer server. DefaultIsPublisher = true // Is the server a publisher? true = pub; false = consumer. DefaultMaxConns = 0 // Maximum number of incoming connections allowed (ws and/or web). * DefaultMaxWorkers = 1024 // Maximum number of outgoing worker connections allowed ( to consumer). DefaultRingSize = 4096 // Ring buffer size. Note this should be a power of 2. Ignored if consumer. DefaultMaxProcs = 0 // Maximum number of computer processors to utilize. * )
Variables ¶
This section is empty.
Functions ¶
func PrintUsageAndExit ¶
func PrintUsageAndExit()
PrintUsageAndExit is used to print out command line options.
func PrintVersionAndExit ¶
func PrintVersionAndExit()
PrintVersionAndExit prints the version of the server then exits.
Types ¶
type Info ¶
type Info struct { Version string `json:"version"` // Version of the server. UUID string `json:"UUID"` // Unique ID of the server. Name string `json:"name"` // The name of the server. Hostname string `json:"hostname"` // The hostname of the server. Port int `json:"port"` // Port the server is listening on. MaxConns int `json:"maxConns"` // The maximum concurrent clients accepted. IsPublisher bool `json:"isPublisher"` // Is the server a publisher (true) or a consumer (false)? RingSize int `json:"ringSize"` // The ring buffer size in slots, if publisher else ignored. ConsumerHostname string `json:"consumerHostname"` // The hostname of the consumer server if this is a publisher. ConsumerPort int `json:"consumerPort"` // The port of the consumer server if this is a publisher. MaxWorkers int `json:"maxWorkers"` // The maximum outgoing workers allowed if publisher. ProfPort int `json:"profPort"` // Profiler port the server is listening on. Debug bool `json:"debugEnabled"` // Is debugging enabled on the server. }
Info provides basic config information to/about the running server.
type Ingest ¶
type Ingest struct {
// contains filtered or unexported fields
}
Ingest is a wrapper around an incoming connection to a publishing/consuming server.
type IngestConsumer ¶
type IngestConsumer struct {
*Ingest
}
IngestConsumer is a wrapper around an incoming connection to a publishing server.
func IngestConsumerNew ¶
func IngestConsumerNew(w *websocket.Conn, q chan bool, l *RingoExpLogger, swg *sync.WaitGroup) *IngestConsumer
IngestConsumerNew is a factory function that returns a new IngestConsumer instance
type IngestPublisher ¶
type IngestPublisher struct { *Ingest // contains filtered or unexported fields }
IngestPublisher is a wrapper around an incoming connection to a publishing server.
func IngestPublisherNew ¶
func IngestPublisherNew(w *websocket.Conn, q chan bool, r []int, m *ringbuffer.Manager, l *RingoExpLogger, swg *sync.WaitGroup) *IngestPublisher
IngestPublisherrNew is a factory function that returns a new IngestPublisher instance
type Options ¶
type Options struct { Name string `json:"name"` // The name of the server. Hostname string `json:"hostname"` // The hostname of the server. Port int `json:"port"` // The default port of the server. MaxConns int `json:"maxConns"` // The maximum incoming connections allowed. IsPublisher bool `json:"isPublisher"` // Is the server a publisher (true) or a consumer (false)? RingSize int `json:"ringSize"` // The ring buffer size in slots, if publisher else ignored. ConsumerHostname string `json:"consumerHostname"` // The hostname of the consumer server if this is a publisher. ConsumerPort int `json:"consumerPort"` // The port of the consumer server if this is a publisher. MaxWorkers int `json:"maxWorkers"` // The maximum outgoing workers allowed if publisher. MaxProcs int `json:"maxProcs"` // The maximum number of processor cores available. ProfPort int `json:"profPort"` // The profiler port of the server. Debug bool `json:"debugEnabled"` // Is debugging enabled in the application or server. }
Options represents parameters that are passed to the application to be used in constructing the server.
type RingoExpLogger ¶
RingoExpLogger is an enhancement over the base logger for application logging patterns.
func RingoExpLoggerNew ¶
func RingoExpLoggerNew() *RingoExpLogger
RingoExpLoggerNew is a factory function that returns a new RingoExpLogger instance.
func (*RingoExpLogger) LogConnect ¶
func (l *RingoExpLogger) LogConnect(r *http.Request)
LogConnect is used to log request information when the client first connects to the server.
func (*RingoExpLogger) LogError ¶
func (l *RingoExpLogger) LogError(addr string, msg string)
LogError is used to record misc session error information between server and client.
func (*RingoExpLogger) LogSession ¶
func (l *RingoExpLogger) LogSession(tp string, addr string, msg string)
LogSession is used to record information received during the client's session.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the main structure that represents a server instance.
func (*Server) Shutdown ¶
func (s *Server) Shutdown()
Shutdown takes down the server gracefully back to an initialize state.
func (*Server) StartProfiler ¶
func (s *Server) StartProfiler()
StartProfiler is called to enable dynamic profiling.