worker

package
v0.0.0-...-68ec166 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MoreDataToGet more records to get from ACP
	MoreDataToGet = 0
	// NoMoreDataToGet no more records to get from ACP
	NoMoreDataToGet = 1
	// RecordNotFound record was not found
	RecordNotFound = 1
)

Variables

This section is empty.

Functions

func StartWorker

func StartWorker(port string, name string, offline bool)

StartWorker register struct and start RPC worker server

Types

type Acp

type Acp struct {
	Name string
	// contains filtered or unexported fields
}

Acp holds I/O buffer to communicate with Magik ACP

func NewAcp

func NewAcp(name string) *Acp

NewAcp creates and init new Acp with name

func (*Acp) Connect

func (a *Acp) Connect(processName string, protocolMin, protocolMax int) (err error)

Connect verify connection and protocol to Acp

func (*Acp) EstablishProtocol

func (a *Acp) EstablishProtocol(minProtocol, maxProtocol int) bool

EstablishProtocol checks Acp protocol

func (*Acp) Flush

func (a *Acp) Flush()

Flush send buffer data

func (*Acp) Get

func (a *Acp) Get(dataType string) (value interface{}, err *AcpErr)

Get method reads dataType value from ACP

func (*Acp) GetBool

func (a *Acp) GetBool() bool

GetBool reads boolean value from Acp input

func (*Acp) GetByte

func (a *Acp) GetByte() int

GetByte reads byte from Acp input

func (*Acp) GetCoord

func (a *Acp) GetCoord() [2]float64

GetCoord return coordinate

func (*Acp) GetFloat

func (a *Acp) GetFloat() float64

GetFloat read float64 from Acp input

func (*Acp) GetInt

func (a *Acp) GetInt() int

GetInt reads unsigned int from Acp input

func (*Acp) GetLong

func (a *Acp) GetLong() int64

GetLong reads long from Acp input

func (*Acp) GetShort

func (a *Acp) GetShort() int

GetShort reads short from Acp input

func (*Acp) GetShortFloat

func (a *Acp) GetShortFloat() float32

GetShortFloat read float32 from Acp input

func (*Acp) GetString

func (a *Acp) GetString() string

GetString reads string from Acp input

func (*Acp) GetULong

func (a *Acp) GetULong() uint64

GetULong reads unsigned long from Acp input

func (*Acp) GetUShort

func (a *Acp) GetUShort() int

GetUShort reads unsigned short from Acp input

func (*Acp) GetUbyte

func (a *Acp) GetUbyte() int

GetUbyte reads unsigned byte from Acp input

func (*Acp) GetUint

func (a *Acp) GetUint() int

GetUint reads unsigned int from Acp input

func (*Acp) Put

func (a *Acp) Put(dataType string, value interface{}) (err error)

Put convert value to dataType and send this value to ACP

func (*Acp) PutBool

func (a *Acp) PutBool(b bool)

PutBool sends boolean value to Acp output

func (*Acp) PutByte

func (a *Acp) PutByte(value int8)

PutByte sends byte value to Acp output

func (*Acp) PutFloat

func (a *Acp) PutFloat(value float64)

PutFloat sends float value to Acp output

func (*Acp) PutInt

func (a *Acp) PutInt(value int32)

PutInt sends int value to Acp output

func (*Acp) PutLong

func (a *Acp) PutLong(value int64)

PutLong sends long value to Acp output

func (*Acp) PutShort

func (a *Acp) PutShort(value int16)

PutShort sends short value to Acp output

func (*Acp) PutShortFloat

func (a *Acp) PutShortFloat(value float32)

PutShortFloat sends short float value to Acp output

func (*Acp) PutString

func (a *Acp) PutString(s string)

PutString sends string value to Acp output

func (*Acp) PutULong

func (a *Acp) PutULong(value uint64)

PutULong sends unsigned long value to Acp output

func (*Acp) PutUShort

func (a *Acp) PutUShort(value uint16)

PutUShort sends unsigned short value to Acp output

func (*Acp) PutUbyte

func (a *Acp) PutUbyte(value uint8)

PutUbyte sends unsigned byte value to Acp output

func (*Acp) PutUint

func (a *Acp) PutUint(value uint32)

PutUint sends int value to Acp output

func (*Acp) ReadNumber

func (a *Acp) ReadNumber(data interface{})

ReadNumber reads number from Acp input

func (*Acp) VerifyConnection

