common

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Provider = "Provider"
	Consumer = "Consumer"
)

constant for provider and consumer

View Source
const (
	// ScopeFull means service is able to access to another app's service
	ScopeFull = "full"
	// ScopeApp means service is not able to access to another app's service
	ScopeApp = "app"
)
View Source
const (
	Env = "go-chassis_ENV"

	EnvNodeIP      = "HOSTING_SERVER_IP"
	EnvSchemaRoot  = "SCHEMA_ROOT"
	EnvProjectID   = "CSE_PROJECT_ID"
	EnvCSEEndpoint = "PAAS_CSE_ENDPOINT"
)

constant for micro service environment parameters

View Source
const (
	CseRegistryAddress     = "CSE_REGISTRY_ADDR"
	CseConfigCenterAddress = "CSE_CONFIG_CENTER_ADDR"
	CseMonitorServer       = "CSE_MONITOR_SERVER_ADDR"
)

constant environment keys service center, config center, monitor server addresses

View Source
const (
	ServiceName = "SERVICE_NAME"
	Version     = "VERSION"
)

env connect with "." like service_description.name and service_description.version which can not be used in k8s. So we can not use archaius to set env. To support this declaring constant for service name and version constant for service name and version.

View Source
const (
	EnvValueDev  = "development"
	EnvValueProd = "production"
)

constant for microservice environment

View Source
const (
	SslCipherPluginKey = "cipherPlugin"
	SslVerifyPeerKey   = "verifyPeer"
	SslCipherSuitsKey  = "cipherSuits"
	SslProtocolKey     = "protocol"
	SslCaFileKey       = "caFile"
	SslCertFileKey     = "certFile"
	SslKeyFileKey      = "keyFile"
	SslCertPwdFileKey  = "certPwdFile"
	AKSKCustomCipher   = "cse.credentials.akskCustomCipher"
)

constant for secure socket layer parameters

View Source
const (
	ProtocolRest    = "rest"
	ProtocolHighway = "highway"
	LBSessionID     = "go-chassisLB"
)

constant for protocol types

View Source
const (
	DefaultApp        = "default"
	DefaultVersion    = "0.0.1"
	LatestVersion     = "latest"
	AllVersion        = "0+"
	DefaultStatus     = "UP"
	DefaultLevel      = "BACK"
	DefaultHBInterval = 30
)

constant for default application name and version

View Source
const (
	HTTP   = "http"
	HTTPS  = "https"
	JSON   = "application/json"
	Create = "CREATE"
	Update = "UPDATE"
	Delete = "DELETE"

	Client           = "client"
	File             = "File"
	DefaultTenant    = "default"
	DefaultChainName = "default"

	FileRegistry      = "File"
	DefaultUserName   = "default"
	DefaultDomainName = "default"
	DefaultProvider   = "default"
)

constant used

View Source
const BuildinLabelVersion = BuildinTagVersion + ":" + LatestVersion

BuildinLabelVersion build label for version

View Source
const BuildinTagApp = "app"

BuildinTagApp build tag for the application

View Source
const BuildinTagVersion = "version"

BuildinTagVersion build tag version

View Source
const CallerKey = "caller"

CallerKey caller key

View Source
const DefaultKey = "default"

DefaultKey default key

View Source
const (
	DefaultRefreshMode = 1
)

const default config for config-center

View Source
const DefaultValue = "default"

DefaultValue default value

View Source
const (
	// HeaderSourceName is constant for header source name
	HeaderSourceName = "x-cse-src-microservice"
)
View Source
const (
	// RestMethod is the http method for restful protocol
	RestMethod = "method"
)

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) map[string]string

FromContext return the headers which should be send to provider through transport

func NewContext

func NewContext(m map[string]string) context.Context

NewContext transforms a metadata to context object

func WithContext

func WithContext(ctx context.Context, key, val string) context.Context

WithContext sets the KV and returns the context object

Types

type ContextHeaderKey added in v0.7.1

type ContextHeaderKey struct{}

ContextHeaderKey is the key of header value in context

Jump to

Keyboard shortcuts

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