provider

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Overview

Package provider is default Provider implements.

Index

Constants

View Source
const (
	CGIKeyPrefix   = "CGI_"
	DefaultCGIHost = "127.0.0.1"
	DefaultCGIPort = 9000
	HTTPMethodPOST = "POST"
	HTTPMethodGET  = "GET"
)
View Source
const (
	// DefaultMotanMethodConfKey for default motan method conf, when make a http call without a specific motan method
	DefaultMotanMethodConfKey = "http_default_motan_method"
	// DefaultMotanHTTPMethod set a default http method
	DefaultMotanHTTPMethod = "GET"
	// MotanRequestHTTPMethodKey http method key in a motan request attachment
	MotanRequestHTTPMethodKey = "HTTP_Method"

	DefaultRequestTimeout = 1 * time.Second
)
View Source
const (
	ExtConfSection             = "http-service"
	ClientName                 = "weibo-mesh-http"
	DefaultWriteTimeout        = 1 * time.Second
	DefaultReadTimeout         = 1 * time.Second
	DefaultMaxConnsPerHost     = 1024
	DefaultMaxIdleConnDuration = 30 * time.Second
)

Default options for httpxProvider confs

View Source
const (
	ProxyHostKey = "proxy.host"
	DefaultHost  = "127.0.0.1"
)
View Source
const (
	CGI     = "cgi"
	HTTP    = "http"
	HTTPX   = "httpx"
	MOTAN2  = "motan2"
	Mock    = "mockProvider"
	Default = "default"
)

ext name

Variables

View Source
var NeededCGIEnv = []string{"REQUEST_METHOD", "SCRIPT_FILENAME", "DOCUMENT_ROOT"}

Functions

func ParseFastCgiResponse

func ParseFastCgiResponse(content string) (int, map[string]string, string, error)

func RegistDefaultProvider

func RegistDefaultProvider(extFactory motan.ExtensionFactory)

Types

type CgiProvider

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

func (*CgiProvider) Call

func (c *CgiProvider) Call(request motan.Request) motan.Response

func (*CgiProvider) Destroy

func (c *CgiProvider) Destroy()

func (*CgiProvider) GetName

func (c *CgiProvider) GetName() string

func (*CgiProvider) GetPath

func (c *CgiProvider) GetPath() string

func (*CgiProvider) GetURL

func (c *CgiProvider) GetURL() *motan.URL

func (*CgiProvider) Initialize

func (c *CgiProvider) Initialize()

func (*CgiProvider) IsAvailable

func (c *CgiProvider) IsAvailable() bool

func (*CgiProvider) SetProxy

func (c *CgiProvider) SetProxy(proxy bool)

func (*CgiProvider) SetSerialization

func (c *CgiProvider) SetSerialization(s motan.Serialization)

func (*CgiProvider) SetService

func (c *CgiProvider) SetService(s interface{})

func (*CgiProvider) SetURL

func (c *CgiProvider) SetURL(url *motan.URL)

type DefaultProvider

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

func (*DefaultProvider) Call

func (d *DefaultProvider) Call(request motan.Request) (res motan.Response)

func (*DefaultProvider) Destroy

func (d *DefaultProvider) Destroy()

func (*DefaultProvider) GetPath

func (d *DefaultProvider) GetPath() string

func (*DefaultProvider) GetURL

func (d *DefaultProvider) GetURL() *motan.URL

func (*DefaultProvider) Initialize

func (d *DefaultProvider) Initialize()

func (*DefaultProvider) IsAvailable

func (d *DefaultProvider) IsAvailable() bool

func (*DefaultProvider) SetService

func (d *DefaultProvider) SetService(s interface{})

func (*DefaultProvider) SetURL

func (d *DefaultProvider) SetURL(url *motan.URL)

type HTTPProvider

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

HTTPProvider struct

func (*HTTPProvider) Call

func (h *HTTPProvider) Call(request motan.Request) motan.Response

Call for do a motan call through this provider

func (*HTTPProvider) Destroy

func (h *HTTPProvider) Destroy()

Destroy a HTTPProvider

func (*HTTPProvider) GetMixVars

func (h *HTTPProvider) GetMixVars() []string

GetMixVars return the HTTPProvider mixVars

func (*HTTPProvider) GetName

func (h *HTTPProvider) GetName() string

GetName return this provider name

func (*HTTPProvider) GetPath

func (h *HTTPProvider) GetPath() string

GetPath return current url path from the provider's url

func (*HTTPProvider) GetURL

func (h *HTTPProvider) GetURL() *motan.URL

GetURL return the url that represent for this provider

func (*HTTPProvider) Initialize

func (h *HTTPProvider) Initialize()

Initialize http provider

func (*HTTPProvider) IsAvailable

func (h *HTTPProvider) IsAvailable() bool

IsAvailable to check if this provider is sitll working well

func (*HTTPProvider) SetContext

func (h *HTTPProvider) SetContext(context *motan.Context)

SetContext use to set global config to HTTPProvider

func (*HTTPProvider) SetMixVars

func (h *HTTPProvider) SetMixVars(mixVars []string)

