tcpserver

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataDirectory      = "data"
	BaseIndexes        = "indexes%s.json"
	BaseData           = "data%s.json"
	BaseFile           = "enwiki-latest-abstract%s.%s"
	BaseURL            = "https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-abstract%s.xml.gz"
	XMLExtension       = "xml"
	GZExtension        = "xml.gz"
	AbstractFilesCount = 28
)
View Source
const (
	QUERY = byte(0)
)

Variables

This section is empty.

Functions

func BytesToUint32

func BytesToUint32(bytes []byte) uint32

func SearchResultsToJSONString

func SearchResultsToJSONString(results engine.SearchResults) (string, error)

Types

type AbstractStruct

type AbstractStruct struct {
	XMLFileName string
	GZFileName  string
	DataDump    string
	IndexDump   string
	URL         string
}

type QueryStruct

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

type Server

type Server struct {
	Host       string
	Port       string
	Network    string
	Indexer    *engine.Indexer
	QuitSignal bool
	Abstracts  []*AbstractStruct
	FileIndex  int
	CleanFlag  bool
}

func NewServer

func NewServer(host string, port string, network string, index int, clean bool) *Server

func (*Server) AcceptConnections

func (s *Server) AcceptConnections() error

func (*Server) Address

func (s *Server) Address() string

func (*Server) GetAbstractStruct

func (s *Server) GetAbstractStruct() *AbstractStruct

func (*Server) HandleRequest

func (s *Server) HandleRequest(connection net.Conn)

func (*Server) HandleResponse

func (s *Server) HandleResponse(response string, connection net.Conn)

func (*Server) InitializeDataDirectory

func (s *Server) InitializeDataDirectory() error

func (*Server) InitializeServer

func (s *Server) InitializeServer() error

func (*Server) ParseQuery

func (s *Server) ParseQuery(query []byte) (*QueryStruct, error)

func (*Server) Signature

func (s *Server) Signature() string

type ServerInterface

type ServerInterface interface {
	Address() string
	Signature() string
	InitializeServer() error
	HandleRequest(connection net.Conn)
	HandleResponse(response string, connection net.Conn)
	ParseQuery(query []byte) (*QueryStruct, error)
	AcceptConnections() error
	GetAbstractStruct() *AbstractStruct
	InitializeDataDirectory() error
}

Jump to

Keyboard shortcuts

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