zoukankan      html  css  js  c++  java
  • options.go

    package nsqlookupd

    import (
        "log"
        "os"
        "time"
    )
    //记录nsqd配置信息
    type Options struct {
        Verbose bool `flag:"verbose"`  //开启日志信息

        TCPAddress       string `flag:"tcp-address"` //tcp地址
        HTTPAddress      string `flag:"http-address"` //http地址
        BroadcastAddress string `flag:"broadcast-address"`//broadcast地址

        InactiveProducerTimeout time.Duration `flag:"inactive-producer-timeout"` //闲置周期
        TombstoneLifetime       time.Duration `flag:"tombstone-lifetime"` //过期时间时间

        Logger Logger  //日志接口
    }

    func NewOptions() *Options {
        hostname, err := os.Hostname()
        if err != nil {
            log.Fatal(err)
        }

        return &Options{
            TCPAddress:       "0.0.0.0:4160",
            HTTPAddress:      "0.0.0.0:4161",
            BroadcastAddress: hostname,

            InactiveProducerTimeout: 300 * time.Second,
            TombstoneLifetime:       45 * time.Second,

            Logger: log.New(os.Stderr, "[nsqlookupd] ", log.Ldate|log.Ltime|log.Lmicroseconds),
        }
    }

  • 相关阅读:
    iOS 整理面试题(上)
    2021年十大白马名单
    RabbitMQ:消息重复消费
    RabbitMQ:保证消息的顺序性
    RabbitMQ:保证消息的可靠性传输
    AWS S3 大文件分片上传
    rebase 用法小结
    Flask at scale
    MySQL分区
    动态规划示例题
  • 原文地址:https://www.cnblogs.com/zhangboyu/p/7457132.html
Copyright © 2011-2022 走看看