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
- Variables
- func CreateResponse(code int32, message string) *registry.Response
- func CreateResponseWithSCErr(err *scerr.Error) *registry.Response
- func DependenciesToKeys(in []*registry.MicroServiceKey, domainProject string) []*registry.MicroServiceKey
- func MicroServiceToKey(domainProject string, in *registry.MicroService) *registry.MicroServiceKey
- type CommonParser
- type CreateValueFunc
- type GovernServiceCtrlServer
- type ParseValueFunc
- type Parser
- type ServerConfig
- type ServerInformation
- type ServiceCtrlServer
- type ServiceInstanceCtrlServer
- type ServiceInstanceCtrlServerEx
- type ServiceInstanceCtrl_WatchServer
Constants ¶
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 ¶
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 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 GovernServiceCtrlServer ¶
type GovernServiceCtrlServer interface { GetServiceDetail(context.Context, *registry.GetServiceRequest) (*registry.GetServiceDetailResponse, error) GetServicesInfo(context.Context, *registry.GetServicesInfoRequest) (*registry.GetServicesInfoResponse, error) GetApplications(context.Context, *registry.GetAppsRequest) (*registry.GetAppsResponse, error) }
type ParseValueFunc ¶
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 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 ServiceInstanceCtrlServer ¶
type ServiceInstanceCtrlServer interface { Register(context.Context, *registry.RegisterInstanceRequest) (*registry.RegisterInstanceResponse, error) Unregister(context.Context, *registry.UnregisterInstanceRequest) (*registry.UnregisterInstanceResponse, error) Heartbeat(context.Context, *registry.HeartbeatRequest) (*registry.HeartbeatResponse, error) Find(context.Context, *registry.FindInstancesRequest) (*registry.FindInstancesResponse, error) GetInstances(context.Context, *registry.GetInstancesRequest) (*registry.GetInstancesResponse, error) GetOneInstance(context.Context, *registry.GetOneInstanceRequest) (*registry.GetOneInstanceResponse, error) UpdateStatus(context.Context, *registry.UpdateInstanceStatusRequest) (*registry.UpdateInstanceStatusResponse, error) UpdateInstanceProperties(context.Context, *registry.UpdateInstancePropsRequest) (*registry.UpdateInstancePropsResponse, error) Watch(*registry.WatchInstanceRequest, ServiceInstanceCtrl_WatchServer) error HeartbeatSet(context.Context, *registry.HeartbeatSetRequest) (*registry.HeartbeatSetResponse, 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 }