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 ¶
- type AnalyticService
- func (s *AnalyticService) RegisterImageCameraMatch(f ImageCameraMatchFunc) error
- func (s *AnalyticService) RegisterImageCameras(f ImageCamerasFunc) error
- func (s *AnalyticService) RegisterImageManipulation(f ImageManipulationFunc) error
- func (s *AnalyticService) RegisterImageSplice(f ImageSpliceFunc) error
- func (s *AnalyticService) RegisterVideoCameraMatch(f VideoCameraMatchFunc) error
- func (s *AnalyticService) RegisterVideoManipulation(f VideoManipulationFunc) error
- func (s *AnalyticService) Run(ctx context.Context) error
- func (s *AnalyticService) Stop()
- type ImageCameraMatchFunc
- type ImageCamerasFunc
- type ImageManipulationFunc
- type ImageSpliceFunc
- type ServiceOption
- type VideoCameraMatchFunc
- type VideoManipulationFunc
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.
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.