analyticservice

package
v0.0.0-...-5a762db Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package analyticservice abstracts creation of the necessary service elements away from analytics, allowing callbacks to be registered with simple APIs.

Example:

func main() {
	s, err := analyticservice.New("My Team", "My Analytic ID", analyticservice.WithDefaultMaxBatch(10))
	if err != nil {
		log.Fatalf("Failed to create medifor service: %v", err)
	}

	s.RegisterImageManipulation(func(ctx context.Context, req *pb.ImageManipulationRequest) (*pb.ManipulationResponse, error) {
		// Do the manipulation task and return the appropriate proto response here.
	})

	log.Fatal(s.Run(context.Background()))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticService

type AnalyticService struct {
	Port int // Analytic service port, defaults to 50051
	// contains filtered or unexported fields
}

AnalyticService implements the analytic service proto endpoints.

func New

func New(opts ...ServiceOption) (*AnalyticService, error)

New creates a new AnalyticService that listens on the given port.

func (*AnalyticService) RegisterImageCameraMatch

func (s *AnalyticService) RegisterImageCameraMatch(f ImageCameraMatchFunc) error

RegisterImageCameraMatch registers a function to determine whether given camera ID is a match for an image.

func (*AnalyticService) RegisterImageCameras

func (s *AnalyticService) RegisterImageCameras(f ImageCamerasFunc) error

RegisterImageCameras registers a function to determine whether given camera ID is a match for an image.

func (*AnalyticService) RegisterImageManipulation

func (s *AnalyticService) RegisterImageManipulation(f ImageManipulationFunc) error

RegisterImageManipulation registers a function to handle ImageManipulation calls. Pass options to change the way the callback is invoked.

func (*AnalyticService) RegisterImageSplice

func (s *AnalyticService) RegisterImageSplice(f ImageSpliceFunc) error

RegisterImageSplice registers a function to handle ImageSplice calls.

func (*AnalyticService) RegisterVideoCameraMatch

func (s *AnalyticService) RegisterVideoCameraMatch(f VideoCameraMatchFunc) error

RegisterVideoCameraMatch registers a function to determine whether given camera ID is a match for an image.

func (*AnalyticService) RegisterVideoManipulation

func (s *AnalyticService) RegisterVideoManipulation(f VideoManipulationFunc) error

RegisterVideoManipulation registers a function to handle VideoManipulation calls.

func (*AnalyticService) Run

func (s *AnalyticService) Run(ctx context.Context) error

Run starts the service and blocks until it dies or the context is canceled.

func (*AnalyticService) Stop

func (s *AnalyticService) Stop()

Stop stops the service cleanly.

type ImageCameraMatchFunc

type ImageCameraMatchFunc func(ctx context.Context, req *pb.ImageCameraMatchRequest) (*pb.ImageCameraMatch, error)

ImageCameraMatchFunc defines a callback for analytics that detect an image camera ID match.

type ImageCamerasFunc

type ImageCamerasFunc func(ctx context.Context, req *pb.ImageCamerasRequest) (*pb.ImageCameras, error)

ImageCamerasFunc defines a callback for analytics that detect an image camera ID match.

type ImageManipulationFunc

type ImageManipulationFunc func(ctx context.Context, req *pb.ImageManipulationRequest) (*pb.ImageManipulation, error)

ImageManipulationFunc defines a callback for analytics that detect general image manipulations.

type ImageSpliceFunc

type ImageSpliceFunc func(ctx context.Context, req *pb.ImageSpliceRequest) (*pb.ImageSplice, error)

ImageSpliceFunc defines a callback for analytics that detect image splices.

type ServiceOption

type ServiceOption func(*AnalyticService)

ServiceOption allows options to be set at the service level.

func WithListener

func WithListener(listener net.Listener) ServiceOption

WithListener specifies the network listener to use when running.

func WithPort

func WithPort(port int) ServiceOption

WithPort creates an option that sets the local TCP port for this service.

type VideoCameraMatchFunc

type VideoCameraMatchFunc func(ctx context.Context, req *pb.VideoCameraMatchRequest) (*pb.VideoCameraMatch, error)

VideoCameraMatchFunc defines a callback for analytics that detect an image camera ID match.

type VideoManipulationFunc

type VideoManipulationFunc func(ctx context.Context, req *pb.VideoManipulationRequest) (*pb.VideoManipulation, error)

VideoManipulationFunc defines a callback for analytics that detect video manipulations.

Jump to

Keyboard shortcuts

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