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.
* 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.
* 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.
* 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.
* 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 ¶
- func GetConsumerService(name string) common.RPCService
- func GetProviderService(name string) common.RPCService
- func GetRPCService(name string) common.RPCService
- func Load()
- func RPCService(service common.RPCService)
- func SetConsumerConfig(c ConsumerConfig)
- func SetConsumerService(service common.RPCService)
- func SetProviderConfig(p ProviderConfig)
- func SetProviderService(service common.RPCService)
- type ApplicationConfig
- type BaseConfig
- type ConfigCenterConfig
- type ConsumerConfig
- type MethodConfig
- type MockService
- type ProtocolConfig
- type ProviderConfig
- type ReferenceConfig
- func (refconfig *ReferenceConfig) GetRPCService() common.RPCService
- func (refconfig *ReferenceConfig) Implement(v common.RPCService)
- func (c *ReferenceConfig) Prefix() string
- func (refconfig *ReferenceConfig) Refer()
- func (refconfig *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
- type RegistryConfig
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConsumerService ¶
func GetConsumerService(name string) common.RPCService
func GetProviderService ¶
func GetProviderService(name string) common.RPCService
func SetConsumerConfig ¶
func SetConsumerConfig(c ConsumerConfig)
func SetConsumerService ¶
func SetConsumerService(service common.RPCService)
SetConService is called by init() of implement of RPCService
func SetProviderConfig ¶
func SetProviderConfig(p ProviderConfig)
func SetProviderService ¶
func SetProviderService(service common.RPCService)
SetProService is called by init() of implement of RPCService
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct {
Organization string `yaml:"organization" json:"organization,omitempty" property:"organization"`
Name string `yaml:"name" json:"name,omitempty" property:"name"`
Module string `yaml:"module" json:"module,omitempty" property:"module"`
Version string `yaml:"version" json:"version,omitempty" property:"version"`
Owner string `yaml:"owner" json:"owner,omitempty" property:"owner"`
Environment string `yaml:"environment" json:"environment,omitempty" property:"environment"`
}
func (*ApplicationConfig) Id ¶
func (c *ApplicationConfig) Id() string
func (*ApplicationConfig) Prefix ¶
func (*ApplicationConfig) Prefix() string
func (*ApplicationConfig) SetId ¶
func (c *ApplicationConfig) SetId(id string)
type BaseConfig ¶
type BaseConfig struct {
ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"`
// contains filtered or unexported fields
}
func (*BaseConfig) SetFatherConfig ¶
func (c *BaseConfig) SetFatherConfig(fatherConfig interface{})
type ConfigCenterConfig ¶
type ConfigCenterConfig struct {
Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty"`
Address string `yaml:"address" json:"address,omitempty"`
Cluster string `yaml:"cluster" json:"cluster,omitempty"`
Group string `default:"dubbo" yaml:"group" json:"group,omitempty"`
Username string `yaml:"username" json:"username,omitempty"`
Password string `yaml:"password" json:"password,omitempty"`
ConfigFile string `default:"dubbo.properties" yaml:"config_file" json:"config_file,omitempty"`
TimeoutStr string `yaml:"timeout" json:"timeout,omitempty"`
// contains filtered or unexported fields
}
type ConsumerConfig ¶
type ConsumerConfig struct {
BaseConfig `yaml:",inline"`
Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
// application
ApplicationConfig *ApplicationConfig `yaml:"application_config" json:"application_config,omitempty" property:"application_config"`
// client
Connect_Timeout string `default:"100ms" yaml:"connect_timeout" json:"connect_timeout,omitempty" property:"connect_timeout"`
ConnectTimeout time.Duration
Request_Timeout string `yaml:"request_timeout" default:"5s" json:"request_timeout,omitempty" property:"request_timeout"`
RequestTimeout time.Duration
ProxyFactory string `yaml:"proxy_factory" default:"default" json:"proxy_factory,omitempty" property:"proxy_factory"`
Check *bool `yaml:"check" json:"check,omitempty" property:"check"`
Registries map[string]*RegistryConfig `yaml:"registries" json:"registries,omitempty" property:"registries"`
References map[string]*ReferenceConfig `yaml:"references" json:"references,omitempty" property:"references"`
ProtocolConf interface{} `yaml:"protocol_conf" json:"protocol_conf,omitempty" property:"protocol_conf"`
}
func GetConsumerConfig ¶
func GetConsumerConfig() ConsumerConfig
func (*ConsumerConfig) Prefix ¶
func (*ConsumerConfig) Prefix() string
type MethodConfig ¶
type MethodConfig struct {
InterfaceId string
InterfaceName string
Name string `yaml:"name" json:"name,omitempty" property:"name"`
Retries int64 `yaml:"retries" json:"retries,omitempty" property:"retries"`
Loadbalance string `yaml:"loadbalance" json:"loadbalance,omitempty" property:"loadbalance"`
Weight int64 `yaml:"weight" json:"weight,omitempty" property:"weight"`
}
func (*MethodConfig) Prefix ¶
func (c *MethodConfig) Prefix() string
type MockService ¶
type MockService struct{}
func (*MockService) GetUser ¶
func (*MockService) GetUser(ctx context.Context, itf []interface{}, str *struct{}) error
func (*MockService) GetUser1 ¶
func (*MockService) GetUser1(ctx context.Context, itf []interface{}, str *struct{}) error
func (*MockService) Service ¶
func (*MockService) Service() string
func (*MockService) Version ¶
func (*MockService) Version() string
type ProtocolConfig ¶
type ProtocolConfig struct {
Name string `required:"true" yaml:"name" json:"name,omitempty" property:"name"`
Ip string `required:"true" yaml:"ip" json:"ip,omitempty" property:"ip"`
Port string `required:"true" yaml:"port" json:"port,omitempty" property:"port"`
}
func (*ProtocolConfig) Prefix ¶
func (c *ProtocolConfig) Prefix() string
type ProviderConfig ¶
type ProviderConfig struct {
BaseConfig `yaml:",inline"`
Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
ProxyFactory string `yaml:"proxy_factory" default:"default" json:"proxy_factory,omitempty" property:"proxy_factory"`
ApplicationConfig *ApplicationConfig `yaml:"application_config" json:"application_config,omitempty" property:"application_config"`
Registries map[string]*RegistryConfig `yaml:"registries" json:"registries,omitempty" property:"registries"`
Services map[string]*ServiceConfig `yaml:"services" json:"services,omitempty" property:"services"`
Protocols map[string]*ProtocolConfig `yaml:"protocols" json:"protocols,omitempty" property:"protocols"`
ProtocolConf interface{} `yaml:"protocol_conf" json:"protocol_conf,omitempty" property:"protocol_conf" `
}
func GetProviderConfig ¶
func GetProviderConfig() ProviderConfig
func (*ProviderConfig) Prefix ¶
func (*ProviderConfig) Prefix() string
type ReferenceConfig ¶
type ReferenceConfig struct {
InterfaceName string `required:"true" yaml:"interface" json:"interface,omitempty" property:"interface"`
Check *bool `yaml:"check" json:"check,omitempty" property:"check"`
Url string `yaml:"url" json:"url,omitempty" property:"url"`
Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
Protocol string `yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
Registry string `yaml:"registry" json:"registry,omitempty" property:"registry"`
Cluster string `yaml:"cluster" json:"cluster,omitempty" property:"cluster"`
Loadbalance string `yaml:"loadbalance" json:"loadbalance,omitempty" property:"loadbalance"`
Retries int64 `yaml:"retries" json:"retries,omitempty" property:"retries"`
Group string `yaml:"group" json:"group,omitempty" property:"group"`
Version string `yaml:"version" json:"version,omitempty" property:"version"`
Methods []*MethodConfig `yaml:"methods" json:"methods,omitempty" property:"methods"`
// contains filtered or unexported fields
}
func NewReferenceConfig ¶
func NewReferenceConfig(ctx context.Context) *ReferenceConfig
func (*ReferenceConfig) GetRPCService ¶
func (refconfig *ReferenceConfig) GetRPCService() common.RPCService
func (*ReferenceConfig) Implement ¶
func (refconfig *ReferenceConfig) Implement(v common.RPCService)
@v is service provider implemented RPCService
func (*ReferenceConfig) Prefix ¶
func (c *ReferenceConfig) Prefix() string
func (*ReferenceConfig) Refer ¶
func (refconfig *ReferenceConfig) Refer()
func (*ReferenceConfig) UnmarshalYAML ¶
func (refconfig *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type RegistryConfig ¶
type RegistryConfig struct {
Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
//I changed "type" to "protocol" ,the same as "protocol" field in java class RegistryConfig
TimeoutStr string `yaml:"timeout" default:"5s" json:"timeout,omitempty" property:"timeout"` // unit: second
Group string `yaml:"group" json:"group,omitempty" property:"group"`
//for registry
Address string `yaml:"address" json:"address,omitempty" property:"address"`
Username string `yaml:"username" json:"username,omitempty" property:"username"`
Password string `yaml:"password" json:"password,omitempty" property:"password"`
}
func (*RegistryConfig) Prefix ¶
func (*RegistryConfig) Prefix() string
type ServiceConfig ¶
type ServiceConfig struct {
Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
Protocol string `required:"true" yaml:"protocol" json:"protocol,omitempty" property:"protocol"` //multi protocol support, split by ','
InterfaceName string `required:"true" yaml:"interface" json:"interface,omitempty" property:"interface"`
Registry string `yaml:"registry" json:"registry,omitempty" property:"registry"`
Cluster string `default:"failover" yaml:"cluster" json:"cluster,omitempty" property:"cluster"`
Loadbalance string `default:"random" yaml:"loadbalance" json:"loadbalance,omitempty" property:"loadbalance"`
Group string `yaml:"group" json:"group,omitempty" property:"group"`
Version string `yaml:"version" json:"version,omitempty" property:"version" `
Methods []*MethodConfig `yaml:"methods" json:"methods,omitempty" property:"methods"`
Warmup string `yaml:"warmup" json:"warmup,omitempty" property:"warmup"`
Retries int64 `yaml:"retries" json:"retries,omitempty" property:"retries"`
// contains filtered or unexported fields
}
func NewServiceConfig ¶
func NewServiceConfig() *ServiceConfig
func (*ServiceConfig) Export ¶
func (srvconfig *ServiceConfig) Export() error
func (*ServiceConfig) Implement ¶
func (srvconfig *ServiceConfig) Implement(s common.RPCService)
func (*ServiceConfig) Prefix ¶
func (c *ServiceConfig) Prefix() string