Documentation ¶
Index ¶
- func DeleteInSlice(s interface{}, index int) interface{}
- func FormatToDNS1123(name string) string
- func GoWithRecover(handler func(), recoverHandler func(r interface{}))
- func RemovePort(addressWithPort string) string
- func ResolveServiceName(configuratorPath string) string
- func SetupSignalHandler() (stopCh <-chan struct{})
- func StringToDuration(s string, repeat int64) *ptypes.Duration
- func ToInt32(portStr string) int32
- func ToUint32(portStr string) uint32
- type Components
- type Runnable
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteInSlice ¶
func DeleteInSlice(s interface{}, index int) interface{}
DeleteInSlice delete an element from a Slice with an index. return the original parameter as the result instead if it is not a slice.
func FormatToDNS1123 ¶
FormatToDNS1123 converts the object name to lower case and replaces the underscore
func GoWithRecover ¶
func GoWithRecover(handler func(), recoverHandler func(r interface{}))
GoWithRecover go task with goroutine and recover
func RemovePort ¶
RemovePort removing the port part of a service name is necessary due to istio requirement. 127.0.0.1:10000 -> 127.0.0.1
func ResolveServiceName ¶
ResolveServiceName ... configuratorPath: e.g. /dubbo/config/dubbo/foo.configurators
func SetupSignalHandler ¶
func SetupSignalHandler() (stopCh <-chan struct{})
SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.
func StringToDuration ¶
StringToDuration converts the time string to protobuf Duration e.g. 2s => ptypes.Duration{Seconds: 2} 20ms => ptypes.Duration{Nanos: 20000000} 2 => ptypes.Duration{Nanos: 2000000} 2000 => ptypes.Duration{Seconds: 2}
Types ¶
type Components ¶
type Components struct {
// contains filtered or unexported fields
}
Components ...
func (*Components) Add ¶
func (c *Components) Add(r Runnable)
Add a new Runnable to Components. It panics if the Components is already started.
func (*Components) Start ¶
func (c *Components) Start(stopCh <-chan struct{}) error
Start Components.
type Runnable ¶
type Runnable interface {
Start(<-chan struct{}) error
}
Runnable allows a component to be started.
type WorkerPool ¶
type WorkerPool interface { Schedule(task func()) ScheduleAlways(task func()) ScheduleAuto(task func()) }
WorkerPool workerPool interface