当前位置: 首页>>代码示例>>Golang>>正文


Golang flag.IntVar函数代码示例

本文整理汇总了Golang中flag.IntVar函数的典型用法代码示例。如果您正苦于以下问题:Golang IntVar函数的具体用法?Golang IntVar怎么用?Golang IntVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IntVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: init

func init() {
	flag.Usage = usage

	flag.BoolVar(&Settings.verbose, "verbose", false, "Turn on verbose/debug output")
	flag.BoolVar(&Settings.stats, "stats", false, "Turn on queue stats output")

	flag.BoolVar(&Settings.splitOutput, "split-output", false, "By default each output gets same traffic. If set to `true` it splits traffic equally among all outputs.")

	flag.Var(&Settings.inputDummy, "input-dummy", "Used for testing outputs. Emits 'Get /' request every 1s")
	flag.Var(&Settings.outputDummy, "output-dummy", "Used for testing inputs. Just prints data coming from inputs.")

	flag.Var(&Settings.inputTCP, "input-tcp", "Used for internal communication between Gor instances. Example: \n\t# Receive requests from other Gor instances on 28020 port, and redirect output to staging\n\tgor --input-tcp :28020 --output-http staging.com")
	flag.Var(&Settings.outputTCP, "output-tcp", "Used for internal communication between Gor instances. Example: \n\t# Listen for requests on 80 port and forward them to other Gor instance on 28020 port\n\tgor --input-raw :80 --output-tcp replay.local:28020")
	flag.BoolVar(&Settings.outputTCPStats, "output-tcp-stats", false, "Report TCP output queue stats to console every 5 seconds.")

	flag.Var(&Settings.inputFile, "input-file", "Read requests from file: \n\tgor --input-file ./requests.gor --output-http staging.com")
	flag.Var(&Settings.outputFile, "output-file", "Write incoming requests to file: \n\tgor --input-raw :80 --output-file ./requests.gor")

	flag.Var(&Settings.inputRAW, "input-raw", "Capture traffic from given port (use RAW sockets and require *sudo* access):\n\t# Capture traffic from 8080 port\n\tgor --input-raw :8080 --output-http staging.com")

	flag.Var(&Settings.inputHTTP, "input-http", "Read requests from HTTP, should be explicitly sent from your application:\n\t# Listen for http on 9000\n\tgor --input-http :9000 --output-http staging.com")

	flag.Var(&Settings.outputHTTP, "output-http", "Forwards incoming requests to given http address.\n\t# Redirect all incoming requests to staging.com address \n\tgor --input-raw :80 --output-http http://staging.com")
	flag.IntVar(&Settings.outputHTTPConfig.workers, "output-http-workers", 0, "Gor uses dynamic worker scaling by default.  Enter a number to run a set number of workers.")
	flag.IntVar(&Settings.outputHTTPConfig.redirectLimit, "output-http-redirects", 0, "Enable how often redirects should be followed.")
	flag.Var(&Settings.modifierConfig.headers, "output-http-header", "Inject additional headers to http reqest:\n\tgor --input-raw :8080 --output-http staging.com --output-http-header 'User-Agent: Gor'")
	flag.Var(&Settings.modifierConfig.methods, "output-http-method", "Whitelist of HTTP methods to replay. Anything else will be dropped:\n\tgor --input-raw :8080 --output-http staging.com --output-http-method GET --output-http-method OPTIONS")
	flag.Var(&Settings.modifierConfig.urlRegexp, "output-http-url-regexp", "A regexp to match requests against. Anything else will be dropped:\n\t gor --input-raw :8080 --output-http staging.com --output-http-url-regexp ^www.")
	flag.Var(&Settings.modifierConfig.urlRewrite, "output-http-rewrite-url", "Rewrite the requst url based on a mapping:\n\tgor --input-raw :8080 --output-http staging.com --output-http-rewrite-url /xml_test/interface.php:/api/service.do")
	flag.Var(&Settings.modifierConfig.headerFilters, "output-http-header-filter", "A regexp to match a specific header against. Requests with non-matching headers will be dropped:\n\t gor --input-raw :8080 --output-http staging.com --output-http-header-filter api-version:^v1")
	flag.Var(&Settings.modifierConfig.headerHashFilters, "output-http-header-hash-filter", "Takes a fraction of requests, consistently taking or rejecting a request based on the FNV32-1A hash of a specific header. The fraction must have a denominator that is a power of two:\n\t gor --input-raw :8080 --output-http staging.com --output-http-header-hash-filter user-id:1/4")
	flag.BoolVar(&Settings.outputHTTPConfig.stats, "output-http-stats", false, "Report http output queue stats to console every 5 seconds.")

	flag.StringVar(&Settings.outputHTTPConfig.elasticSearch, "output-http-elasticsearch", "", "Send request and response stats to ElasticSearch:\n\tgor --input-raw :8080 --output-http staging.com --output-http-elasticsearch 'es_host:api_port/index_name'")
}
开发者ID:morsharon,项目名称:gor,代码行数:35,代码来源:settings.go

