API: internal/grpcv1

Back to API Index

Legend: Type, Function, Method

Package: package grpcv1 // import "github.com/smysnk/sikuligo/internal/grpcv1"

Symbol Index

Types

Functions

Methods

Declarations

Types

Type MethodSnapshot

Type MetricsRegistry

Type MetricsSnapshot

Type MetricsSnapshotProvider

Type Server

Type ServerOption

Type SessionTracker

Type StoreMetricsProvider

Functions

Function NewAdminMux

Function StreamInterceptors

Function UnaryInterceptors

Function NewMetricsRegistry

Function NewServer

Function WithCaptureScreen

Function WithClickOnScreen

Function WithFinderFactory

Function WithFinderWithEngineFactory

Function WithScreenLister

Function NewSessionTracker

Function NewStoreMetricsProvider

Methods

Method MetricsRegistry.FinishRequest

Method MetricsRegistry.Record

Method MetricsRegistry.RecordAuthFailure

Method MetricsRegistry.Snapshot

Method MetricsRegistry.StartRequest

Method Server.CaptureScreen

Method Server.Click

Method Server.ClickOnScreen

Method Server.CloseApp

Method Server.ExistsOnScreen

Method Server.Find

Method Server.FindAll

Method Server.FindOnScreen

Method Server.FindText

Method Server.FindWindows

Method Server.FocusApp

Method Server.GetFocusedWindow

Method Server.GetPrimaryScreen

Method Server.GetWindow

Method Server.Hotkey

Method Server.IsAppRunning

Method Server.KeyDown

Method Server.KeyUp

Method Server.ListScreens

Method Server.ListWindows

Method Server.MouseDown

Method Server.MouseUp

Method Server.MoveMouse

Method Server.ObserveAppear

Method Server.ObserveChange

Method Server.ObserveVanish

Method Server.OpenApp

Method Server.PasteText

Method Server.ReadText

Method Server.ScrollWheel

Method Server.TypeText

Method Server.WaitOnScreen

Method SessionTracker.HandleConn

Method SessionTracker.HandleRPC

Method SessionTracker.RecordInteraction

Method SessionTracker.TagConn

Method SessionTracker.TagRPC

Method StoreMetricsProvider.Snapshot

Raw Package Doc

package grpcv1 // import "github.com/smysnk/sikuligo/internal/grpcv1"


FUNCTIONS

func NewAdminMux(provider MetricsSnapshotProvider, store *sessionstore.Store) *http.ServeMux
func StreamInterceptors(authToken string, logger *log.Logger, metrics *MetricsRegistry, tracker *SessionTracker) []grpc.StreamServerInterceptor
func UnaryInterceptors(authToken string, logger *log.Logger, metrics *MetricsRegistry, tracker *SessionTracker) []grpc.UnaryServerInterceptor

TYPES

type MethodSnapshot struct {
	Method           string  `json:"method"`
	Requests         uint64  `json:"requests"`
	Errors           uint64  `json:"errors"`
	AuthFailures     uint64  `json:"auth_failures"`
	AvgLatencyMS     float64 `json:"avg_latency_ms"`
	MaxLatencyMS     float64 `json:"max_latency_ms"`
	LastCode         string  `json:"last_code"`
	LastTraceID      string  `json:"last_trace_id"`
	LastSeenUnixMS   int64   `json:"last_seen_unix_ms"`
	LastSeenRFC3339  string  `json:"last_seen_rfc3339"`
	ErrorRatePercent float64 `json:"error_rate_percent"`
}

type MetricsRegistry struct {
	// Has unexported fields.
}

func NewMetricsRegistry() *MetricsRegistry

func (m *MetricsRegistry) FinishRequest()

func (m *MetricsRegistry) Record(method string, code codes.Code, latency time.Duration, traceID string)

func (m *MetricsRegistry) RecordAuthFailure(method string)

func (m *MetricsRegistry) Snapshot() MetricsSnapshot

func (m *MetricsRegistry) StartRequest()

type MetricsSnapshot struct {
	StartedAtRFC3339  string           `json:"started_at_rfc3339"`
	UptimeSeconds     int64            `json:"uptime_seconds"`
	Inflight          int64            `json:"inflight"`
	TotalRequests     uint64           `json:"total_requests"`
	TotalErrors       uint64           `json:"total_errors"`
	TotalAuthFailures uint64           `json:"total_auth_failures"`
	Methods           []MethodSnapshot `json:"methods"`
}

type MetricsSnapshotProvider interface {
	Snapshot() MetricsSnapshot
}

type Server struct {
	pb.UnimplementedSikuliServiceServer

	// Has unexported fields.
}

func NewServer(opts ...ServerOption) *Server

func (s *Server) CaptureScreen(ctx context.Context, req *pb.CaptureScreenRequest) (*pb.CaptureScreenResponse, error)

func (s *Server) Click(_ context.Context, req *pb.ClickRequest) (*pb.ActionResponse, error)

func (s *Server) ClickOnScreen(ctx context.Context, req *pb.ClickOnScreenRequest) (*pb.FindResponse, error)