func (a *Acp) VerifyConnection(name string) bool

VerifyConnection verify Acp process name

func (*Acp) Write

func (a *Acp) Write(buf []byte)

Write writes buffer to Acp output

type AcpErr

type AcpErr struct {
	Err string
}

AcpErr ACP error

func NewAcpErr

func NewAcpErr(msg string) *AcpErr

NewAcpErr new error

func NewAcpErrf

func NewAcpErrf(format string, args ...interface{}) *AcpErr

NewAcpErrf new error from formated string

func (*AcpErr) Error

func (err *AcpErr) Error() string

Error implements error interface

type BBox

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

BBox struct to support Bounding box operations

func NewBBox

func NewBBox(n, w, s, e float64) *BBox

NewBBox creates new BBox from N, W, S, E data

func NewBBoxFromCoordinate

func NewBBoxFromCoordinate(coord geojson.Coordinate) *BBox

NewBBoxFromCoordinate creates new BBox from coordinate

func NewBBoxFromCoordinates

func NewBBoxFromCoordinates(coords geojson.Coordinates) *BBox

NewBBoxFromCoordinates creates new BBox from coordinates

func (*BBox) Interact

func (b *BBox) Interact(bbox *BBox) bool

Interact return true if b and bbox are interacts

type Cache

type Cache map[interface{}]FeaturesMap

Cache cache features by collection name and id

func NewCache

func NewCache() Cache

NewCache creates new empty map

type FeaturesMap

type FeaturesMap map[interface{}]*geojson.Feature

FeaturesMap struct to cache Features by id

func NewFeaturesMap

func NewFeaturesMap() FeaturesMap

NewFeaturesMap creates new empty FeaturesMap

type IAcp

type IAcp interface {
	Flush()
	Write([]byte)
	PutBool(bool)
	PutUbyte(uint8)
	PutByte(int8)
	PutUShort(uint16)
	PutShort(int16)
	PutUint(uint32)
	PutInt(int32)
	PutULong(uint64)
	PutLong(int64)
	PutShortFloat(float32)
	PutFloat(float64)
	PutString(string)
	ReadNumber(interface{})
	GetBool() bool
	GetUbyte() int
	GetByte() int
	GetUShort() int
	GetShort() int
	GetUint() int
	GetInt() int
	GetULong() uint64
	GetLong() int64
	GetShortFloat() float32
	GetFloat() float64
	GetString() string
	GetCoord() [2]float64
	VerifyConnection(string) bool
	EstablishProtocol(int, int) bool
	Connect(string, int, int) error
	Put(string, interface{}) error
	Get(string) (interface{}, *AcpErr)
}

IAcp holds I/O buffer to communicate with Magik ACP

type TestAcp

type TestAcp struct {
	Name string
}

TestAcp holds I/O buffer to communicate with Magik ACP

func NewTestAcp

func NewTestAcp(name string) *TestAcp

NewTestAcp creates and init new Acp with name

func (*TestAcp) Connect

func (a *TestAcp) Connect(processName string, protocolMin, protocolMax int) (err error)

Connect verify connection and protocol to Acp

func (*TestAcp) EstablishProtocol

func (a *TestAcp) EstablishProtocol(minProtocol, maxProtocol int) bool

EstablishProtocol checks Acp protocol

func (*TestAcp) Flush

func (a *TestAcp) Flush()

Flush send buffer data

func (*TestAcp) Get

func (a *TestAcp) Get(dataType string) (value interface{}, err *AcpErr)

Get method reads dataType value from ACP

func (*TestAcp) GetBool

func (a *TestAcp) GetBool() bool

GetBool reads boolean value from Acp input

func (*TestAcp) GetByte

func (a *TestAcp) GetByte() int

GetByte reads byte from Acp input

func (*TestAcp) GetCoord

func (a *TestAcp) GetCoord() [2]float64

GetCoord return example coord

func (*TestAcp) GetFloat

func (a *TestAcp) GetFloat() float64

GetFloat read float64 from Acp input

func (*TestAcp) GetInt

func (a *TestAcp) GetInt() int

GetInt reads unsigned int from Acp input

func (*TestAcp) GetLong

func (a *TestAcp) GetLong() int64

GetLong reads long from Acp input

func (*TestAcp) GetShort

func (a *TestAcp) GetShort() int

GetShort reads short from Acp input

func (*TestAcp) GetShortFloat

