ydbtest

package
v2.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package ydbtest provides tools for stubbing ydb server up.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitHostPort

func SplitHostPort(addr string) (host string, port int, err error)

Types

type Balancer

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

func (*Balancer) Addr

func (b *Balancer) Addr() net.Addr

func (*Balancer) Close

func (b *Balancer) Close() error

func (*Balancer) DialContext

func (b *Balancer) DialContext(ctx context.Context) (net.Conn, error)

type Endpoint

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

func (*Endpoint) Close

func (e *Endpoint) Close()

func (*Endpoint) DialContext

func (e *Endpoint) DialContext(ctx context.Context) (net.Conn, error)

func (*Endpoint) ServerConn

func (e *Endpoint) ServerConn() <-chan net.Conn

type Handler

type Handler func(ctx context.Context, req RequestParser) (res interface{}, err error)

func SuccessHandler

func SuccessHandler(f ResponseMapper) Handler

type Handlers

type Handlers map[ydb.Method]Handler

type Listener

type Listener struct {
	Client chan net.Conn
	Server chan net.Conn
	Closed chan struct{}
	// contains filtered or unexported fields
}

func NewListener

func NewListener() *Listener

func (*Listener) Accept

func (ln *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

func (ln *Listener) Addr() net.Addr

func (*Listener) Close

func (ln *Listener) Close() error

func (*Listener) DialContext

func (ln *Listener) DialContext(ctx context.Context) (net.Conn, error)

func (*Listener) DialGRPC

func (ln *Listener) DialGRPC() (*grpc.ClientConn, error)

func (*Listener) HostPort

func (ln *Listener) HostPort() (host string, port int, err error)

type RequestParser

type RequestParser func(interface{})

type ResponseMapper

type ResponseMapper func(RequestParser) proto.Message

func Ident

func Ident(res proto.Message) ResponseMapper

type YDB

type YDB struct {
	Database string
	Handlers Handlers
	T        testing.TB
	// contains filtered or unexported fields
}

func (*YDB) DialContext

func (s *YDB) DialContext(ctx context.Context, addr string) (_ net.Conn, err error)

func (*YDB) StartBalancer

func (s *YDB) StartBalancer() *Balancer

StartBalancer starts to provide a discovery service on some local address.

func (*YDB) StartEndpoint

func (s *YDB) StartEndpoint() *Endpoint

StartEndpoint starts to provide a YDB service on some local address.

Jump to

Keyboard shortcuts

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