fieldalignment of all structs to save memory
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -16,9 +16,9 @@ var (
|
||||
)
|
||||
|
||||
type node struct {
|
||||
*Node
|
||||
TTL time.Duration
|
||||
LastSeen time.Time
|
||||
*Node
|
||||
TTL time.Duration
|
||||
}
|
||||
|
||||
type record struct {
|
||||
@@ -405,10 +405,10 @@ func (m *memory) String() string {
|
||||
}
|
||||
|
||||
type watcher struct {
|
||||
id string
|
||||
wo WatchOptions
|
||||
res chan *Result
|
||||
exit chan bool
|
||||
wo WatchOptions
|
||||
id string
|
||||
}
|
||||
|
||||
func (m *watcher) Next() (*Result, error) {
|
||||
|
@@ -12,20 +12,22 @@ import (
|
||||
|
||||
// Options holds options for register
|
||||
type Options struct {
|
||||
Name string
|
||||
Addrs []string
|
||||
Timeout time.Duration
|
||||
TLSConfig *tls.Config
|
||||
|
||||
// Logger that will be used
|
||||
Logger logger.Logger
|
||||
// Meter that will be used
|
||||
Meter meter.Meter
|
||||
// Tracer
|
||||
// Tracer used for tracing
|
||||
Tracer tracer.Tracer
|
||||
// Other options for implementations of the interface
|
||||
// can be stored in a context
|
||||
// Context holds external options
|
||||
Context context.Context
|
||||
// Logged used for logging
|
||||
Logger logger.Logger
|
||||
// Meter used for metrics
|
||||
Meter meter.Meter
|
||||
// TLSConfig holds tls.TLSConfig options
|
||||
TLSConfig *tls.Config
|
||||
// Name holds the name of register
|
||||
Name string
|
||||
// Addrs specifies register addrs
|
||||
Addrs []string
|
||||
// Timeout specifies timeout
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
// NewOptions returns options that filled by opts
|
||||
@@ -44,13 +46,9 @@ func NewOptions(opts ...Option) Options {
|
||||
|
||||
// RegisterOptions holds options for register method
|
||||
type RegisterOptions struct {
|
||||
TTL time.Duration
|
||||
// Other options for implementations of the interface
|
||||
// can be stored in a context
|
||||
Context context.Context
|
||||
// Domain to register the service in
|
||||
Domain string
|
||||
// Attempts specify attempts for register
|
||||
Context context.Context
|
||||
Domain string
|
||||
TTL time.Duration
|
||||
Attempts int
|
||||
}
|
||||
|
||||
|
@@ -52,17 +52,17 @@ type Service struct {
|
||||
|
||||
// Node holds node register info
|
||||
type Node struct {
|
||||
Metadata metadata.Metadata `json:"metadata"`
|
||||
Id string `json:"id"`
|
||||
Address string `json:"address"`
|
||||
Metadata metadata.Metadata `json:"metadata"`
|
||||
}
|
||||
|
||||
// Endpoint holds endpoint register info
|
||||
type Endpoint struct {
|
||||
Name string `json:"name"`
|
||||
Request *Value `json:"request"`
|
||||
Response *Value `json:"response"`
|
||||
Metadata metadata.Metadata `json:"metadata"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Value holds additional kv stuff
|
||||
|
@@ -7,14 +7,17 @@ import "time"
|
||||
type Watcher interface {
|
||||
// Next is a blocking call
|
||||
Next() (*Result, error)
|
||||
// Stop stops the watcher
|
||||
Stop()
|
||||
}
|
||||
|
||||
// Result is returned by a call to Next on
|
||||
// the watcher. Actions can be create, update, delete
|
||||
type Result struct {
|
||||
Action string
|
||||
// Service holds register service
|
||||
Service *Service
|
||||
// Action holds the action
|
||||
Action string
|
||||
}
|
||||
|
||||
// EventType defines register event type
|
||||
@@ -45,12 +48,12 @@ func (t EventType) String() string {
|
||||
|
||||
// Event is register event
|
||||
type Event struct {
|
||||
// Id is register id
|
||||
Id string
|
||||
// Type defines type of event
|
||||
Type EventType
|
||||
// Timestamp is event timestamp
|
||||
Timestamp time.Time
|
||||
// Service is register service
|
||||
Service *Service
|
||||
// Id is register id
|
||||
Id string
|
||||
// Type defines type of event
|
||||
Type EventType
|
||||
}
|
||||
|
Reference in New Issue
Block a user