func (a *TestAcp) GetShortFloat() float32

GetShortFloat read float32 from Acp input

func (*TestAcp) GetString

func (a *TestAcp) GetString() string

GetString reads string from Acp input

func (*TestAcp) GetULong

func (a *TestAcp) GetULong() uint64

GetULong reads unsigned long from Acp input

func (*TestAcp) GetUShort

func (a *TestAcp) GetUShort() int

GetUShort reads unsigned short from Acp input

func (*TestAcp) GetUbyte

func (a *TestAcp) GetUbyte() int

GetUbyte reads unsigned byte from Acp input

func (*TestAcp) GetUint

func (a *TestAcp) GetUint() int

GetUint reads unsigned int from Acp input

func (*TestAcp) Put

func (a *TestAcp) Put(dataType string, value interface{}) (err error)

Put convert value to dataType and send this value to ACP

func (*TestAcp) PutBool

func (a *TestAcp) PutBool(b bool)

PutBool sends boolean value to Acp output

func (*TestAcp) PutByte

func (a *TestAcp) PutByte(value int8)

PutByte sends byte value to Acp output

func (*TestAcp) PutFloat

func (a *TestAcp) PutFloat(value float64)

PutFloat sends float value to Acp output

func (*TestAcp) PutInt

func (a *TestAcp) PutInt(value int32)

PutInt sends int value to Acp output

func (*TestAcp) PutLong

func (a *TestAcp) PutLong(value int64)

PutLong sends long value to Acp output

func (*TestAcp) PutShort

func (a *TestAcp) PutShort(value int16)

PutShort sends short value to Acp output

func (*TestAcp) PutShortFloat

func (a *TestAcp) PutShortFloat(value float32)

PutShortFloat sends short float value to Acp output

func (*TestAcp) PutString

func (a *TestAcp) PutString(s string)

PutString sends string value to Acp output

func (*TestAcp) PutULong

func (a *TestAcp) PutULong(value uint64)

PutULong sends unsigned long value to Acp output

func (*TestAcp) PutUShort

func (a *TestAcp) PutUShort(value uint16)

PutUShort sends unsigned short value to Acp output

func (*TestAcp) PutUbyte

func (a *TestAcp) PutUbyte(value uint8)

PutUbyte sends unsigned byte value to Acp output

func (*TestAcp) PutUint

func (a *TestAcp) PutUint(value uint32)

PutUint sends int value to Acp output

func (*TestAcp) ReadNumber

func (a *TestAcp) ReadNumber(data interface{})

ReadNumber reads number from Acp input

func (*TestAcp) VerifyConnection

func (a *TestAcp) VerifyConnection(name string) bool

VerifyConnection verify Acp process name

func (*TestAcp) Write

func (a *TestAcp) Write(buf []byte)

Write writes buffer to Acp output

type Worker

type Worker struct {
	Port       string
	WorkerName string
	Cache      Cache
}

Worker type to wrap RPC communication

func NewWorker

func NewWorker(port string, name string) *Worker

NewWorker creates new instance of Worker

func (*Worker) DumpFeatures

func (w *Worker) DumpFeatures(request *config.DumpRequest, resp *config.FeaturesResponse) (respErr error)

DumpFeatures receive from ACP list of features

func (*Worker) GetFeature

func (w *Worker) GetFeature(request *config.FeatureRequest, resp *config.FeaturesResponse) (respErr error)

GetFeature receive from ACP list of features

func (*Worker) GetFeatures

func (w *Worker) GetFeatures(request *config.FeaturesRequest, resp *config.FeaturesResponse) (respErr error)

GetFeatures receive from ACP list of features

func (*Worker) GetTestFeature

func (t *Worker) GetTestFeature(request *config.FeatureRequest, resp *config.FeaturesResponse) error

GetTestFeature get feature details

func (*Worker) GetTestFeatures

func (t *Worker) GetTestFeatures(request *config.FeaturesRequest, resp *config.FeaturesResponse) error

GetTestFeatures get features id and geom

func (*Worker) SearchFeatures

func (w *Worker) SearchFeatures(request *config.SearchRequest, resp *config.FeaturesResponse) (respErr error)

SearchFeatures receive from ACP list of features

func (*Worker) TestSearchFeatures

func (t *Worker) TestSearchFeatures(request *config.SearchRequest, resp *config.FeaturesResponse) error

TestSearchFeatures get feature details

Jump to

Keyboard shortcuts

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