tracker

package
v0.0.0-...-b0a49f2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIdentifierNotDefined = errors.New("tracker/geojson: identifier not defined")
	ErrNoIndexData          = errors.New("tracker/geojson: no index data")
	ErrInvalidGeoJSONData   = errors.New("tracker/geojson: invalid GeoJSON data")
)

Functions

func NewLocalCluster

func NewLocalCluster(owner string, level int) *localCluster

Types

type Cluster

type Cluster interface {
	Lookup(index h3.H3Index) (h3geodist.Cell, bool)
	CurrentLevel() int
	Addr() string
	IsOwner(addr string) bool
}

type Event

type Event struct {
}

type GeoJSON

type GeoJSON struct {
	ObjectID uint64
	Index    []h3.H3Index
	LayerID  uint64
	Data     geojson.Object
}

func (GeoJSON) HasIndex

func (o GeoJSON) HasIndex() bool

func (GeoJSON) HasNotIndex

func (o GeoJSON) HasNotIndex() bool

func (GeoJSON) Validate

func (o GeoJSON) Validate() (err error)

type Proxy

type Proxy interface {
	NewClient(ctx context.Context, addr string) (Service, error)
}

type Server

type Server struct {
	pb.ApiServiceServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(grpcServer *grpc.Server, svc Service) *Server

func (*Server) Add

func (s *Server) Add(ctx context.Context, req *pb.AddRequest) (*pb.AddResponse, error)

func (*Server) Detect

func (s *Server) Detect(ctx context.Context, req *pb.DetectRequest) (*pb.DetectResponse, error)

func (*Server) Remove

func (s *Server) Remove(ctx context.Context, req *pb.RemoveRequest) (*pb.RemoveResponse, error)

type Service

type Service interface {
	Add(ctx context.Context, object GeoJSON) ([]h3.H3Index, error)
	Remove(ctx context.Context, objectID uint64, index []h3.H3Index) error
	Detect(ctx context.Context) (events []Event, ok bool, err error)
}

func NewService

func NewService(c Cluster, proxy Proxy) Service

Jump to

Keyboard shortcuts

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