tcp

package
v0.0.0-...-8a7ea67 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a tcp server that receives commands and interacts with a storage layer

func NewServer

func NewServer(log *logrus.Logger, index index.Indexer, opts ...ServerOption) (*Server, error)

NewServer returns a configured Server instance ready to start serving

func (*Server) Close

func (s *Server) Close() error

Close triggers the server to stop accepting connections and close its store

func (*Server) Serve

func (s *Server) Serve()

Serve starts the server

type ServerOption

type ServerOption func(*options)

ServerOption overrides a default option

func Port

func Port(p string) ServerOption

Port overrides the default port ":8080"

func ReadTimeout

func ReadTimeout(t time.Duration) ServerOption

ReadTimeout overrides the default read timeout to the duration passed in If overriding ShutdownTimeout as well, ReadTimeout should be greater than ShutdownTimeout

func ShutdownTimeout

func ShutdownTimeout(t time.Duration) ServerOption

ShutdownTimeout overrides the default value for how long the server will wait for connections to finish being handled before forcefully shutting down (Server.Serve exits). If ReadTimeout > ShutdownTimeout there may be cases where connections don't get enough time to close before Server.Serve exits.

Jump to

Keyboard shortcuts

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