common

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package common provides common functionalities and utilities

Index

Constants

This section is empty.

Variables

View Source
var SharedObjectsForServiceSingleton = &SharedObjectsForService{}

SharedObjectsForServiceSingleton is the Singleton object that allows sharing states between services

Functions

This section is empty.

Types

type SharedObjectsForService

type SharedObjectsForService struct {
	Chrome *chrome.Chrome
	// Mutex to protect against concurrent access to Chrome
	ChromeMutex sync.Mutex
}

SharedObjectsForService allows services to shared states of important objects, such as chrome and arc. While this provides access to the important objects, the lifecycle management of these objects is not the responsibility of this struct. Instead individual services will share the responsibility of managing the lifecycle of these objects. A common pattern is to include a reference during Service instantiation and registration. e.g.

 testing.AddService(&testing.Service{
	  Register: func(srv *grpc.Server, s *testing.ServiceState) {
			automationService := AutomationService{s: s, sharedObject: common.SharedObjectsForServiceSingleton}
			pb.RegisterAutomationServiceServer(srv, &automationService)
		},
	})

Jump to

Keyboard shortcuts

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