configutil

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2020 Marvin

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DefaultMasterNamePrefix              = "master"
	DefaultMasterDataDirPrefix           = "data"
	DefaultMasterClientAddr              = "127.0.0.1:2379"
	DefaultMasterPeerAddr                = "127.0.0.1:2380"
	DefaultMasterInitialClusterState     = embed.ClusterStateFlagNew
	DefaultMasterAutoCompactionMode      = "periodic"
	DefaultMasterAutoCompactionRetention = "1h"
	DefaultMasterMaxTxnOps               = 2048
	DefaultMasterQuotaBackendBytes       = 2 * 1024 * 1024 * 1024 // 2GB
	DefaultMasterMaxRequestBytes         = 1.5 * 1024 * 1024
	DefaultMasterStartTimeoutSecond      = 60
	DefaultMasterLogLevel                = "info"
	// DefaultMasterKeepaliveTTL represented service lease keep alive ttl (seconds)
	DefaultMasterKeepaliveTTL = 5
)
View Source
const (
	DefaultWorkerNamePrefix   = "worker"
	DefaultWorkerRegisterAddr = "127.0.0.1:2381"
	// DefaultWorkerKeepaliveTTL represented service lease keep alive ttl (seconds)
	DefaultWorkerKeepaliveTTL    = 5
	DefaultEventQueueChannelSize = 1024
	// DefaultBalanceSleepTime represented service lease keep alive ttl (millions)
	DefaultBalanceSleepTime = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MasterOption

type MasterOption func(opts *MasterOptions)

func WithAutoCompactionMode

func WithAutoCompactionMode(autoCompactionMode string) MasterOption

func WithAutoCompactionRetention

func WithAutoCompactionRetention(autoCompactionRetention string) MasterOption

func WithClientAddr

func WithClientAddr(addr string) MasterOption

func WithCluster

func WithCluster(cluster string) MasterOption

func WithClusterState

func WithClusterState(state string) MasterOption

func WithGRPCSvr

func WithGRPCSvr(gRPCSvr func(*grpc.Server)) MasterOption

func WithHttpHandles

func WithHttpHandles(httpHandles map[string]http.Handler) MasterOption

func WithLogLevel

func WithLogLevel(logLevel string) MasterOption

func WithLogLogger

func WithLogLogger(logger *zap.Logger) MasterOption

func WithMasterDir

func WithMasterDir(dir string) MasterOption

func WithMasterJoin

func WithMasterJoin(addr string) MasterOption

func WithMasterLease

func WithMasterLease(aliveTTL int64) MasterOption

func WithMasterName

func WithMasterName(name string) MasterOption

func WithMaxRequestBytes

func WithMaxRequestBytes(maxRequestBytes uint) MasterOption

func WithMaxTxnOps

func WithMaxTxnOps(maxTxnOps uint) MasterOption

func WithMetrics

func WithMetrics(addr string, mode string) MasterOption

func WithPeerAddr

func WithPeerAddr(addr string) MasterOption

func WithQuotaBackendBytes

func WithQuotaBackendBytes(quotaBackendBytes int64) MasterOption

func WithStartTimeout

func WithStartTimeout(timeoutSecond int) MasterOption

type MasterOptions

type MasterOptions struct {
	Name                string `toml:"name" json:"name"`
	DataDir             string `toml:"data-dir" json:"data-dir"`
	ClientAddr          string `toml:"client-addr" json:"client-addr"`
	PeerAddr            string `toml:"peer-addr" json:"peer-addr"`
	InitialCluster      string `toml:"initial-cluster" json:"initial-cluster"`
	InitialClusterState string `toml:"initial-cluster-state" json:"initial-cluster-state"`

	Join string `toml:"join" json:"join"` // cluster's client address (endpoints), not peer address

	MaxTxnOps               uint   `toml:"max-txn-ops" json:"max-txn-ops"`
	MaxRequestBytes         uint   `toml:"max-request-bytes" json:"max-request-bytes"`
	AutoCompactionMode      string `toml:"auto-compaction-mode" json:"auto-compaction-mode"`
	AutoCompactionRetention string `toml:"auto-compaction-retention" json:"auto-compaction-retention"`
	QuotaBackendBytes       int64  `toml:"quota-backend-bytes" json:"quota-backend-bytes"`

	Metrics    string `toml:"metrics" json:"metrics"`
	MetricsURL string `toml:"metrics-url" json:"metrics-url"`

	KeepaliveTTL int64 `toml:"keepalive-ttl" json:"keepalive-ttl"`

	// time waiting for etcd to be started.
	StartTimeout int `toml:"start-timeout" json:"start-timeout"`

	LogLevel string `toml:"log-level" json:"log-level"`

	GRPCSvr     func(*grpc.Server)      `json:"-"`
	HttpHandles map[string]http.Handler `json:"-"`
	Logger      *zap.Logger             `json:"-"`
}

MasterOptions etcd server relative config items

func DefaultMasterServerConfig

func DefaultMasterServerConfig() *MasterOptions

type WorkerOption

type WorkerOption func(opts *WorkerOptions)

func WithBalanceSleepTime

func WithBalanceSleepTime(time int64) WorkerOption

func WithEventQueueSize

func WithEventQueueSize(queueSize int64) WorkerOption

func WithMasterEndpoint

func WithMasterEndpoint(addr string) WorkerOption

func WithWorkerAddr

func WithWorkerAddr(addr string) WorkerOption

func WithWorkerLease

func WithWorkerLease(aliveTTL int64) WorkerOption

func WithWorkerName

func WithWorkerName(name string) WorkerOption

type WorkerOptions

type WorkerOptions struct {
	Name             string `toml:"name" json:"name"`
	Endpoint         string `toml:"endpoint" json:"endpoint"` // server addrs
	WorkerAddr       string `toml:"worker-addr" json:"worker-addr"`
	KeepaliveTTL     int64  `toml:"keepalive-ttl" json:"keepalive-ttl"`
	EventQueueSize   int64  `toml:"event-queue-size" json:"event-queue-size"`
	BalanceSleepTime int64  `toml:"balance-sleep-time" json:"balance-sleep-time"`
}

WorkerOptions etcd server relative config items

func DefaultWorkerServerConfig

func DefaultWorkerServerConfig() *WorkerOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL