core

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 22 Imported by: 1

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

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

func ReportRequestException

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

func ReportRequestSuccess

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

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

func NewHTTPCaller

func NewHTTPCaller(context *Context) *HTTPCaller

func (*HTTPCaller) DoJSONRequest

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

func (*HTTPCaller) DoPBRequest

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

type Region

type Region int
const (
	RegionUnknown Region = iota
	RegionAirCn
	RegionAirSg
)

type URLCenter

type URLCenter interface {
	Refresh(hosts []string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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