external

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InterfaceFactoryKey = util.Key("ufs external-server-interface key")

InterfaceFactoryKey is the key used to store instance of InterfaceFactory in context.

Functions

func GetGitilesClient

func GetGitilesClient(ctx context.Context, gitilesHost string) (gitiles.GitilesClient, error)

GetGitilesClient returns the GitilesClient for the given host.

func GetPubSub

func GetPubSub(c context.Context) *pubsub.Client

GetPubSub returns the client in c if it exists, or nil.

func UsePubSub

func UsePubSub(c context.Context, projectID string) (context.Context, error)

UsePubSub installs a pubsub client into the context for later use.

func WithServerInterface

func WithServerInterface(ctx context.Context) context.Context

WithServerInterface adds the external server interface to context.

func WithTestingContext

func WithTestingContext(ctx context.Context) context.Context

WithTestingContext allows for mocked external interface.

Types

type DeviceConfigClient

type DeviceConfigClient interface {
	GetDeviceConfig(ctx context.Context, cfgID *deviceconfig.ConfigId) (*deviceconfig.Config, error)
	DeviceConfigsExists(ctx context.Context, cfgIDs []*deviceconfig.ConfigId) ([]bool, error)
}

DeviceConfigClient handles read operations for DeviceConfigs These functions match the functions in the configuration package, and if datastore is the only source for DeviceConfigs, consider deleting this code

type DeviceConfigFactory

type DeviceConfigFactory func(ctx context.Context) (DeviceConfigClient, error)

DeviceConfigFactory is a constructor for a DeviceConfigClient

type DualDeviceConfigClient

type DualDeviceConfigClient struct {
}

DualDeviceConfigClient can use multiple sources to fetch device configs.

func (*DualDeviceConfigClient) DeviceConfigsExists

func (c *DualDeviceConfigClient) DeviceConfigsExists(ctx context.Context, cfgIDs []*deviceconfig.ConfigId) ([]bool, error)

DeviceConfigsExists detects whether any number of configs exist.

The return is an array of booleans, where the ith boolean represents the existence of the ith config.

func (*DualDeviceConfigClient) GetDeviceConfig

GetDeviceConfig fetches a specific device config in UFS.

type GitInterfaceFactory

type GitInterfaceFactory func(ctx context.Context, gitilesHost, project, branch string) (git.ClientInterface, error)

GitInterfaceFactory is a constructor for a git.ClientInterface

type GitTilesClient

type GitTilesClient interface {
	Log(ctx context.Context, in *gitiles.LogRequest, opts ...grpc.CallOption) (*gitiles.LogResponse, error)
	DownloadFile(ctx context.Context, in *gitiles.DownloadFileRequest, opts ...grpc.CallOption) (*gitiles.DownloadFileResponse, error)
}

GitTilesClient exposes a subset of gitiles.GitilesClient

type GitTilesInterfaceFactory

type GitTilesInterfaceFactory func(ctx context.Context, gitilesHost string) (GitTilesClient, error)

GitTilesInterfaceFactory is a constructor for a gitiles.GitilesClient

type HwidInterfaceFactory

type HwidInterfaceFactory func(ctx context.Context) (hwid.ClientInterface, error)

HwidInterfaceFactory is a constructor for a HWIDClient

type InterfaceFactory

type InterfaceFactory struct {
	// contains filtered or unexported fields
}

InterfaceFactory provides a collection of interfaces to external clients.

func GetServerInterface

func GetServerInterface(ctx context.Context) (*InterfaceFactory, error)

GetServerInterface retrieves the ExternalServerInterface from context.

func (*InterfaceFactory) NewDeviceConfigInterfaceFactory

func (es *InterfaceFactory) NewDeviceConfigInterfaceFactory(ctx context.Context) (DeviceConfigClient, error)

NewDeviceConfigInterfaceFactory creates a new device config client

func (*InterfaceFactory) NewGitInterface

func (es *InterfaceFactory) NewGitInterface(ctx context.Context, gitilesHost, project, branch string) (git.ClientInterface, error)

NewGitInterface creates a new git interface.

func (*InterfaceFactory) NewGitTilesInterface

func (es *InterfaceFactory) NewGitTilesInterface(ctx context.Context, gitilesHost string) (GitTilesClient, error)

NewGitTilesInterface creates a new git interface.

func (*InterfaceFactory) NewHwidClientInterface

func (es *InterfaceFactory) NewHwidClientInterface(ctx context.Context) (hwid.ClientInterface, error)

NewHwidClientInterface creates a new Hwid server client interface.

func (*InterfaceFactory) NewSheetInterface

func (es *InterfaceFactory) NewSheetInterface(ctx context.Context) (sheet.ClientInterface, error)

NewSheetInterface creates a new Sheet interface.

type SheetInterfaceFactory

type SheetInterfaceFactory func(ctx context.Context) (sheet.ClientInterface, error)

SheetInterfaceFactory is a constructor for a sheet.ClientInterface

Jump to

Keyboard shortcuts

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