server

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidTokenErr = status.Errorf(
	codes.InvalidArgument,
	"The field `page_token` is invalid.")

InvalidTokenErr is the error returned if the token provided is not parseable by the TokenGenerator.

Functions

func SessionProto added in v0.0.14

func SessionProto(s Session) *pb.Session

SessionProto returns a proto representation of the Session.

func TestProto added in v0.0.14

func TestProto(t Test) *pb.Test

TestProto returns a proto representation of the Test.

func TestRunProto added in v0.0.14

func TestRunProto(t Test) *pb.TestRun

TestRunProto returns a proto representation of a test run.

Types

type GrpcObserverRegistry added in v0.0.11

type GrpcObserverRegistry interface {
	// UnaryInterceptor implements the grpc.UnaryServerInterceptor type to allow the
	// registry to hook into unary grpc methods.
	UnaryInterceptor(
		context.Context,
		interface{},
		*grpc.UnaryServerInfo,
		grpc.UnaryHandler) (interface{}, error)
	// StreamInterceptor implements the grpc.StreamServerInterceptor type to allow the
	// registry to hook into streaming grpc methods.
	StreamInterceptor(
		interface{},
		grpc.ServerStream,
		*grpc.StreamServerInfo,
		grpc.StreamHandler) error
	RegisterUnaryObserver(UnaryObserver)
	DeleteUnaryObserver(name string)
	RegisterStreamRequestObserver(StreamRequestObserver)
	DeleteStreamRequestObserver(name string)
	RegisterStreamResponseObserver(StreamResponseObserver)
	DeleteStreamResponseObserver(name string)
}

GrpcObserverRegistry is a registry of observers. These observers are hooked into the grpc interceptors that are provided by this interface.

func ShowcaseObserverRegistry added in v0.0.11

func ShowcaseObserverRegistry() GrpcObserverRegistry

ShowcaseObserverRegistry returns the showcase specific observer registry.

type Session added in v0.0.5

type Session interface {
	GetName() string
	GetVersion() pb.Session_Version
	GetReport() *pb.ReportSessionResponse
	RegisterTests(tests []Test)
	ListTests(in *pb.ListTestsRequest) (*pb.ListTestsResponse, error)
	DeleteTest(name string) (*empty.Empty, error)
}

Session represents a suite of tests, generally being made in the context of testing code generation.

A session defines tests it may expect, based on which version of the code generation spec is in use.

func NewSession added in v0.0.14

func NewSession(name string, version pb.Session_Version, observerRegistry GrpcObserverRegistry) Session

NewSession returns a session for a given name, version and observerRegistry.

type StreamRequestObserver added in v0.0.11

type StreamRequestObserver interface {
	GetName() string
	ObserveStreamRequest(
		ctx context.Context,
		req interface{},
		info *grpc.StreamServerInfo,
		err error)
}

StreamRequestObserver provides an interface for observing streaming requests.

type StreamResponseObserver added in v0.0.11

type StreamResponseObserver interface {
	GetName() string
	ObserveStreamResponse(
		ctx context.Context,
		resp interface{},
		info *grpc.StreamServerInfo,
		err error)
}

StreamResponseObserver provides an interface for observing streaming responses.

type Test added in v0.0.5

type Test interface {
	GetName() string
	GetExpectationLevel() pb.Test_ExpectationLevel
	GetDescription() string
	GetBlueprints() []*pb.Test_Blueprint
	GetIssue() *pb.Issue
}

Test represents a test case that is run. This interfaces exposes the properties of the test as well as the observers used to run this test.

A Test will also implement at least one of UnaryObserver, StreamRequestObserver, StreamResponseOvserver in order to track requests made to the showcase server.

type TokenGenerator added in v0.0.9

type TokenGenerator interface {
	ForIndex(int) string
	GetIndex(string) (int, error)
}

TokenGenerator generates a page token for a given index.

func NewTokenGenerator added in v0.0.9

func NewTokenGenerator() TokenGenerator

NewTokenGenerator provides a new instance of a TokenGenerator.

func TokenGeneratorWithSalt added in v0.0.14

func TokenGeneratorWithSalt(salt string) TokenGenerator

TokenGeneratorWithSalt provieds an instance of a TokenGenerator which uses the given salt.

type UnaryObserver added in v0.0.11

type UnaryObserver interface {
	GetName() string
	ObserveUnary(
		ctx context.Context,
		req interface{},
		resp interface{},
		info *grpc.UnaryServerInfo,
		err error)
}

UnaryObserver provides an interface for observing unary requests and responses.

type UniqID added in v0.0.14

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

UniqID provides a numerical id that is guaranteed to be unique.

func (*UniqID) Next added in v0.0.14

func (u *UniqID) Next() int64

Next gets the next unique id.

type Waiter added in v0.0.8

type Waiter interface {
	Wait(req *pb.WaitRequest) *lropb.Operation
}

Waiter handles the echo.Wait method for both the LRO service and the echo service.

func GetWaiterInstance added in v0.0.14

func GetWaiterInstance() Waiter

GetWaiterInstance returns the waiter singleton.

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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