SetMixVars to set HTTPProvider mixVars to this provider

func (*HTTPProvider) SetProxy

func (h *HTTPProvider) SetProxy(proxy bool)

SetProxy for HTTPProvider

func (*HTTPProvider) SetSerialization

func (h *HTTPProvider) SetSerialization(s motan.Serialization)

SetSerialization for set a motan.SetSerialization to HTTPProvider

func (*HTTPProvider) SetService

func (h *HTTPProvider) SetService(s interface{})

SetService to set services to this provider that wich can handle

func (*HTTPProvider) SetURL

func (h *HTTPProvider) SetURL(url *motan.URL)

SetURL to set a motan to represent for this provider

type HTTPXProvider

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

HTTPXProvider struct

func (*HTTPXProvider) Call

func (h *HTTPXProvider) Call(request motan.Request) motan.Response

Call for do a motan call through this provider

func (*HTTPXProvider) Destroy

func (h *HTTPXProvider) Destroy()

Destroy a HTTPXProvider

func (*HTTPXProvider) GetMixVars

func (h *HTTPXProvider) GetMixVars() []string

GetMixVars return the HTTPXProvider mixVars

func (*HTTPXProvider) GetName

func (h *HTTPXProvider) GetName() string

GetName return this provider name

func (*HTTPXProvider) GetPath

func (h *HTTPXProvider) GetPath() string

GetPath return current url path from the provider's url

func (*HTTPXProvider) GetURL

func (h *HTTPXProvider) GetURL() *motan.URL

GetURL return the url that represent for this provider

func (*HTTPXProvider) Initialize

func (h *HTTPXProvider) Initialize()

Initialize http provider

func (*HTTPXProvider) IsAvailable

func (h *HTTPXProvider) IsAvailable() bool

IsAvailable to check if this provider is sitll working well

func (*HTTPXProvider) SetContext

func (h *HTTPXProvider) SetContext(context *motan.Context)

SetContext use to set globle config to HTTPXProvider

func (*HTTPXProvider) SetMixVars

func (h *HTTPXProvider) SetMixVars(mixVars []string)

SetMixVars to set HTTPXProvider mixVars to this provider

func (*HTTPXProvider) SetProxy

func (h *HTTPXProvider) SetProxy(proxy bool)

SetProxy for HTTPXProvider

func (*HTTPXProvider) SetSerialization

func (h *HTTPXProvider) SetSerialization(s motan.Serialization)

SetSerialization for set a motan.SetSerialization to HTTPXProvider

func (*HTTPXProvider) SetService

func (h *HTTPXProvider) SetService(s interface{})

SetService to set services to this provider that wich can handle

func (*HTTPXProvider) SetURL

func (h *HTTPXProvider) SetURL(url *motan.URL)

SetURL to set a motan to represent for this provider

type MockProvider

type MockProvider struct {
	URL          *motan.URL
	MockResponse motan.Response
	// contains filtered or unexported fields
}

func (*MockProvider) Call

func (m *MockProvider) Call(request motan.Request) motan.Response

func (*MockProvider) Destroy

func (m *MockProvider) Destroy()

func (*MockProvider) GetName

func (m *MockProvider) GetName() string

func (*MockProvider) GetPath

func (m *MockProvider) GetPath() string

func (*MockProvider) GetURL

func (m *MockProvider) GetURL() *motan.URL

func (*MockProvider) Initialize

func (m *MockProvider) Initialize()

func (*MockProvider) IsAvailable

func (m *MockProvider) IsAvailable() bool

func (*MockProvider) SetProxy

func (m *MockProvider) SetProxy(proxy bool)

func (*MockProvider) SetSerialization

func (m *MockProvider) SetSerialization(s motan.Serialization)

func (*MockProvider) SetService

func (m *MockProvider) SetService(s interface{})

func (*MockProvider) SetURL

func (m *MockProvider) SetURL(url *motan.URL)

type MotanProvider

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

func (*MotanProvider) Call

func (m *MotanProvider) Call(request motan.Request) motan.Response

func (*MotanProvider) Destroy

func (m *MotanProvider) Destroy()

func (*MotanProvider) GetName

func (m *MotanProvider) GetName() string

func (*MotanProvider) GetPath

func (m *MotanProvider) GetPath() string

func (*MotanProvider) GetURL

func (m *MotanProvider) GetURL() *motan.URL

func (*MotanProvider) Initialize

func (m *MotanProvider) Initialize()

func (*MotanProvider) IsAvailable

func (m *MotanProvider) IsAvailable() bool

func (*MotanProvider) SetContext

func (m *MotanProvider) SetContext(context *motan.Context)

func (*MotanProvider) SetProxy

func (m *MotanProvider) SetProxy(proxy bool)

func (*MotanProvider) SetSerialization

func (m *MotanProvider) SetSerialization(s motan.Serialization)

func (*MotanProvider) SetService

func (m *MotanProvider) SetService(s interface{})

func (*MotanProvider) SetURL

func (m *MotanProvider) SetURL(url *motan.URL)

Jump to

Keyboard shortcuts

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