本文整理匯總了Golang中github.com/tendermint/go-config.Config.GetInt方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.GetInt方法的具體用法?Golang Config.GetInt怎麽用?Golang Config.GetInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/tendermint/go-config.Config
的用法示例。
在下文中一共展示了Config.GetInt方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Alert
// Sends a critical alert message to administrators.
func Alert(config cfg.Config, message string) {
log.Error("<!> ALERT <!>\n" + message)
now := time.Now().Unix()
if now-lastAlertUnix > int64(config.GetInt("alert_min_interval")) {
message = fmt.Sprintf("%v:%v", config.GetString("chain_id"), message)
if alertCountSince > 0 {
message = fmt.Sprintf("%v (+%v more since)", message, alertCountSince)
alertCountSince = 0
}
if len(config.GetString("alert_twilio_sid")) > 0 {
go sendTwilio(config, message)
}
if len(config.GetString("alert_email_recipients")) > 0 {
go sendEmail(config, message)
}
} else {
alertCountSince++
}
}
示例2: NewMConnection
func NewMConnection(config cfg.Config, conn net.Conn, chDescs []*ChannelDescriptor, onReceive receiveCbFunc, onError errorCbFunc) *MConnection {
mconn := &MConnection{
conn: conn,
bufReader: bufio.NewReaderSize(conn, minReadBufferSize),
bufWriter: bufio.NewWriterSize(conn, minWriteBufferSize),
sendMonitor: flow.New(0, 0),
recvMonitor: flow.New(0, 0),
sendRate: int64(config.GetInt(configKeySendRate)),
recvRate: int64(config.GetInt(configKeyRecvRate)),
send: make(chan struct{}, 1),
pong: make(chan struct{}),
onReceive: onReceive,
onError: onError,
// Initialized in Start()
quit: nil,
flushTimer: nil,
pingTimer: nil,
chStatsTimer: nil,
LocalAddress: NewNetAddress(conn.LocalAddr()),
RemoteAddress: NewNetAddress(conn.RemoteAddr()),
}
// Create channels
var channelsIdx = map[byte]*Channel{}
var channels = []*Channel{}
for _, desc := range chDescs {
descCopy := *desc // copy the desc else unsafe access across connections
channel := newChannel(mconn, &descCopy)
channelsIdx[channel.id] = channel
channels = append(channels, channel)
}
mconn.channels = channels
mconn.channelsIdx = channelsIdx
mconn.BaseService = *NewBaseService(log, "MConnection", mconn)
return mconn
}