dtmdriver

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 2 Imported by: 62

README

dtmdriver

dtm's driver interface for micro-services

gRPC

dtm has support grpc based micro-services: go-zero, kratos, polaris

HTTP

dtm has support http base micro-services: springclould-alibaba

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(driver Driver)

Register used by each driver writer to register the driver to system

func RegisterHttp added in v0.0.2

func RegisterHttp(driver HTTPDriver)

RegisterHttp used by each driver writer to register the driver to system

func Use

func Use(name string) error

Use called by users who want to use dtmgrpc.

func UseHTTP added in v0.0.2

func UseHTTP(name string) error

UseHTTP called by users who want to use dtmgrpc.

Types

type Driver

type Driver interface {
	// GetName return the name of the driver
	GetName() string
	// RegisterGrpcResolver register the grpc resolver to handle custom scheme
	RegisterGrpcResolver()
	// RegisterGrpcService register dtm endpoint to target
	RegisterGrpcService(target string, endpoint string) error
	// ParseServerMethod parse the url to server and method.
	// server will be passed to grpc.Dial, and method to grpc.ClientConn.invoke
	ParseServerMethod(uri string) (server string, method string, err error)
}

Driver is the interface to do grpc service register and discover

func GetDriver

func GetDriver() Driver

GetDriver called by dtm

type HTTPClient added in v0.0.2

type HTTPClient interface {
	// ResolveURL register the http resolver to handle custom url
	ResolveURL(url string) (string, error)
	// RegisterService register dtm endpoint to service
	RegisterService(service string, endpoint string) error
}

HTTPClient is the interface to do http service call.

type HTTPDriver added in v0.0.2

type HTTPDriver interface {
	// GetName return the name of the driver
	GetName() string
	// Init will init client
	Init(registryType string, host string, options string) error
	// ResolveURL register the http resolver to handle custom url
	ResolveURL(url string) (string, error)
	// RegisterService register dtm endpoint to service
	RegisterService(service string, endpoint string) error
}

HTTPDriver is the interface to do http service register and discover

func GetHTTPDriver added in v0.0.2

func GetHTTPDriver() HTTPDriver

GetDriver called by dtm

Jump to

Keyboard shortcuts

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