mirror of
https://github.com/go-micro/go-micro.git
synced 2025-09-16 08:36:30 +02:00
fix: struct field alignment (#2632)
This commit is contained in:
@@ -19,28 +19,31 @@ import (
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
// For the Command Line itself
|
||||
Name string
|
||||
Description string
|
||||
Version string
|
||||
|
||||
// We need pointers to things so we can swap them out if needed.
|
||||
Broker *broker.Broker
|
||||
Registry *registry.Registry
|
||||
Selector *selector.Selector
|
||||
// Other options for implementations of the interface
|
||||
// can be stored in a context
|
||||
Context context.Context
|
||||
Auth *auth.Auth
|
||||
Selector *selector.Selector
|
||||
Profile *profile.Profile
|
||||
|
||||
Registry *registry.Registry
|
||||
|
||||
Brokers map[string]func(...broker.Option) broker.Broker
|
||||
Transport *transport.Transport
|
||||
Cache *cache.Cache
|
||||
Config *config.Config
|
||||
Client *client.Client
|
||||
Server *server.Server
|
||||
Runtime *runtime.Runtime
|
||||
Store *store.Store
|
||||
Caches map[string]func(...cache.Option) cache.Cache
|
||||
Tracer *trace.Tracer
|
||||
Auth *auth.Auth
|
||||
Profile *profile.Profile
|
||||
Profiles map[string]func(...profile.Option) profile.Profile
|
||||
|
||||
Brokers map[string]func(...broker.Option) broker.Broker
|
||||
Caches map[string]func(...cache.Option) cache.Cache
|
||||
// We need pointers to things so we can swap them out if needed.
|
||||
Broker *broker.Broker
|
||||
Auths map[string]func(...auth.Option) auth.Auth
|
||||
Store *store.Store
|
||||
Configs map[string]func(...config.Option) (config.Config, error)
|
||||
Clients map[string]func(...client.Option) client.Client
|
||||
Registries map[string]func(...registry.Option) registry.Registry
|
||||
@@ -50,12 +53,11 @@ type Options struct {
|
||||
Runtimes map[string]func(...runtime.Option) runtime.Runtime
|
||||
Stores map[string]func(...store.Option) store.Store
|
||||
Tracers map[string]func(...trace.Option) trace.Tracer
|
||||
Auths map[string]func(...auth.Option) auth.Auth
|
||||
Profiles map[string]func(...profile.Option) profile.Profile
|
||||
Version string
|
||||
|
||||
// Other options for implementations of the interface
|
||||
// can be stored in a context
|
||||
Context context.Context
|
||||
// For the Command Line itself
|
||||
Name string
|
||||
Description string
|
||||
}
|
||||
|
||||
// Command line Name.
|
||||
|
@@ -30,9 +30,9 @@ func RegisterHandler(s server.Server, readDir string) {
|
||||
}
|
||||
|
||||
type handler struct {
|
||||
readDir string
|
||||
session *session
|
||||
logger log.Logger
|
||||
session *session
|
||||
readDir string
|
||||
}
|
||||
|
||||
func (h *handler) Open(ctx context.Context, req *proto.OpenRequest, rsp *proto.OpenResponse) error {
|
||||
@@ -120,9 +120,9 @@ func (h *handler) Write(ctx context.Context, req *proto.WriteRequest, rsp *proto
|
||||
}
|
||||
|
||||
type session struct {
|
||||
sync.Mutex
|
||||
files map[int64]*os.File
|
||||
counter int64
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func (s *session) Add(file *os.File) int64 {
|
||||
|
@@ -16,20 +16,20 @@ import (
|
||||
// Request is used to construct a http request for the k8s API.
|
||||
type Request struct {
|
||||
// the request context
|
||||
context context.Context
|
||||
client *http.Client
|
||||
header http.Header
|
||||
params url.Values
|
||||
method string
|
||||
host string
|
||||
namespace string
|
||||
context context.Context
|
||||
body io.Reader
|
||||
|
||||
resource string
|
||||
err error
|
||||
client *http.Client
|
||||
header http.Header
|
||||
params url.Values
|
||||
resourceName *string
|
||||
subResource *string
|
||||
body io.Reader
|
||||
method string
|
||||
host string
|
||||
namespace string
|
||||
|
||||
err error
|
||||
resource string
|
||||
}
|
||||
|
||||
// Params is the object to pass in to set parameters
|
||||
@@ -246,10 +246,10 @@ func (r *Request) Raw() (*http.Response, error) {
|
||||
|
||||
// Options ...
|
||||
type Options struct {
|
||||
Host string
|
||||
Namespace string
|
||||
BearerToken *string
|
||||
Client *http.Client
|
||||
Host string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// NewRequest creates a k8s api request.
|
||||
|
@@ -5,8 +5,8 @@ type CreateOptions struct {
|
||||
}
|
||||
|
||||
type GetOptions struct {
|
||||
Namespace string
|
||||
Labels map[string]string
|
||||
Namespace string
|
||||
}
|
||||
type UpdateOptions struct {
|
||||
Namespace string
|
||||
@@ -19,13 +19,13 @@ type ListOptions struct {
|
||||
}
|
||||
|
||||
type LogOptions struct {
|
||||
Namespace string
|
||||
Params map[string]string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
type WatchOptions struct {
|
||||
Namespace string
|
||||
Params map[string]string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
type CreateOption func(*CreateOptions)
|
||||
|
@@ -3,9 +3,9 @@ package client
|
||||
// ContainerPort.
|
||||
type ContainerPort struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
HostPort int `json:"hostPort,omitempty"`
|
||||
ContainerPort int `json:"containerPort"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
}
|
||||
|
||||
// EnvVar is environment variable.
|
||||
@@ -32,9 +32,9 @@ type Container struct {
|
||||
|
||||
// DeploymentSpec defines micro deployment spec.
|
||||
type DeploymentSpec struct {
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
Selector *LabelSelector `json:"selector"`
|
||||
Template *Template `json:"template,omitempty"`
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
}
|
||||
|
||||
// DeploymentCondition describes the state of deployment.
|
||||
@@ -47,12 +47,12 @@ type DeploymentCondition struct {
|
||||
|
||||
// DeploymentStatus is returned when querying deployment.
|
||||
type DeploymentStatus struct {
|
||||
Conditions []DeploymentCondition `json:"conditions,omitempty"`
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
UpdatedReplicas int `json:"updatedReplicas,omitempty"`
|
||||
ReadyReplicas int `json:"readyReplicas,omitempty"`
|
||||
AvailableReplicas int `json:"availableReplicas,omitempty"`
|
||||
UnavailableReplicas int `json:"unavailableReplicas,omitempty"`
|
||||
Conditions []DeploymentCondition `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// Deployment is Kubernetes deployment.
|
||||
@@ -84,17 +84,17 @@ type LoadBalancerStatus struct {
|
||||
|
||||
// Metadata defines api object metadata.
|
||||
type Metadata struct {
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
// PodSpec is a pod.
|
||||
type PodSpec struct {
|
||||
Containers []Container `json:"containers"`
|
||||
ServiceAccountName string `json:"serviceAccountName"`
|
||||
Containers []Container `json:"containers"`
|
||||
}
|
||||
|
||||
// PodList.
|
||||
@@ -111,11 +111,11 @@ type Pod struct {
|
||||
|
||||
// PodStatus.
|
||||
type PodStatus struct {
|
||||
Conditions []PodCondition `json:"conditions,omitempty"`
|
||||
Containers []ContainerStatus `json:"containerStatuses"`
|
||||
PodIP string `json:"podIP"`
|
||||
Phase string `json:"phase"`
|
||||
Reason string `json:"reason"`
|
||||
Conditions []PodCondition `json:"conditions,omitempty"`
|
||||
Containers []ContainerStatus `json:"containerStatuses"`
|
||||
}
|
||||
|
||||
// PodCondition describes the state of pod.
|
||||
@@ -137,16 +137,16 @@ type ContainerState struct {
|
||||
|
||||
// Resource is API resource.
|
||||
type Resource struct {
|
||||
Value interface{}
|
||||
Name string
|
||||
Kind string
|
||||
Value interface{}
|
||||
}
|
||||
|
||||
// ServicePort configures service ports.
|
||||
type ServicePort struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Port int `json:"port"`
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
Port int `json:"port"`
|
||||
}
|
||||
|
||||
// ServiceSpec provides service configuration.
|
||||
@@ -197,9 +197,9 @@ type ImagePullSecret struct {
|
||||
|
||||
// Secret.
|
||||
type Secret struct {
|
||||
Type string `json:"type,omitempty"`
|
||||
Data map[string]string `json:"data"`
|
||||
Metadata *Metadata `json:"metadata"`
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAccount.
|
||||
|
@@ -18,16 +18,17 @@ import (
|
||||
type ServiceEntry struct {
|
||||
Name string
|
||||
Host string
|
||||
Info string
|
||||
AddrV4 net.IP
|
||||
AddrV6 net.IP
|
||||
Port int
|
||||
Info string
|
||||
InfoFields []string
|
||||
TTL int
|
||||
Type uint16
|
||||
|
||||
Addr net.IP // @Deprecated
|
||||
|
||||
Port int
|
||||
TTL int
|
||||
Type uint16
|
||||
|
||||
hasTXT bool
|
||||
sent bool
|
||||
}
|
||||
@@ -39,13 +40,13 @@ func (s *ServiceEntry) complete() bool {
|
||||
|
||||
// QueryParam is used to customize how a Lookup is performed.
|
||||
type QueryParam struct {
|
||||
Service string // Service to lookup
|
||||
Domain string // Lookup domain, default "local"
|
||||
Type uint16 // Lookup type, defaults to dns.TypePTR
|
||||
Context context.Context // Context
|
||||
Timeout time.Duration // Lookup timeout, default 1 second. Ignored if Context is provided
|
||||
Interface *net.Interface // Multicast interface to use
|
||||
Entries chan<- *ServiceEntry // Entries Channel
|
||||
Service string // Service to lookup
|
||||
Domain string // Lookup domain, default "local"
|
||||
Timeout time.Duration // Lookup timeout, default 1 second. Ignored if Context is provided
|
||||
Type uint16 // Lookup type, defaults to dns.TypePTR
|
||||
WantUnicastResponse bool // Unicast response desired, as per 5.4 in RFC
|
||||
}
|
||||
|
||||
@@ -170,9 +171,10 @@ type client struct {
|
||||
ipv4MulticastConn *net.UDPConn
|
||||
ipv6MulticastConn *net.UDPConn
|
||||
|
||||
closed bool
|
||||
closedCh chan struct{} // TODO(reddaly): This doesn't appear to be used.
|
||||
closeLock sync.Mutex
|
||||
|
||||
closed bool
|
||||
}
|
||||
|
||||
// NewClient creates a new mdns Client that can be used to query
|
||||
|
@@ -53,11 +53,12 @@ type Config struct {
|
||||
// is used.
|
||||
Iface *net.Interface
|
||||
|
||||
// GetMachineIP is a function to return the IP of the local machine
|
||||
GetMachineIP GetMachineIP
|
||||
|
||||
// Port If it is not 0, replace the port 5353 with this port number.
|
||||
Port int
|
||||
|
||||
// GetMachineIP is a function to return the IP of the local machine
|
||||
GetMachineIP GetMachineIP
|
||||
// LocalhostChecking if enabled asks the server to also send responses to 0.0.0.0 if the target IP
|
||||
// is this host (as defined by GetMachineIP). Useful in case machine is on a VPN which blocks comms on non standard ports
|
||||
LocalhostChecking bool
|
||||
@@ -71,12 +72,14 @@ type Server struct {
|
||||
ipv4List *net.UDPConn
|
||||
ipv6List *net.UDPConn
|
||||
|
||||
shutdown bool
|
||||
shutdownCh chan struct{}
|
||||
shutdownLock sync.Mutex
|
||||
wg sync.WaitGroup
|
||||
shutdownCh chan struct{}
|
||||
|
||||
outboundIP net.IP
|
||||
wg sync.WaitGroup
|
||||
|
||||
shutdownLock sync.Mutex
|
||||
|
||||
shutdown bool
|
||||
}
|
||||
|
||||
// NewServer is used to create a new mDNS server from a config.
|
||||
|
@@ -28,13 +28,13 @@ type MDNSService struct {
|
||||
Service string // Service name (e.g. "_http._tcp.")
|
||||
Domain string // If blank, assumes "local"
|
||||
HostName string // Host machine DNS name (e.g. "mymachine.net.")
|
||||
Port int // Service Port
|
||||
serviceAddr string // Fully qualified service address
|
||||
instanceAddr string // Fully qualified instance address
|
||||
enumAddr string // _services._dns-sd._udp.<domain>
|
||||
IPs []net.IP // IP addresses for the service's host
|
||||
TXT []string // Service TXT records
|
||||
Port int // Service Port
|
||||
TTL uint32
|
||||
serviceAddr string // Fully qualified service address
|
||||
instanceAddr string // Fully qualified instance address
|
||||
enumAddr string // _services._dns-sd._udp.<domain>
|
||||
}
|
||||
|
||||
// validateFQDN returns an error if the passed string is not a fully qualified
|
||||
|
@@ -11,17 +11,18 @@ import (
|
||||
|
||||
// CertOptions are passed to cert options.
|
||||
type CertOptions struct {
|
||||
IsCA bool
|
||||
Subject pkix.Name
|
||||
DNSNames []string
|
||||
IPAddresses []net.IP
|
||||
SerialNumber *big.Int
|
||||
NotBefore time.Time
|
||||
NotAfter time.Time
|
||||
NotBefore time.Time
|
||||
NotAfter time.Time
|
||||
|
||||
Parent *x509.Certificate
|
||||
Pub ed25519.PublicKey
|
||||
Priv ed25519.PrivateKey
|
||||
SerialNumber *big.Int
|
||||
|
||||
Parent *x509.Certificate
|
||||
Subject pkix.Name
|
||||
DNSNames []string
|
||||
IPAddresses []net.IP
|
||||
Pub ed25519.PublicKey
|
||||
Priv ed25519.PrivateKey
|
||||
IsCA bool
|
||||
}
|
||||
|
||||
// CertOption sets CertOptions.
|
||||
|
@@ -10,18 +10,19 @@ import (
|
||||
)
|
||||
|
||||
type pool struct {
|
||||
size int
|
||||
ttl time.Duration
|
||||
tr transport.Transport
|
||||
tr transport.Transport
|
||||
|
||||
conns map[string][]*poolConn
|
||||
size int
|
||||
ttl time.Duration
|
||||
|
||||
sync.Mutex
|
||||
conns map[string][]*poolConn
|
||||
}
|
||||
|
||||
type poolConn struct {
|
||||
transport.Client
|
||||
id string
|
||||
created time.Time
|
||||
transport.Client
|
||||
id string
|
||||
}
|
||||
|
||||
func newPool(options Options) *pool {
|
||||
|
@@ -10,11 +10,11 @@ import (
|
||||
|
||||
// Buffer is ring buffer.
|
||||
type Buffer struct {
|
||||
size int
|
||||
streams map[string]*Stream
|
||||
vals []*Entry
|
||||
size int
|
||||
|
||||
sync.RWMutex
|
||||
vals []*Entry
|
||||
streams map[string]*Stream
|
||||
}
|
||||
|
||||
// Entry is ring buffer data entry.
|
||||
@@ -25,12 +25,12 @@ type Entry struct {
|
||||
|
||||
// Stream is used to stream the buffer.
|
||||
type Stream struct {
|
||||
// Id of the stream
|
||||
Id string
|
||||
// Buffered entries
|
||||
Entries chan *Entry
|
||||
// Stop channel
|
||||
Stop chan bool
|
||||
// Id of the stream
|
||||
Id string
|
||||
}
|
||||
|
||||
// Put adds a new value to ring buffer.
|
||||
|
@@ -5,8 +5,8 @@ import (
|
||||
)
|
||||
|
||||
type Pool struct {
|
||||
sync.RWMutex
|
||||
pool map[string]*Socket
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
func (p *Pool) Get(id string) (*Socket, bool) {
|
||||
|
@@ -9,17 +9,17 @@ import (
|
||||
|
||||
// Socket is our pseudo socket for transport.Socket.
|
||||
type Socket struct {
|
||||
id string
|
||||
// closed
|
||||
closed chan bool
|
||||
// remote addr
|
||||
remote string
|
||||
// local addr
|
||||
local string
|
||||
// send chan
|
||||
send chan *transport.Message
|
||||
// recv chan
|
||||
recv chan *transport.Message
|
||||
id string
|
||||
// remote addr
|
||||
remote string
|
||||
// local addr
|
||||
local string
|
||||
}
|
||||
|
||||
func (s *Socket) SetLocal(l string) {
|
||||
|
@@ -21,9 +21,10 @@ type Stream interface {
|
||||
type stream struct {
|
||||
Stream
|
||||
|
||||
sync.RWMutex
|
||||
err error
|
||||
request *request
|
||||
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
type request struct {
|
||||
|
@@ -8,9 +8,9 @@ import (
|
||||
)
|
||||
|
||||
type operation struct {
|
||||
operation action
|
||||
record *store.Record
|
||||
deadline time.Time
|
||||
record *store.Record
|
||||
operation action
|
||||
retries int
|
||||
maxiumum int
|
||||
}
|
||||
|
@@ -21,9 +21,9 @@ type Sync interface {
|
||||
|
||||
type syncStore struct {
|
||||
storeOpts store.Options
|
||||
syncOpts Options
|
||||
pendingWrites []*deque.Deque
|
||||
pendingWriteTickers []*time.Ticker
|
||||
syncOpts Options
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func (c *syncStore) Sync() error {
|
||||
}
|
||||
|
||||
type internalRecord struct {
|
||||
expiresAt time.Time
|
||||
key string
|
||||
value []byte
|
||||
expiresAt time.Time
|
||||
}
|
||||
|
@@ -69,8 +69,9 @@ func HandlerStats(stats stats.Stats) server.HandlerWrapper {
|
||||
type traceWrapper struct {
|
||||
client.Client
|
||||
|
||||
name string
|
||||
trace trace.Tracer
|
||||
|
||||
name string
|
||||
}
|
||||
|
||||
func (c *traceWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
|
||||
|
Reference in New Issue
Block a user