Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultLeaseInSeconds = 3
DefaultLeaseInSeconds is the default lease time in seconds.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ServiceRegister ¶
type ServiceRegister struct {
// contains filtered or unexported fields
}
ServiceRegister is used to register the service to etcd.
func NewServiceRegister ¶
func NewServiceRegister(ctx context.Context, cli *clientv3.Client, clusterID, serviceName, serviceAddr, serializedValue string, ttl int64) *ServiceRegister
NewServiceRegister creates a new ServiceRegister.
func (*ServiceRegister) Deregister ¶
func (sr *ServiceRegister) Deregister() error
Deregister deregisters the service from etcd.
func (*ServiceRegister) Register ¶
func (sr *ServiceRegister) Register() error
Register registers the service to etcd.
type ServiceRegistryEntry ¶
type ServiceRegistryEntry struct {
ServiceAddr string `json:"serviceAddr"`
}
ServiceRegistryEntry is the registry entry of a service
func (*ServiceRegistryEntry) Deserialize ¶
func (e *ServiceRegistryEntry) Deserialize(data []byte) error
Deserialize the data to this service registry entry
func (*ServiceRegistryEntry) Serialize ¶
func (e *ServiceRegistryEntry) Serialize() (serializedValue string, err error)
Serialize this service registry entry
Click to show internal directories.
Click to hide internal directories.