Documentation
¶
Index ¶
- Variables
- func Cron()
- func FileExists(filename string) bool
- func GenerateLocalAddr() string
- func GenerateNodeId(ntype nodes.NodeType, gsid string) string
- func GenerateTopic(s ...string) string
- func GobDecode(reply interface{}, data []byte) error
- func GobEncode(args ...interface{}) ([]byte, error)
- func InArray(needle interface{}, haystack interface{}) bool
- func IndexOf(a []interface{}, e interface{}, cmp CompareFunc) int
- func Int64ToString(valint int64) string
- func Int64Toint(valint int64) int
- func IntToInt64(valint int) int64
- func IntToString(intval int) string
- func Md5(sign string) string
- func SerializeOrRaw(v interface{}) ([]byte, error)
- func SetTimerPrecision(precision time.Duration)
- func Stack() string
- func StringToInt(valstr string) int
- func StringToInt64(valstr string) int64
- func Time() int
- type CompareFunc
- type Timer
- type TimerCondition
- type TimerFunc
Constants ¶
This section is empty.
Variables ¶
var ( // TimerPrecision indicates the precision of timer, default is time.Second TimerPrecision = time.Second // GlobalTicker represents global ticker that all cron job will be executed // in GlobalTicker. GlobalTicker *time.Ticker )
var (
ListenAddr string
)
var Serializer serialize.Serializer = protobuf.NewSerializer()
Default serializer
Functions ¶
func FileExists ¶
func GenerateLocalAddr ¶
func GenerateLocalAddr() string
func GenerateTopic ¶
func IndexOf ¶
func IndexOf(a []interface{}, e interface{}, cmp CompareFunc) int
func Int64ToString ¶
func Int64Toint ¶
func IntToInt64 ¶
func IntToString ¶
func SerializeOrRaw ¶
func SetTimerPrecision ¶
SetTimerPrecision set the ticker precision, and time precision can not less than a Millisecond, and can not change after application running. The default precision is time.Second
func StringToInt ¶
func StringToInt64 ¶
Types ¶
type CompareFunc ¶
type CompareFunc func(interface{}, interface{}) bool
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer represents a cron job
func NewAfterTimer ¶
NewAfterTimer returns a new Timer containing a function that will be called after duration that specified by the duration argument. The duration d must be greater than zero; if not, NewAfterTimer will panic. Stop the timer to release associated resources.
func NewCondTimer ¶
func NewCondTimer(condition TimerCondition, fn TimerFunc) *Timer
NewCondTimer returns a new Timer containing a function that will be called when condition satisfied that specified by the condition argument. The duration d must be greater than zero; if not, NewCondTimer will panic. Stop the timer to release associated resources.
func NewCountTimer ¶
NewCountTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. After count times, timer will be stopped automatically, It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewCountTimer will panic. Stop the timer to release associated resources.
func NewTimer ¶
NewTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewTimer will panic. Stop the timer to release associated resources.
type TimerCondition ¶
TimerCondition represents a checker that returns true when cron job needs to execute