Documentation
¶
Index ¶
- Variables
- type Bootstrap
- func (*Bootstrap) Descriptor() ([]byte, []int)deprecated
- func (x *Bootstrap) GetClients() map[string]*ClientConfig
- func (x *Bootstrap) GetServers() []*v1.Server
- func (*Bootstrap) ProtoMessage()
- func (x *Bootstrap) ProtoReflect() protoreflect.Message
- func (x *Bootstrap) Reset()
- func (x *Bootstrap) String() string
- func (m *Bootstrap) Validate() error
- func (m *Bootstrap) ValidateAll() error
- type BootstrapMultiError
- type BootstrapValidationError
- type ClientConfig
- func (*ClientConfig) Descriptor() ([]byte, []int)deprecated
- func (x *ClientConfig) GetEndpoint() *v11.Endpoint
- func (x *ClientConfig) GetTransport() *v1.Client
- func (*ClientConfig) ProtoMessage()
- func (x *ClientConfig) ProtoReflect() protoreflect.Message
- func (x *ClientConfig) Reset()
- func (x *ClientConfig) String() string
- func (m *ClientConfig) Validate() error
- func (m *ClientConfig) ValidateAll() error
- type ClientConfigMultiError
- type ClientConfigValidationError
- func (e ClientConfigValidationError) Cause() error
- func (e ClientConfigValidationError) Error() string
- func (e ClientConfigValidationError) ErrorName() string
- func (e ClientConfigValidationError) Field() string
- func (e ClientConfigValidationError) Key() bool
- func (e ClientConfigValidationError) Reason() string
Constants ¶
This section is empty.
Variables ¶
var File_examples_protos_http_server_grpc_client_bootstrap_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Bootstrap ¶
type Bootstrap struct {
// Server configuration list
// Typically, this would configure an HTTP server to provide APIs
// For example:
// - Port number
// - Middleware configuration
// - Timeout settings
Servers []*v1.Server `protobuf:"bytes,1,rep,name=servers,proto3" json:"servers,omitempty"`
// Downstream gRPC client configuration mapping
// The key is the logical name of the client, used to reference specific clients in code
// For example:
// - "user-service-client"
// - "order-service-client"
Clients map[string]*ClientConfig `` /* 141-byte string literal not displayed */
// contains filtered or unexported fields
}
Bootstrap is the top-level configuration for a microservice with HTTP server and gRPC client This architecture pattern is suitable for scenarios that need to provide RESTful APIs while calling other gRPC services
func (*Bootstrap) Descriptor
deprecated
func (*Bootstrap) GetClients ¶
func (x *Bootstrap) GetClients() map[string]*ClientConfig
func (*Bootstrap) GetServers ¶
func (*Bootstrap) ProtoMessage ¶
func (*Bootstrap) ProtoMessage()
func (*Bootstrap) ProtoReflect ¶
func (x *Bootstrap) ProtoReflect() protoreflect.Message
func (*Bootstrap) Validate ¶ added in v0.2.7
Validate checks the field values on Bootstrap with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Bootstrap) ValidateAll ¶ added in v0.2.7
ValidateAll checks the field values on Bootstrap with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in BootstrapMultiError, or nil if none found.
type BootstrapMultiError ¶ added in v0.2.7
type BootstrapMultiError []error
BootstrapMultiError is an error wrapping multiple validation errors returned by Bootstrap.ValidateAll() if the designated constraints aren't met.
func (BootstrapMultiError) AllErrors ¶ added in v0.2.7
func (m BootstrapMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (BootstrapMultiError) Error ¶ added in v0.2.7
func (m BootstrapMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type BootstrapValidationError ¶ added in v0.2.7
type BootstrapValidationError struct {
// contains filtered or unexported fields
}
BootstrapValidationError is the validation error returned by Bootstrap.Validate if the designated constraints aren't met.
func (BootstrapValidationError) Cause ¶ added in v0.2.7
func (e BootstrapValidationError) Cause() error
Cause function returns cause value.
func (BootstrapValidationError) Error ¶ added in v0.2.7
func (e BootstrapValidationError) Error() string
Error satisfies the builtin error interface
func (BootstrapValidationError) ErrorName ¶ added in v0.2.7
func (e BootstrapValidationError) ErrorName() string
ErrorName returns error name.
func (BootstrapValidationError) Field ¶ added in v0.2.7
func (e BootstrapValidationError) Field() string
Field function returns field value.
func (BootstrapValidationError) Key ¶ added in v0.2.7
func (e BootstrapValidationError) Key() bool
Key function returns key value.
func (BootstrapValidationError) Reason ¶ added in v0.2.7
func (e BootstrapValidationError) Reason() string
Reason function returns reason value.
type ClientConfig ¶
type ClientConfig struct {
// Business-level client configuration
// Mainly configures how to discover and select gRPC service instances, for example:
// - Service discovery method (direct, DNS, Consul, etc.)
// - Load balancing strategy
// - Circuit breaking and fallback configuration
Endpoint *v11.Endpoint `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
// Transport-level client configuration
// Mainly configures how to communicate with gRPC service instances, for example:
// - Connection pool configuration
// - Timeout settings
// - Retry policy
// - TLS configuration
Transport *v1.Client `protobuf:"bytes,2,opt,name=transport,proto3" json:"transport,omitempty"`
// contains filtered or unexported fields
}
ClientConfig combines all configurations needed for a gRPC client It includes service discovery and transport layer configurations
func (*ClientConfig) Descriptor
deprecated
func (*ClientConfig) Descriptor() ([]byte, []int)
Deprecated: Use ClientConfig.ProtoReflect.Descriptor instead.
func (*ClientConfig) GetEndpoint ¶
func (x *ClientConfig) GetEndpoint() *v11.Endpoint
func (*ClientConfig) GetTransport ¶
func (x *ClientConfig) GetTransport() *v1.Client
func (*ClientConfig) ProtoMessage ¶
func (*ClientConfig) ProtoMessage()
func (*ClientConfig) ProtoReflect ¶
func (x *ClientConfig) ProtoReflect() protoreflect.Message
func (*ClientConfig) Reset ¶
func (x *ClientConfig) Reset()
func (*ClientConfig) String ¶
func (x *ClientConfig) String() string
func (*ClientConfig) Validate ¶ added in v0.2.7
func (m *ClientConfig) Validate() error
Validate checks the field values on ClientConfig with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*ClientConfig) ValidateAll ¶ added in v0.2.7
func (m *ClientConfig) ValidateAll() error
ValidateAll checks the field values on ClientConfig with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ClientConfigMultiError, or nil if none found.
type ClientConfigMultiError ¶ added in v0.2.7
type ClientConfigMultiError []error
ClientConfigMultiError is an error wrapping multiple validation errors returned by ClientConfig.ValidateAll() if the designated constraints aren't met.
func (ClientConfigMultiError) AllErrors ¶ added in v0.2.7
func (m ClientConfigMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ClientConfigMultiError) Error ¶ added in v0.2.7
func (m ClientConfigMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ClientConfigValidationError ¶ added in v0.2.7
type ClientConfigValidationError struct {
// contains filtered or unexported fields
}
ClientConfigValidationError is the validation error returned by ClientConfig.Validate if the designated constraints aren't met.
func (ClientConfigValidationError) Cause ¶ added in v0.2.7
func (e ClientConfigValidationError) Cause() error
Cause function returns cause value.
func (ClientConfigValidationError) Error ¶ added in v0.2.7
func (e ClientConfigValidationError) Error() string
Error satisfies the builtin error interface
func (ClientConfigValidationError) ErrorName ¶ added in v0.2.7
func (e ClientConfigValidationError) ErrorName() string
ErrorName returns error name.
func (ClientConfigValidationError) Field ¶ added in v0.2.7
func (e ClientConfigValidationError) Field() string
Field function returns field value.
func (ClientConfigValidationError) Key ¶ added in v0.2.7
func (e ClientConfigValidationError) Key() bool
Key function returns key value.
func (ClientConfigValidationError) Reason ¶ added in v0.2.7
func (e ClientConfigValidationError) Reason() string
Reason function returns reason value.