示例2: main

func main() {

	flag.IntVar(&pc, "pc", 3, "player count (3-5)")
	flag.IntVar(&lp, "lp", 50, "target loss percent (1-99, default 50")
	flag.IntVar(&rg, "rg", 10, "allowable difficulty variance around target loss percent (0-100, default 10")

	var err error

	if err = validateFlags(); err != nil {
		fmt.Println(err)
		return
	}

	s, i, err := sentinels.FindSetup(pc, lp, rg, []sentinels.ExpansionType{sentinels.BaseSet, sentinels.MiniExpansion})
	if err != nil {
		fmt.Println(err)
		return
	}
	if s != nil {
		fmt.Printf("\nFound in %d iterations:\n\n", i)
		fmt.Printf("%s", s)
	} else {
		fmt.Printf("\nNo setup found in %d iterations.\n", i)
	}

}
开发者ID:uhhhclem,项目名称:sentinels,代码行数:26,代码来源:app.go

示例3: init

func init() {
	flag.IntVar(&size, "s", 40, "bubble size")
	flag.IntVar(&niter, "n", 200, "number of iterations")
	flag.Float64Var(&opacity, "o", 0.5, "opacity")
	flag.Parse()
	rand.Seed(int64(time.Now().Nanosecond()) % 1e9)
}
开发者ID:rif,项目名称:golang-stuff,代码行数:7,代码来源:bubtrail.go

示例4: init

func init() {
	flag.StringVar(&configFile, "c", "config.json", "the config file")
	flag.BoolVar(&version, "V", false, "show version")
	flag.BoolVar(&testMode, "t", false, "test config")
	flag.IntVar(&statPort, "s", -1, "set stat server port")
	flag.IntVar(&commitInterval, "i", 10, "set stat server port")
}
开发者ID:cheetah0216,项目名称:kafka-pusher,代码行数:7,代码来源:main.go

示例5: main

func main() {
	hostname, err := os.Hostname()
	if err != nil {
		hostname = "unknown"
	}

	flag.StringVar(&prefix, "p", fmt.Sprintf("bucky-pickle-relay.%s", hostname),
		"Prefix for internally generated metrics.")
	flag.StringVar(&bindTo, "b", ":2004",
		"Address to bind to for incoming connections.")
	flag.BoolVar(&debug, "d", false,
		"Debug mode.")
	flag.IntVar(&pickleTimeout, "t", 300,
		"Timeout in seconds on incoming pickle protocol TCP connections.")
	flag.IntVar(&sendTimeout, "s", 30,
		"TCP timeout in seconds for outgoing line protocol connections.")
	flag.IntVar(&maxPickleSize, "x", 1*1024*1024,
		"Maximum pickle size accepted.")
	flag.IntVar(&pickleQueueSize, "q", 0,
		"Internal buffer sizes.")
	flag.DurationVar(&metricInterval, "i", 60,
		"Interval in seconds between reporting of internal metrics.")
	flag.Parse()
	if flag.NArg() != 1 {
		usage()
	}

	log.Printf("bucky-pickle-relay Copyright 2015 42 Lines, Inc.")
	carbonRelay = flag.Arg(0)
	log.Printf("Sending line protocol data to %s", carbonRelay)
	log.Printf("Reporting internal metrics under %s", prefix)

	metrics := serveForever()
	plainTextOut(metrics)
}
开发者ID:olivierHa,项目名称:buckytools,代码行数:35,代码来源:main.go

示例6: init

