Documentation
¶
Index ¶
- Constants
- type Cluster
- type EtcdConnectOptions
- type EtcdSharedCounter
- func (counter *EtcdSharedCounter) AddAndGet(d int64) (v int64, err error)
- func (counter *EtcdSharedCounter) Close()
- func (counter *EtcdSharedCounter) CompareAndSet(expected int64, v int64) (ok bool, err error)
- func (counter *EtcdSharedCounter) DecrementAndGet() (v int64, err error)
- func (counter *EtcdSharedCounter) Get() (v int64, err error)
- func (counter *EtcdSharedCounter) IncrementAndGet() (v int64, err error)
- type EtcdSharedLocker
- type EtcdSharedMap
- func (m *EtcdSharedMap) Clean() (err error)
- func (m *EtcdSharedMap) Get(key string, value interface{}) (has bool, err error)
- func (m *EtcdSharedMap) Keys() (keys []string, err error)
- func (m *EtcdSharedMap) Put(key string, value interface{}, ttl time.Duration) (err error)
- func (m *EtcdSharedMap) Rem(key string) (err error)
- type Meta
- type Node
- type Registration
- type RegistrationEvent
- type RegistrationEventType
- type RegistrationTLS
- type Service
- func (s Service) Address() (address string)
- func (s Service) Group() (group string)
- func (s Service) Id() (id string)
- func (s Service) Meta() (meta Meta)
- func (s Service) Name() (name string)
- func (s Service) NodeId() (nodeId string)
- func (s Service) NodeName() (nodeName string)
- func (s Service) Protocol() (protocol string)
- func (s Service) Status() (status Status)
- func (s Service) TLS() (registrationTLS RegistrationTLS)
- func (s Service) Tags() (tags []string)
- type ServiceDiscovery
- type ServiceEvent
- type ServiceEventType
- type ServiceMeta
- type ServiceStatus
- type ServiceTLS
- func (s ServiceTLS) CA() string
- func (s ServiceTLS) ClientCert() string
- func (s ServiceTLS) ClientKey() string
- func (s ServiceTLS) Enable() bool
- func (s ServiceTLS) ServerCert() string
- func (s ServiceTLS) ServerKey() string
- func (s ServiceTLS) ToClientTLSConfig() (config *tls.Config, err error)
- func (s ServiceTLS) ToServerTLSConfig() (config *tls.Config, err error)
- func (s ServiceTLS) VerifySSL() bool
- type ServicesCache
- func (c *ServicesCache) Close()
- func (c *ServicesCache) Get(group string, name string, tags ...string) (service Service, has bool)
- func (c *ServicesCache) GetALL(group string, name string, tags ...string) (services []Service, has bool)
- func (c *ServicesCache) GetALLLocaled() (services []Service)
- func (c *ServicesCache) OnEvict(item *ristretto.Item)
- func (c *ServicesCache) Put(services ...Service)
- func (c *ServicesCache) Rem(services ...Service)
- type SharedCounter
- type SharedLocker
- type SharedMap
- type Status
Constants ¶
View Source
const ( ServiceStatusRunning = ServiceStatus("RUNNING") ServiceStatusClosing = ServiceStatus("CLOSING") ServiceEventTypePut = ServiceEventType("PUT") ServiceEventTypeRem = ServiceEventType("DELETE") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface { ServiceDiscovery Join() (err error) Leave() (err error) GetMap(name string) (m SharedMap) GetLock(name string, timeout time.Duration) (locker SharedLocker) Counter(name string) (counter SharedCounter, err error) Close() }
func NewEtcdCluster ¶
func NewEtcdCluster(name string, options EtcdConnectOptions, tags ...string) (cluster Cluster, err error)
type EtcdConnectOptions ¶
type EtcdSharedCounter ¶
type EtcdSharedCounter struct {
// contains filtered or unexported fields
}
func (*EtcdSharedCounter) AddAndGet ¶
func (counter *EtcdSharedCounter) AddAndGet(d int64) (v int64, err error)
func (*EtcdSharedCounter) Close ¶
func (counter *EtcdSharedCounter) Close()
func (*EtcdSharedCounter) CompareAndSet ¶
func (counter *EtcdSharedCounter) CompareAndSet(expected int64, v int64) (ok bool, err error)
func (*EtcdSharedCounter) DecrementAndGet ¶
func (counter *EtcdSharedCounter) DecrementAndGet() (v int64, err error)
func (*EtcdSharedCounter) Get ¶
func (counter *EtcdSharedCounter) Get() (v int64, err error)
func (*EtcdSharedCounter) IncrementAndGet ¶
func (counter *EtcdSharedCounter) IncrementAndGet() (v int64, err error)
type EtcdSharedLocker ¶
type EtcdSharedLocker struct {
// contains filtered or unexported fields
}
func (*EtcdSharedLocker) Lock ¶
func (lock *EtcdSharedLocker) Lock() (err error)
func (*EtcdSharedLocker) UnLock ¶
func (lock *EtcdSharedLocker) UnLock() (err error)
type EtcdSharedMap ¶
type EtcdSharedMap struct {
// contains filtered or unexported fields
}
func (*EtcdSharedMap) Clean ¶
func (m *EtcdSharedMap) Clean() (err error)
func (*EtcdSharedMap) Get ¶
func (m *EtcdSharedMap) Get(key string, value interface{}) (has bool, err error)
func (*EtcdSharedMap) Keys ¶
func (m *EtcdSharedMap) Keys() (keys []string, err error)
func (*EtcdSharedMap) Put ¶
func (m *EtcdSharedMap) Put(key string, value interface{}, ttl time.Duration) (err error)
func (*EtcdSharedMap) Rem ¶
func (m *EtcdSharedMap) Rem(key string) (err error)
type Node ¶
type Node struct { Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` Status ServiceStatus `json:"status,omitempty"` Tags []string `json:"tags,omitempty"` }
type Registration ¶
type Registration interface { NodeId() (nodeId string) NodeName() (nodeName string) Id() (id string) Group() (group string) Name() (name string) Status() (status Status) Protocol() (protocol string) Address() (address string) Tags() (tags []string) Meta() (meta Meta) TLS() (registrationTLS RegistrationTLS) }
type RegistrationEvent ¶
type RegistrationEvent interface { Registration() (registration Registration) Type() (eventType RegistrationEventType) }
type RegistrationEventType ¶
type RegistrationTLS ¶
type Service ¶
type Service struct { NodeId_ string `json:"nodeId,omitempty"` NodeName_ string `json:"nodeName,omitempty"` Id_ string `json:"id,omitempty"` Group_ string `json:"group,omitempty"` Name_ string `json:"name,omitempty"` Status_ ServiceStatus `json:"status,omitempty"` Protocol_ string `json:"protocol,omitempty"` Address_ string `json:"address,omitempty"` Tags_ []string `json:"tags,omitempty"` Meta_ Meta `json:"meta,omitempty"` TLS_ RegistrationTLS `json:"tls,omitempty"` Version int64 `json:"-"` Deleted bool `json:"-"` Local bool `json:"-"` }
func NewServiceFromJson ¶
func (Service) TLS ¶
func (s Service) TLS() (registrationTLS RegistrationTLS)
type ServiceDiscovery ¶
type ServiceDiscovery interface { Publish(group string, name string, protocol string, address string, tags []string, meta Meta, registrationTLS RegistrationTLS) (registration Registration, err error) UnPublish(registration Registration) (err error) Get(group string, name string, tags ...string) (registration Registration, has bool, err error) GetALL(group string, name string, tags ...string) (registrations []Registration, has bool, err error) }
type ServiceEvent ¶
type ServiceEvent struct { Registration_ Registration `json:"registration,omitempty"` Type_ RegistrationEventType `json:"type,omitempty"` }
func (ServiceEvent) Registration ¶
func (s ServiceEvent) Registration() (registration Registration)
func (ServiceEvent) Type ¶
func (s ServiceEvent) Type() (eventType RegistrationEventType)
type ServiceEventType ¶
type ServiceEventType string
func (ServiceEventType) IsPut ¶
func (s ServiceEventType) IsPut() bool
func (ServiceEventType) IsRem ¶
func (s ServiceEventType) IsRem() bool
type ServiceMeta ¶
func NewServiceMeta ¶
func NewServiceMeta() ServiceMeta
func (ServiceMeta) Empty ¶
func (meta ServiceMeta) Empty() bool
func (ServiceMeta) Keys ¶
func (meta ServiceMeta) Keys() []string
func (ServiceMeta) Merge ¶
func (meta ServiceMeta) Merge(o ...Meta)
func (ServiceMeta) Put ¶
func (meta ServiceMeta) Put(key string, value string)
func (ServiceMeta) Rem ¶
func (meta ServiceMeta) Rem(key string)
type ServiceStatus ¶
type ServiceStatus string
func (ServiceStatus) Closing ¶
func (s ServiceStatus) Closing() bool
func (ServiceStatus) Ok ¶
func (s ServiceStatus) Ok() bool
type ServiceTLS ¶
type ServiceTLS struct { Enable_ bool `json:"enable,omitempty"` VerifySSL_ bool `json:"verifySsl,omitempty"` CA_ string `json:"ca,omitempty"` ServerCert_ string `json:"serverCert,omitempty"` ServerKey_ string `json:"serverKey,omitempty"` ClientCert_ string `json:"clientCert,omitempty"` ClientKey_ string `json:"clientKey,omitempty"` }
func (ServiceTLS) CA ¶
func (s ServiceTLS) CA() string
func (ServiceTLS) ClientCert ¶
func (s ServiceTLS) ClientCert() string
func (ServiceTLS) ClientKey ¶
func (s ServiceTLS) ClientKey() string
func (ServiceTLS) Enable ¶
func (s ServiceTLS) Enable() bool
func (ServiceTLS) ServerCert ¶
func (s ServiceTLS) ServerCert() string
func (ServiceTLS) ServerKey ¶
func (s ServiceTLS) ServerKey() string
func (ServiceTLS) ToClientTLSConfig ¶ added in v1.0.4
func (s ServiceTLS) ToClientTLSConfig() (config *tls.Config, err error)
func (ServiceTLS) ToServerTLSConfig ¶ added in v1.0.4
func (s ServiceTLS) ToServerTLSConfig() (config *tls.Config, err error)
func (ServiceTLS) VerifySSL ¶
func (s ServiceTLS) VerifySSL() bool
type ServicesCache ¶
type ServicesCache struct {
// contains filtered or unexported fields
}
func NewServicesCache ¶
func NewServicesCache() (c *ServicesCache, err error)
func (*ServicesCache) Close ¶
func (c *ServicesCache) Close()
func (*ServicesCache) GetALLLocaled ¶
func (c *ServicesCache) GetALLLocaled() (services []Service)
func (*ServicesCache) OnEvict ¶
func (c *ServicesCache) OnEvict(item *ristretto.Item)
func (*ServicesCache) Put ¶
func (c *ServicesCache) Put(services ...Service)
func (*ServicesCache) Rem ¶
func (c *ServicesCache) Rem(services ...Service)
type SharedCounter ¶
type SharedCounter interface {}
func NewEtcdSharedCounter ¶
func NewEtcdSharedCounter(name string, cli *etcd.Client) (counter SharedCounter, err error)
type SharedLocker ¶
type SharedLocker interface {}
Click to show internal directories.
Click to hide internal directories.