proto

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const (
	EXISTENCE_MS     string = "microservice"
	EXISTENCE_SCHEMA string = "schema"

	PROP_ALLOW_CROSS_APP = "allowCrossApp"

	Response_SUCCESS int32 = 0

	APP_ID  = "default"
	VERSION = "0.0.1"
)

Variables

View Source
var (
	BytesParser  = &CommonParser{newBytes, UnParse}
	StringParser = &CommonParser{newString, TextUnmarshal}
	MapParser    = &CommonParser{newMap, MapUnmarshal}

	ServiceParser         = &CommonParser{newService, JsonUnmarshal}
	InstanceParser        = &CommonParser{newInstance, JsonUnmarshal}
	RuleParser            = &CommonParser{newRule, JsonUnmarshal}
	DependencyRuleParser  = &CommonParser{newDependencyRule, JsonUnmarshal}
	DependencyQueueParser = &CommonParser{newDependencyQueue, JsonUnmarshal}
)

global parser

Functions

func CreateResponse

func CreateResponse(code int32, message string) *registry.Response

func CreateResponseWithSCErr

func CreateResponseWithSCErr(err *scerr.Error) *registry.Response

func DependenciesToKeys

func DependenciesToKeys(in []*registry.MicroServiceKey, domainProject string) []*registry.MicroServiceKey

func MicroServiceToKey

func MicroServiceToKey(domainProject string, in *registry.MicroService) *registry.MicroServiceKey

Types

type CommonParser

type CommonParser struct {
	NewFunc  CreateValueFunc
	FromFunc ParseValueFunc
}

func (*CommonParser) Unmarshal

func (p *CommonParser) Unmarshal(src []byte) (interface{}, error)

type CreateValueFunc

type CreateValueFunc func() interface{}

new

type ParseValueFunc

type ParseValueFunc func(src []byte, dist interface{}) error

parse

var (
	UnParse ParseValueFunc = func(src []byte, dist interface{}) error {
		if err := check(src, dist); err != nil {
			return err
		}
		d := dist.(*interface{})
		*d = src
		return nil
	}
	TextUnmarshal ParseValueFunc = func(src []byte, dist interface{}) error {
		if err := check(src, dist); err != nil {
			return err
		}
		d := dist.(*interface{})
		*d = util.BytesToStringWithNoCopy(src)
		return nil
	}
	MapUnmarshal ParseValueFunc = func(src []byte, dist interface{}) error {
		if err := check(src, dist); err != nil {
			return err
		}
		d := dist.(*interface{})
		m := (*d).(map[string]string)
		return json.Unmarshal(src, &m)
	}
	JsonUnmarshal ParseValueFunc = func(src []byte, dist interface{}) error {
		if err := check(src, dist); err != nil {
			return err
		}
		d := dist.(*interface{})
		return json.Unmarshal(src, *d)
	}
)

type Parser

type Parser interface {
	Unmarshal(src []byte) (interface{}, error)
}

type ServerConfig

type ServerConfig struct {
	MaxHeaderBytes int64 `json:"maxHeaderBytes"`
	MaxBodyBytes   int64 `json:"maxBodyBytes"`

	ReadHeaderTimeout string `json:"readHeaderTimeout"`
	ReadTimeout       string `json:"readTimeout"`
	IdleTimeout       string `json:"idleTimeout"`
	WriteTimeout      string `json:"writeTimeout"`

	LimitTTLUnit     string `json:"limitTTLUnit"`
	LimitConnections int64  `json:"limitConnections"`
	LimitIPLookup    string `json:"limitIPLookup"`

	SslEnabled    bool   `json:"sslEnabled,string"`
	SslMinVersion string `json:"sslMinVersion"`
	SslVerifyPeer bool   `json:"sslVerifyPeer,string"`
	SslCiphers    string `json:"sslCiphers"`

	AutoSyncInterval  string `json:"-"`
	CompactIndexDelta int64  `json:"-"`
	CompactInterval   string `json:"-"`

	EnablePProf bool `json:"enablePProf"`
	EnableCache bool `json:"enableCache"`

	EnableRBAC bool `json:"enableRBAC"`

	LogRotateSize   int64  `json:"-"`
	LogBackupCount  int64  `json:"-"`
	LogFilePath     string `json:"-"`
	LogLevel        string `json:"-"`
	LogFormat       string `json:"-"`
	LogSys          bool   `json:"-"`
	EnableAccessLog bool   `json:"-"`
	AccessLogFile   string `json:"-"`

	PluginsDir string          `json:"-"`
	Plugins    util.JSONObject `json:"plugins"`

	SelfRegister bool `json:"selfRegister"`

	//clear no-instance services
	ServiceClearEnabled  bool          `json:"serviceClearEnabled"`
	ServiceClearInterval time.Duration `json:"serviceClearInterval"`
	//if a service's existence time reaches this value, it can be cleared
	ServiceTTL time.Duration `json:"serviceTTL"`
	//CacheTTL is the ttl of cache
	CacheTTL time.Duration `json:"cacheTTL"`

	// if want disable Test Schema, SchemaDisable set true
	SchemaDisable bool `json:"schemaDisable"`
}