func init() {
	potentialQueues := os.Getenv("WORKER_QUEUES")
	potentialConcurrency := os.Getenv("WORKER_CONCURRENCY")

	concurrency = 25

	if potentialConcurrency != "" {
		tmp, _ := strconv.ParseInt(potentialConcurrency, 10, 32)
		concurrency = int(tmp)
	}

	flag.StringVar(&queuesString, "queues", potentialQueues, "a comma-separated list of Resque queues")
	flag.Float64Var(&intervalFloat, "interval", 5.0, "sleep interval when no jobs are found")
	flag.IntVar(&concurrency, "concurrency", concurrency, "the maximum number of concurrently executing jobs")
	flag.IntVar(&connections, "connections", 2, "the maximum number of connections to the Redis database")

	redisProvider := os.Getenv("REDIS_PROVIDER")
	var redisEnvUri string
	if redisProvider != "" {
		redisEnvUri = os.Getenv(redisProvider)
	} else {
		redisEnvUri = os.Getenv("REDIS_URL")
	}
	if redisEnvUri == "" {
		redisEnvUri = "redis://localhost:6379/"
	}

	flag.StringVar(&uri, "uri", redisEnvUri, "the URI of the Redis server")
	flag.StringVar(&namespace, "namespace", "resque:", "the Redis namespace")
	flag.BoolVar(&exitOnComplete, "exit-on-complete", false, "exit when the queue is empty")
	flag.BoolVar(&useNumber, "use-number", false, "use json.Number instead of float64 when decoding numbers in JSON. will default to true soon")
}
开发者ID:newrelic-forks,项目名称:goworker,代码行数:32,代码来源:flags.go

示例7: init

