core

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 22 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MaxWriteItemCount = 2000

	MaxImportItemCount = 10000

	// StatusCodeSuccess The request was executed successfully without any exception
	StatusCodeSuccess = 0

	// StatusCodeIdempotent A Request with the same "Request-ID" was already received. This Request was rejected
	StatusCodeIdempotent = 409

	// StatusCodeOperationLoss Operation information is missing due to an unknown exception
	StatusCodeOperationLoss = 410

	// StatusCodeTooManyRequest The server hope slow down request frequency, and this request was rejected
	StatusCodeTooManyRequest = 429
)

Variables

This section is empty.

Functions

func AsyncExecute

func AsyncExecute(runnable func())

func IsNetError

func IsNetError(err error) bool

func IsTimeoutError

func IsTimeoutError(err error) bool

func ReportRequestError added in v0.1.11

func ReportRequestError(metricsPrefix, url string, begin time.Time, code int, message string)

func ReportRequestException added in v0.1.11

func ReportRequestException(metricsPrefix, url string, begin time.Time, err error)

func ReportRequestSuccess added in v0.1.11

func ReportRequestSuccess(metricsPrefix, url string, begin time.Time)

func VolcSign

func VolcSign(req *fasthttp.Request, cred Credential) *fasthttp.Request

Types

type Context

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

func NewContext

func NewContext(param *ContextParam) (*Context, error)

func (*Context) AK

func (receiver *Context) AK() string

func (*Context) CustomerHeaders

func (receiver *Context) CustomerHeaders() map[string]string

func (*Context) HostHeader

func (receiver *Context) HostHeader() string

func (*Context) Hosts

func (receiver *Context) Hosts() []string

func (*Context) SK

func (receiver *Context) SK() string

func (*Context) Schema

func (receiver *Context) Schema() string

func (*Context) Tenant

func (receiver *Context) Tenant() string

func (*Context) TenantId

func (receiver *Context) TenantId() string

func (*Context) Token

func (receiver *Context) Token() string

func (*Context) UseAirAuth

func (receiver *Context) UseAirAuth() bool

func (*Context) UseVolcAuth

func (receiver *Context) UseVolcAuth() bool

type ContextParam

type ContextParam struct {
	Tenant     string
	TenantId   string
	Token      string
	AK         string
	SK         string
	Schema     string
	HostHeader string
	Hosts      []string
	Headers    map[string]string
	Region     Region
	UseAirAuth bool
}

type Credential

type Credential struct {
	AccessKeyID     string
	SecretAccessKey string
	Region          string
	Service         string
	SessionToken    string
}

type HTTPCaller added in v0.1.10

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

func NewHTTPCaller added in v0.1.10

func NewHTTPCaller(context *Context) *HTTPCaller

func (*HTTPCaller) DoJSONRequest added in v0.1.10

func (c *HTTPCaller) DoJSONRequest(url string, request interface{},
	response proto.Message, options *option.Options) error

func (*HTTPCaller) DoPBRequest added in v0.1.10

func (c *HTTPCaller) DoPBRequest(url string, request proto.Message,
	response proto.Message, options *option.Options) error

type HostAvailabler

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

func NewHostAvailabler

func NewHostAvailabler(urlCenter URLCenter, context *Context) *HostAvailabler

func (*HostAvailabler) Shutdown

func (receiver *HostAvailabler) Shutdown()

type Region

type Region int
const (
	RegionUnknown Region = iota
	RegionCn
	RegionSg
	RegionUs
	RegionAirCn
	RegionAirSg
	RegionSaasSg
)

type URLCenter

type URLCenter interface {
	Refresh(host string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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