func (s *Server) CloseApp(_ context.Context, req *pb.AppActionRequest) (*pb.ActionResponse, error)

func (s *Server) ExistsOnScreen(ctx context.Context, req *pb.ExistsOnScreenRequest) (*pb.ExistsOnScreenResponse, error)

func (s *Server) Find(ctx context.Context, req *pb.FindRequest) (*pb.FindResponse, error)

func (s *Server) FindAll(ctx context.Context, req *pb.FindRequest) (*pb.FindAllResponse, error)

func (s *Server) FindOnScreen(ctx context.Context, req *pb.FindOnScreenRequest) (*pb.FindResponse, error)

func (s *Server) FindText(_ context.Context, req *pb.FindTextRequest) (*pb.FindTextResponse, error)

func (s *Server) FindWindows(_ context.Context, req *pb.WindowQueryRequest) (*pb.ListWindowsResponse, error)

func (s *Server) FocusApp(_ context.Context, req *pb.AppActionRequest) (*pb.ActionResponse, error)

func (s *Server) GetFocusedWindow(_ context.Context, req *pb.AppActionRequest) (*pb.GetWindowResponse, error)

func (s *Server) GetPrimaryScreen(ctx context.Context, _ *pb.GetPrimaryScreenRequest) (*pb.GetPrimaryScreenResponse, error)

func (s *Server) GetWindow(_ context.Context, req *pb.WindowQueryRequest) (*pb.GetWindowResponse, error)

func (s *Server) Hotkey(_ context.Context, req *pb.HotkeyRequest) (*pb.ActionResponse, error)

func (s *Server) IsAppRunning(_ context.Context, req *pb.AppActionRequest) (*pb.IsAppRunningResponse, error)

func (s *Server) KeyDown(_ context.Context, req *pb.HotkeyRequest) (*pb.ActionResponse, error)

func (s *Server) KeyUp(_ context.Context, req *pb.HotkeyRequest) (*pb.ActionResponse, error)

func (s *Server) ListScreens(ctx context.Context, _ *pb.ListScreensRequest) (*pb.ListScreensResponse, error)

func (s *Server) ListWindows(_ context.Context, req *pb.AppActionRequest) (*pb.ListWindowsResponse, error)

func (s *Server) MouseDown(_ context.Context, req *pb.ClickRequest) (*pb.ActionResponse, error)

func (s *Server) MouseUp(_ context.Context, req *pb.ClickRequest) (*pb.ActionResponse, error)

func (s *Server) MoveMouse(_ context.Context, req *pb.MoveMouseRequest) (*pb.ActionResponse, error)

func (s *Server) ObserveAppear(_ context.Context, req *pb.ObserveRequest) (*pb.ObserveResponse, error)

func (s *Server) ObserveChange(_ context.Context, req *pb.ObserveChangeRequest) (*pb.ObserveResponse, error)

func (s *Server) ObserveVanish(_ context.Context, req *pb.ObserveRequest) (*pb.ObserveResponse, error)

func (s *Server) OpenApp(_ context.Context, req *pb.AppActionRequest) (*pb.ActionResponse, error)

func (s *Server) PasteText(_ context.Context, req *pb.TypeTextRequest) (*pb.ActionResponse, error)

func (s *Server) ReadText(_ context.Context, req *pb.ReadTextRequest) (*pb.ReadTextResponse, error)

func (s *Server) ScrollWheel(_ context.Context, req *pb.ScrollWheelRequest) (*pb.ActionResponse, error)

func (s *Server) TypeText(_ context.Context, req *pb.TypeTextRequest) (*pb.ActionResponse, error)

func (s *Server) WaitOnScreen(ctx context.Context, req *pb.WaitOnScreenRequest) (*pb.FindResponse, error)

type ServerOption func(*Server)

func WithCaptureScreen(fn func(context.Context, string) (*sikuli.Image, error)) ServerOption

func WithClickOnScreen(fn func(int, int, sikuli.InputOptions) error) ServerOption

func WithFinderFactory(fn func(*sikuli.Image) (*sikuli.Finder, error)) ServerOption

func WithFinderWithEngineFactory(fn func(*sikuli.Image, cv.MatcherEngine) (*sikuli.Finder, error)) ServerOption

func WithScreenLister(fn func(context.Context) ([]sikuli.Screen, error)) ServerOption

type SessionTracker struct {
	// Has unexported fields.
}

func NewSessionTracker(store *sessionstore.Store, apiSessionID uint, logger *log.Logger) *SessionTracker

func (s *SessionTracker) HandleConn(ctx context.Context, conn stats.ConnStats)

func (s *SessionTracker) HandleRPC(context.Context, stats.RPCStats)

func (s *SessionTracker) RecordInteraction(ctx context.Context, method string, code codes.Code, duration time.Duration, traceID string)

func (s *SessionTracker) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context

func (s *SessionTracker) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context

type StoreMetricsProvider struct {
	// Has unexported fields.
}

func NewStoreMetricsProvider(store *sessionstore.Store) *StoreMetricsProvider

func (p *StoreMetricsProvider) Snapshot() MetricsSnapshot