func init() {
	// Turn on verbose by default to get spec names
	config.DefaultReporterConfig.Verbose = true

	// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
	config.GinkgoConfig.EmitSpecProgress = true

	// Randomize specs as well as suites
	config.GinkgoConfig.RandomizeAllSpecs = true

	flag.StringVar(&testContext.KubeConfig, clientcmd.RecommendedConfigPathFlag, "", "Path to kubeconfig containing embedded authinfo.")
	flag.StringVar(&testContext.KubeContext, clientcmd.FlagContext, "", "kubeconfig context to use/override. If unset, will use value from 'current-context'")
	flag.StringVar(&testContext.CertDir, "cert-dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.")
	flag.StringVar(&testContext.Host, "host", "", "The host, or apiserver, to connect to")
	flag.StringVar(&testContext.RepoRoot, "repo-root", "../../", "Root directory of kubernetes repository, for finding test files.")
	flag.StringVar(&testContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)")
	flag.StringVar(&testContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.")
	flag.StringVar(&testContext.OutputDir, "e2e-output-dir", "/tmp", "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.")
	flag.StringVar(&testContext.prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.")

	// TODO: Flags per provider?  Rename gce-project/gce-zone?
	flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke")
	flag.StringVar(&cloudConfig.ProjectID, "gce-project", "", "The GCE project being used, if applicable")
	flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable")
	flag.StringVar(&cloudConfig.Cluster, "gke-cluster", "", "GKE name of cluster being used, if applicable")
	flag.StringVar(&cloudConfig.NodeInstanceGroup, "node-instance-group", "", "Name of the managed instance group for nodes. Valid only for gce, gke or aws")
	flag.IntVar(&cloudConfig.NumNodes, "num-nodes", -1, "Number of nodes in the cluster")

	flag.StringVar(&cloudConfig.ClusterTag, "cluster-tag", "", "Tag used to identify resources.  Only required if provider is aws.")
	flag.IntVar(&testContext.MinStartupPods, "minStartupPods", 0, "The number of pods which we need to see in 'Running' state with a 'Ready' condition of true, before we try running tests. This is useful in any cluster which needs some base pod-based services running before it can be used.")
	flag.StringVar(&testContext.UpgradeTarget, "upgrade-target", "ci/latest", "Version to upgrade to (e.g. 'release/stable', 'release/latest', 'ci/latest', '0.19.1', '0.19.1-669-gabac8c8') if doing an upgrade test.")
	flag.StringVar(&testContext.PrometheusPushGateway, "prom-push-gateway", "", "The URL to prometheus gateway, so that metrics can be pushed during e2es and scraped by prometheus. Typically something like 127.0.0.1:9091.")
	flag.BoolVar(&testContext.VerifyServiceAccount, "e2e-verify-service-account", true, "If true tests will verify the service account before running.")
}
开发者ID:pologood,项目名称:kubernetes,代码行数:34,代码来源:e2e_test.go

示例8: init

func init() {
	flag.StringVar(&options.CPUProfile, "cpuprofile", "", "write cpu profile to file")
	flag.Uint64Var(&options.SpoolSize, "spool-size", 1024,
		"Maximum number of events to spool before a flush is forced.")
	flag.IntVar(&options.NumWorkers, "num-workers", 1,
		"deprecated option, strictly for backwards compatibility. does nothing.")
	flag.DurationVar(&options.IdleTimeout, "idle-flush-time", 5*time.Second,
		"Maximum time to wait for a full spool before flushing anyway")
	flag.StringVar(&options.ConfigFile, "config", "", "The config file to load")
	flag.StringVar(&options.LogFile, "log-file", "", "Log file output")
	flag.StringVar(&options.PidFile, "pid-file", "lumberjack.pid",
		"destination to which a pidfile will be written")
	flag.BoolVar(&options.UseSyslog, "log-to-syslog", false,
		"Log to syslog instead of stdout. This option overrides the --log-file option.")
	flag.BoolVar(&options.FromBeginning, "from-beginning", false,
		"Read new files from the beginning, instead of the end")
	flag.StringVar(&options.HistoryPath, "progress-file", ".lumberjack",
		"path of file used to store progress data")
	flag.StringVar(&options.TempDir, "temp-dir", "/tmp",
		"directory for creating temp files")
	flag.IntVar(&options.NumThreads, "threads", 1, "Number of OS threads to use")
	flag.IntVar(&options.CmdPort, "cmd-port", 42586, "tcp command port number")
	flag.StringVar(&options.HttpPort, "http", "",
		"http port for debug info. No http server is run if this is left off. E.g.: http=:6060")
}
开发者ID:postfix,项目名称:logstash-forwarder,代码行数:25,代码来源:options.go

示例9: loadConfig

func loadConfig() (*configStruct, error) {
	var config configStruct

	flag.IntVar(&config.localPort, "local-port", 0, "Local port on which to listen to forward from remote")
	flag.IntVar(&config.remotePort, "remote-port", 0, "Remote port on which to listen to forward to local")
	flag.StringVar(&config.keyPath, "key", "", "Path to id_rsa")
	flag.StringVar(&config.remoteHost, "host", "", "Remote host to forward data from")

	flag.Parse()

	if config.localPort == 0 {
		return nil, configError{"Local port must be specified"}
	}
	if config.remotePort == 0 {
		return nil, configError{"Remote port must be specified"}
	}
	if config.keyPath == "" {
		return nil, configError{"Key path must be specified"}
	}
	if config.remoteHost == "" {
		return nil, configError{"Remote host must be specified"}
	}

	return &config, nil
}
开发者ID:hut8,项目名称:sandhog,代码行数:25,代码来源:sandhog.go

示例10: RegisterClusterFlags

// Register flags specific to the cluster e2e test suite.
func RegisterClusterFlags() {
	flag.BoolVar(&TestContext.VerifyServiceAccount, "e2e-verify-service-account", true, "If true tests will verify the service account before running.")
	flag.StringVar(&TestContext.KubeConfig, clientcmd.RecommendedConfigPathFlag, os.Getenv(clientcmd.RecommendedConfigPathEnvVar), "Path to kubeconfig containing embedded authinfo.")
	flag.StringVar(&TestContext.KubeContext, clientcmd.FlagContext, "", "kubeconfig context to use/override. If unset, will use value from 'current-context'")
	flag.StringVar(&TestContext.KubeAPIContentType, "kube-api-content-type", "", "ContentType used to communicate with apiserver")
	flag.StringVar(&federatedKubeContext, "federated-kube-context", "federation-cluster", "kubeconfig context for federation-cluster.")

	flag.StringVar(&TestContext.KubeVolumeDir, "volume-dir", "/var/lib/kubelet", "Path to the directory containing the kubelet volumes.")
	flag.StringVar(&TestContext.CertDir, "cert-dir", "", "Path to the directory containing the certs. Default is empty, which doesn't use certs.")
	flag.StringVar(&TestContext.RepoRoot, "repo-root", "../../", "Root directory of kubernetes repository, for finding test files.")
	flag.StringVar(&TestContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)")
	flag.StringVar(&TestContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.")
	flag.StringVar(&TestContext.OutputDir, "e2e-output-dir", "/tmp", "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.")
	flag.StringVar(&TestContext.Prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.")
	flag.StringVar(&TestContext.ContainerRuntime, "container-runtime", "docker", "The container runtime of cluster VM instances (docker or rkt).")
	flag.StringVar(&TestContext.MasterOSDistro, "master-os-distro", "debian", "The OS distribution of cluster master (debian, trusty, or coreos).")
	flag.StringVar(&TestContext.NodeOSDistro, "node-os-distro", "debian", "The OS distribution of cluster VM instances (debian, trusty, or coreos).")

	// TODO: Flags per provider?  Rename gce-project/gce-zone?
	cloudConfig := &TestContext.CloudConfig
	flag.StringVar(&cloudConfig.MasterName, "kube-master", "", "Name of the kubernetes master. Only required if provider is gce or gke")
	flag.StringVar(&cloudConfig.ProjectID, "gce-project", "", "The GCE project being used, if applicable")
	flag.StringVar(&cloudConfig.Zone, "gce-zone", "", "GCE zone being used, if applicable")
	flag.StringVar(&cloudConfig.Cluster, "gke-cluster", "", "GKE name of cluster being used, if applicable")
	flag.StringVar(&cloudConfig.NodeInstanceGroup, "node-instance-group", "", "Name of the managed instance group for nodes. Valid only for gce, gke or aws. If there is more than one group: comma separated list of groups.")
	flag.IntVar(&cloudConfig.NumNodes, "num-nodes", -1, "Number of nodes in the cluster")

	flag.StringVar(&cloudConfig.ClusterTag, "cluster-tag", "", "Tag used to identify resources.  Only required if provider is aws.")
	flag.IntVar(&TestContext.MinStartupPods, "minStartupPods", 0, "The number of pods which we need to see in 'Running' state with a 'Ready' condition of true, before we try running tests. This is useful in any cluster which needs some base pod-based services running before it can be used.")
	flag.DurationVar(&TestContext.SystemPodsStartupTimeout, "system-pods-startup-timeout", 10*time.Minute, "Timeout for waiting for all system pods to be running before starting tests.")
	flag.StringVar(&TestContext.UpgradeTarget, "upgrade-target", "ci/latest", "Version to upgrade to (e.g. 'release/stable', 'release/latest', 'ci/latest', '0.19.1', '0.19.1-669-gabac8c8') if doing an upgrade test.")
	flag.StringVar(&TestContext.PrometheusPushGateway, "prom-push-gateway", "", "The URL to prometheus gateway, so that metrics can be pushed during e2es and scraped by prometheus. Typically something like 127.0.0.1:9091.")
	flag.BoolVar(&TestContext.CleanStart, "clean-start", false, "If true, purge all namespaces except default and system before running tests. This serves to Cleanup test namespaces from failed/interrupted e2e runs in a long-lived cluster.")
	flag.BoolVar(&TestContext.GarbageCollectorEnabled, "garbage-collector-enabled", false, "Set to true if the garbage collector is enabled in the kube-apiserver and kube-controller-manager, then some tests will rely on the garbage collector to delete dependent resources.")
}
开发者ID:astropuffin,项目名称:kubernetes,代码行数:36,代码来源:test_context.go

示例11: load

func load() (*Options, error) {
	var drippers, startID int
	var heapStr string

	flag.StringVar(&licenseKey, "key", "", "License key")
	flag.IntVar(&startID, "start", 1, "ID of first dripper")
	flag.IntVar(&drippers, "count", 1, "Number of drippers")
	flag.StringVar(&heapStr, "heap", "512 GB", "Heap size to report")
	flag.BoolVar(&debugMode, "debug", false, "Dump HTTP traffic")
	flag.Parse()

	if licenseKey == "" {
		return nil, errors.New("License key required")
	}

	heapSize, err := bytesize.Parse([]byte(heapStr))
	if err != nil {
		return nil, err
	}

	return &Options{
		Drippers: drippers,
		HeapSize: uint64(heapSize),
		StartID:  startID,
	}, nil
}
开发者ID:pd,项目名称:dripdripgo,代码行数:26,代码来源:main.go

示例12: init

func init() {
	flag.IntVar(&keyIndex, "key", 0, USAGE_KEY_INDEX)
	flag.IntVar(&keyIndex, "k", 0, USAGE_KEY_INDEX)

	flag.IntVar(&valueIndex, "value", 0, USAGE_VALUE_INDEX)
	flag.IntVar(&valueIndex, "v", 0, USAGE_VALUE_INDEX)

	flag.StringVar(&mapName, "map", "", USAGE_MAP_NAME)
	flag.StringVar(&mapName, "m", "", USAGE_MAP_NAME)

	flag.StringVar(&packageName, "package", "", USAGE_PACKAGE_NAME)
	flag.StringVar(&packageName, "p", "", USAGE_PACKAGE_NAME)

	flag.StringVar(&fileName, "in", "", USAGE_FILE_NAME)
	flag.StringVar(&fileName, "i", "", USAGE_FILE_NAME)

	flag.StringVar(&delimiter, "delimiter", DEFAULT_DELIMITER, USAGE_DELIMITER)
	flag.StringVar(&delimiter, "d", DEFAULT_DELIMITER, USAGE_DELIMITER)

	flag.BoolVar(&ignoreHeader, "header", false, USAGE_HEADER)
	flag.BoolVar(&ignoreHeader, "h", false, USAGE_HEADER)

	flag.BoolVar(&test, "test", false, USAGE_INSPECT)
	flag.BoolVar(&test, "t", false, USAGE_INSPECT)
}
开发者ID:sjhitchner,项目名称:csv2map,代码行数:25,代码来源:csv2map.go

示例13: init

func init() {
	flag.IntVar(&qsConfig.PoolSize, "queryserver-config-pool-size", DefaultQsConfig.PoolSize, "query server connection pool size, connection pool is used by regular queries (non streaming, not in a transaction)")
	flag.IntVar(&qsConfig.StreamPoolSize, "queryserver-config-stream-pool-size", DefaultQsConfig.StreamPoolSize, "query server stream pool size, stream pool is used by stream queries: queries that return results to client in a streaming fashion")
	flag.IntVar(&qsConfig.TransactionCap, "queryserver-config-transaction-cap", DefaultQsConfig.TransactionCap, "query server transaction cap is the maximum number of transactions allowed to happen at any given point of a time for a single vttablet. E.g. by setting transaction cap to 100, there are at most 100 transactions will be processed by a vttablet and the 101th transaction will be blocked (and fail if it cannot get connection within specified timeout)")
	flag.Float64Var(&qsConfig.TransactionTimeout, "queryserver-config-transaction-timeout", DefaultQsConfig.TransactionTimeout, "query server transaction timeout (in seconds), a transaction will be killed if it takes longer than this value")
	flag.IntVar(&qsConfig.MaxResultSize, "queryserver-config-max-result-size", DefaultQsConfig.MaxResultSize, "query server max result size, maximum number of rows allowed to return from vttablet for non-streaming queries.")
	flag.IntVar(&qsConfig.MaxDMLRows, "queryserver-config-max-dml-rows", DefaultQsConfig.MaxDMLRows, "query server max dml rows per statement, maximum number of rows allowed to return at a time for an upadte or delete with either 1) an equality where clauses on primary keys, or 2) a subselect statement. For update and delete statements in above two categories, vttablet will split the original query into multiple small queries based on this configuration value. ")
	flag.IntVar(&qsConfig.StreamBufferSize, "queryserver-config-stream-buffer-size", DefaultQsConfig.StreamBufferSize, "query server stream buffer size, the maximum number of bytes sent from vttablet for each stream call.")
	flag.IntVar(&qsConfig.QueryCacheSize, "queryserver-config-query-cache-size", DefaultQsConfig.QueryCacheSize, "query server query cache size, maximum number of queries to be cached. vttablet analyzes every incoming query and generate a query plan, these plans are being cached in a lru cache. This config controls the capacity of the lru cache.")
	flag.Float64Var(&qsConfig.SchemaReloadTime, "queryserver-config-schema-reload-time", DefaultQsConfig.SchemaReloadTime, "query server schema reload time, how often vttablet reloads schemas from underlying MySQL instance in seconds. vttablet keeps table schemas in its own memory and periodically refreshes it from MySQL. This config controls the reload time.")
	flag.Float64Var(&qsConfig.QueryTimeout, "queryserver-config-query-timeout", DefaultQsConfig.QueryTimeout, "query server query timeout (in seconds), this is the query timeout in vttablet side. If a query takes more than this timeout, it will be killed.")
	flag.Float64Var(&qsConfig.TxPoolTimeout, "queryserver-config-txpool-timeout", DefaultQsConfig.TxPoolTimeout, "query server transaction pool timeout, it is how long vttablet waits if tx pool is full")
	flag.Float64Var(&qsConfig.IdleTimeout, "queryserver-config-idle-timeout", DefaultQsConfig.IdleTimeout, "query server idle timeout (in seconds), vttablet manages various mysql connection pools. This config means if a connection has not been used in given idle timeout, this connection will be removed from pool. This effectively manages number of connection objects and optimize the pool performance.")
	flag.Float64Var(&qsConfig.SpotCheckRatio, "queryserver-config-spot-check-ratio", DefaultQsConfig.SpotCheckRatio, "query server rowcache spot check frequency (in [0, 1]), if rowcache is enabled, this value determines how often a row retrieved from the rowcache is spot-checked against MySQL.")
	flag.BoolVar(&qsConfig.StrictMode, "queryserver-config-strict-mode", DefaultQsConfig.StrictMode, "allow only predictable DMLs and enforces MySQL's STRICT_TRANS_TABLES")
	// tableacl related configurations.
	flag.BoolVar(&qsConfig.StrictTableAcl, "queryserver-config-strict-table-acl", DefaultQsConfig.StrictTableAcl, "only allow queries that pass table acl checks")
	flag.BoolVar(&qsConfig.EnableTableAclDryRun, "queryserver-config-enable-table-acl-dry-run", DefaultQsConfig.EnableTableAclDryRun, "If this flag is enabled, tabletserver will emit monitoring metrics and let the request pass regardless of table acl check results")
	flag.StringVar(&qsConfig.TableAclExemptACL, "queryserver-config-acl-exempt-acl", DefaultQsConfig.TableAclExemptACL, "an acl that exempt from table acl checking (this acl is free to access any vitess tables).")
	flag.BoolVar(&qsConfig.TerseErrors, "queryserver-config-terse-errors", DefaultQsConfig.TerseErrors, "prevent bind vars from escaping in returned errors")
	flag.BoolVar(&qsConfig.EnablePublishStats, "queryserver-config-enable-publish-stats", DefaultQsConfig.EnablePublishStats, "set this flag to true makes queryservice publish monitoring stats")
	flag.BoolVar(&qsConfig.RowCache.Enabled, "enable-rowcache", DefaultQsConfig.RowCache.Enabled, "set this flag to enable rowcache. The rest of the rowcache parameters will also need to be accordingly specified.")
	flag.StringVar(&qsConfig.RowCache.Binary, "rowcache-bin", DefaultQsConfig.RowCache.Binary, "rowcache binary file, vttablet launches a memcached if rowcache is enabled. This config specifies the location of the memcache binary.")
	flag.IntVar(&qsConfig.RowCache.Memory, "rowcache-memory", DefaultQsConfig.RowCache.Memory, "rowcache max memory usage in MB")
	flag.StringVar(&qsConfig.RowCache.Socket, "rowcache-socket", DefaultQsConfig.RowCache.Socket, "socket filename hint: a unique filename will be generated based on this input")
	flag.IntVar(&qsConfig.RowCache.Connections, "rowcache-connections", DefaultQsConfig.RowCache.Connections, "rowcache max simultaneous connections")
	flag.IntVar(&qsConfig.RowCache.Threads, "rowcache-threads", DefaultQsConfig.RowCache.Threads, "rowcache number of threads")
	flag.BoolVar(&qsConfig.RowCache.LockPaged, "rowcache-lock-paged", DefaultQsConfig.RowCache.LockPaged, "whether rowcache locks down paged memory")
	flag.StringVar(&qsConfig.RowCache.StatsPrefix, "rowcache-stats-prefix", DefaultQsConfig.RowCache.StatsPrefix, "rowcache stats prefix, rowcache will export various metrics and this config specifies the metric prefix")
	flag.StringVar(&qsConfig.StatsPrefix, "stats-prefix", DefaultQsConfig.StatsPrefix, "prefix for variable names exported via expvar")
	flag.StringVar(&qsConfig.DebugURLPrefix, "debug-url-prefix", DefaultQsConfig.DebugURLPrefix, "debug url prefix, vttablet will report various system debug pages and this config controls the prefix of these debug urls")
	flag.StringVar(&qsConfig.PoolNamePrefix, "pool-name-prefix", DefaultQsConfig.PoolNamePrefix, "pool name prefix, vttablet has several pools and each of them has a name. This config specifies the prefix of these pool names")
	flag.BoolVar(&qsConfig.EnableAutoCommit, "enable-autocommit", DefaultQsConfig.EnableAutoCommit, "if the flag is on, a DML outsides a transaction will be auto committed.")
}
开发者ID:littleyang,项目名称:vitess,代码行数:34,代码来源:config.go

示例14: init

//
// initialize application components
func init() {
	// command line arguments
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage of %s (v%s):\n", filepath.Base(os.Args[0]), wsctlVersion)
		fmt.Fprintf(os.Stderr, "    (each option has short and long version)\n")
		flag.PrintDefaults()
		os.Exit(1)
	}
	flag.StringVar(&cliops.wsauser, "auser", cliops.wsauser, "username to be used for authentication")
	flag.StringVar(&cliops.wsapasswd, "apasswd", cliops.wsapasswd, "password to be used for authentication")
	flag.BoolVar(&cliops.wscrlf, "crlf", cliops.wscrlf, "replace '\\n' with '\\r\\n' inside the data to be sent (true|false)")
	flag.StringVar(&cliops.wsfields, "fields", cliops.wsfields, "path to the json fields file")
	flag.StringVar(&cliops.wsfields, "f", cliops.wsfields, "path to the json fields file")
	flag.BoolVar(&cliops.wsinsecure, "insecure", cliops.wsinsecure, "skip tls certificate validation for wss (true|false)")
	flag.BoolVar(&cliops.wsinsecure, "i", cliops.wsinsecure, "skip tls certificate validation for wss (true|false)")
	flag.StringVar(&cliops.wsorigin, "origin", cliops.wsorigin, "origin http url")
	flag.StringVar(&cliops.wsorigin, "o", cliops.wsorigin, "origin http url")
	flag.StringVar(&cliops.wsproto, "proto", cliops.wsproto, "websocket sub-protocol")
	flag.StringVar(&cliops.wsproto, "p", cliops.wsproto, "websocket sub-protocol")
	flag.BoolVar(&cliops.wsreceive, "receive", cliops.wsreceive, "wait to receive response from ws server (true|false)")
	flag.BoolVar(&cliops.wsreceive, "r", cliops.wsreceive, "wait to receive response from ws server (true|false)")
	flag.StringVar(&cliops.wstemplate, "template", cliops.wstemplate, "path to template file (mandatory parameter)")
	flag.StringVar(&cliops.wstemplate, "t", cliops.wstemplate, "path to template file (mandatory parameter)")
	flag.StringVar(&cliops.wsurl, "url", cliops.wsurl, "websocket url (ws://... or wss://...)")
	flag.StringVar(&cliops.wsurl, "u", cliops.wsurl, "websocket url (ws://... or wss://...)")
	flag.BoolVar(&cliops.version, "version", cliops.version, "print version")
	flag.IntVar(&cliops.wstimeoutrecv, "timeout-recv", cliops.wstimeoutrecv, "timeout waiting to receive data (milliseconds)")
	flag.IntVar(&cliops.wstimeoutsend, "timeout-send", cliops.wstimeoutsend, "timeout trying to send data (milliseconds)")
}
开发者ID:miconda,项目名称:wsctl,代码行数:31,代码来源:wsctl.go

示例15: parse

func parse() params {

	var p params

	flag.BoolVar(&p.showHelp, "help", false, "Show this brief help listing")
	flag.BoolVar(&p.showVersion, "version", false, "Report the version info")
	flag.BoolVar(&p.verbose, "verbose", false, "Show a bit more runtime debugging")
	flag.BoolVar(&p.quiet, "quiet", false, "Exit quietly (and with success) if locked")
	flag.StringVar(&p.lockFilename, "lockfile", "", "File for lock")
	flag.BoolVar(&p.wait, "wait", false, "Wait for lockfile to appear (else exit on lock)")

	flag.IntVar(&p.sleep, "sleep", 2, "Sleep for <T> seconds on each wait loop")
	flag.IntVar(&p.retries, "retries", 5, "Attempts <N> retries in each wait loop")
	flag.IntVar(&p.maxtime, "maxtime", 10, "Wait for at most <T> seconds for a lock, then exit")

	flag.Parse()
	p.commandInfo = flag.Args()

	if p.showHelp || len(p.commandInfo) == 0 {
		showHelp()
		os.Exit(1)
	}

	if p.showVersion {
		showVersion()
		os.Exit(1)
	}

	if p.lockFilename == "" {
		fmt.Println("--lockfile option can't be empty")
		os.Exit(1)
	}

	return p
}
开发者ID:josgilmo,项目名称:Lockrungo,代码行数:35,代码来源:lockrun.go


注:本文中的flag.IntVar函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。