type ServerInformation

type ServerInformation struct {
	Version string       `json:"version"`
	Config  ServerConfig `json:"-"`
}

func NewServerInformation

func NewServerInformation() *ServerInformation

type ServiceCtrlServer

type ServiceCtrlServer interface {
	Exist(context.Context, *registry.GetExistenceRequest) (*registry.GetExistenceResponse, error)
	Create(context.Context, *registry.CreateServiceRequest) (*registry.CreateServiceResponse, error)
	Delete(context.Context, *registry.DeleteServiceRequest) (*registry.DeleteServiceResponse, error)
	GetOne(context.Context, *registry.GetServiceRequest) (*registry.GetServiceResponse, error)
	GetServices(context.Context, *registry.GetServicesRequest) (*registry.GetServicesResponse, error)
	UpdateProperties(context.Context, *registry.UpdateServicePropsRequest) (*registry.UpdateServicePropsResponse, error)
	AddRule(context.Context, *registry.AddServiceRulesRequest) (*registry.AddServiceRulesResponse, error)
	GetRule(context.Context, *registry.GetServiceRulesRequest) (*registry.GetServiceRulesResponse, error)
	UpdateRule(context.Context, *registry.UpdateServiceRuleRequest) (*registry.UpdateServiceRuleResponse, error)
	DeleteRule(context.Context, *registry.DeleteServiceRulesRequest) (*registry.DeleteServiceRulesResponse, error)
	AddTags(context.Context, *registry.AddServiceTagsRequest) (*registry.AddServiceTagsResponse, error)
	GetTags(context.Context, *registry.GetServiceTagsRequest) (*registry.GetServiceTagsResponse, error)
	UpdateTag(context.Context, *registry.UpdateServiceTagRequest) (*registry.UpdateServiceTagResponse, error)
	DeleteTags(context.Context, *registry.DeleteServiceTagsRequest) (*registry.DeleteServiceTagsResponse, error)
	GetSchemaInfo(context.Context, *registry.GetSchemaRequest) (*registry.GetSchemaResponse, error)
	GetAllSchemaInfo(context.Context, *registry.GetAllSchemaRequest) (*registry.GetAllSchemaResponse, error)
	DeleteSchema(context.Context, *registry.DeleteSchemaRequest) (*registry.DeleteSchemaResponse, error)
	ModifySchema(context.Context, *registry.ModifySchemaRequest) (*registry.ModifySchemaResponse, error)
	ModifySchemas(context.Context, *registry.ModifySchemasRequest) (*registry.ModifySchemasResponse, error)
	AddDependenciesForMicroServices(context.Context, *registry.AddDependenciesRequest) (*registry.AddDependenciesResponse, error)
	CreateDependenciesForMicroServices(context.Context, *registry.CreateDependenciesRequest) (*registry.CreateDependenciesResponse, error)
	GetProviderDependencies(context.Context, *registry.GetDependenciesRequest) (*registry.GetProDependenciesResponse, error)
	GetConsumerDependencies(context.Context, *registry.GetDependenciesRequest) (*registry.GetConDependenciesResponse, error)
	DeleteServices(context.Context, *registry.DelServicesRequest) (*registry.DelServicesResponse, error)
}

type ServiceInstanceCtrlServerEx

type ServiceInstanceCtrlServerEx interface {
	ServiceInstanceCtrlServer

	BatchFind(ctx context.Context, in *registry.BatchFindInstancesRequest) (*registry.BatchFindInstancesResponse, error)

	WebSocketWatch(ctx context.Context, in *registry.WatchInstanceRequest, conn *websocket.Conn)
	WebSocketListAndWatch(ctx context.Context, in *registry.WatchInstanceRequest, conn *websocket.Conn)

	ClusterHealth(ctx context.Context) (*registry.GetInstancesResponse, error)
}

type ServiceInstanceCtrl_WatchServer

type ServiceInstanceCtrl_WatchServer interface {
	Send(*registry.WatchInstanceResponse) error
	grpc.ServerStream
}

Jump to

Keyboard shortcuts

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