Documentation ¶
Overview ¶
Copyright 2021 SANGFOR TECHNOLOGIES
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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 ¶
const ( AuditDowntimeEnd = "downtime-end" AuditDowntimeExpire = "downtime-expire" AuditReviewUnSeenInstance = "review-unseen-instance" AuditUpdateClusterName = "update-cluster-name" AuditInjectUnSeenMaster = "inject-unseen-master" AuditInjectSeed = "inject-seed" AuditForget = "forget" AuditRegisterCandidate = "register-candidate" AuditReplicaStart = "start-replica" AuditReplicaRestart = "restart-replica" AuditReplicaStop = "stop-replica" AuditRecoverDeadMasterWithoutReplica = "recover-dead-master-without-replicas" )
const ( // cache config CacheAtomPrefix = "atom-" // atom key prefix CacheNotExpire = -1 // CacheExpireByCache = 0 // use default expiration of cache self CacheExpireDefault = 1800 // second CacheExpireAtomKey = 2 // second CacheExpireRandomDelta = 1800 // second CacheNamePrefix = "cache-" // name and expire and clean up for different key CacheAgentName = "agent" CacheAgentExpire = 3600 // second CacheAgentCleanupInterval = 1800 // second CacheGrpcName = "grpc" CacheGrpcExpire = 86400 // second CacheGrpcCleanupInterval = 1800 // second CacheHostnameName = "hostname" CacheHostnameCleanupInterval = 60 // second CacheIPName = "ip" CacheIPExpire = 600 // second CacheIPCleanupInterval = 60 // second CacheLogName = "log" CacheLogExpire = 60 // second CacheLogCleanupInterval = 5 // second CacheInstanceForgetName = "inst-forget" CacheInstanceForgetCleanupInterval = 1 //second CacheInstanceAnalysisName = "inst-analysis" CacheInstanceAnalysisCleanupInterval = 1 //second CacheClusterName = "cluster" CacheClusterCleanupInterval = 1 //second CacheKVFoundName = "kv-found" CacheKVFoundExpire = 600 CacheKVFoundCleanupInterval = 60 CacheOperationKeyName = "operation-key" CacheOperationKeyExpire = 600 CacheOperationKeyCleanupInterval = 1 )
const ( // app config WhoAmI = "ham4db" // default config DefaultBackendDB = BackendDBTestDB // used test db as default backend db DefaultEnabledAdaptor = TestDB // used test db as default enabled adaptor DefaultVersion = "10.10.10" // default ham4db version for test db DefaultStatusAPIEndpoint = "/api/status" // backend database type BackendDBMysql = "mysql" BackendDBOpengauss = "opengauss" BackendDBSqlite = "sqlite3" BackendDBTestDB = TestDB // test backend database TestDB = "testdb" // backend database name TestDBDir = "/tmp/ham4db" // tmp database data file directory TestDBOptionSimulateError = "simulateError" // setting used to decide to simulate error or not // retry RetryInterval = 500 * time.Millisecond // retry interval RetryFunction = 5 // max retry times when function exec failed // concurrency ConcurrencyBackendDBWrite = 20 // max concurrency for back end db write ConcurrencyBackendDBRead = 20 // max concurrency for back end db read ConcurrencyTopologyOperation = 128 // Max concurrency for bulk topology operations // grpc GrpcTimeout = 20 //second // date format DateFormat = "2006-01-02 15:04:05" // format date data when get from database DateFormatTimeZone = "2006-01-02T15:04:05Z" // format date data when get from database DateFormatLog = "2006-01-02 15:04:05" // os OSTempPath = "/tmp/ham4db" OSTempFilePatten = "ham4db-temp-" // temp file patten: prefix as the part before "*" and suffix as the part after "*" // query DefaultQuery = `` /* 1314-byte string literal not displayed */ DefaultQueryFuzzy = `select db_type, hostname, port, cluster_id from ham_database_instance` DefaultQueryClusterName = `select cluster_name from ham_database_instance` // downtime DowntimeReasonLostInRecovery = "lost-in-recovery" DowntimeSecond int = 60 * 60 * 24 * 365 // token TokenShortLength = 8 // used to get short token // random string RandomChars = "0123456789abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ" )
const ( NoStopReplication StopReplicationMethod = "NoStopReplication" StopReplicationNormal = "StopReplicationNormal" StopReplicationNice = "StopReplicationNice" )
const ( // response message HttpRespMsgUnAuth = "unauthorized" HttpRespMsgMissClusterId = "miss cluster id" HttpRespMsgMissRole = "miss role" )
const ( // collection CollectionDefaultExpire = 1 // second CollectionWriteBuffer = "write.buffer" // CollectionBackendWrite = "backend.write" // name for backend write // metric MetricAuditOpt = "audit.write" // MetricInstanceRead = "instance.read" MetricInstanceWrite = "instance.write" MetricAnalysisChangeWriteAttempt = "analysis.change.write.attempt" MetricAnalysisChangeWrite = "analysis.change.write" MetricDiscoverAttempt = "discoveries.attempt" MetricDiscoverFail = "discoveries.fail" MetricDiscoverInstancePollSecondExceed = "discoveries.instance_poll_seconds_exceeded" MetricDiscoverQueueLength = "discoveries.queue_length" MetricDiscoverRecentCount = "discoveries.recent_count" MetricElectIsElected = "elect.is_elected" MetricHealthIsHealthy = "health.is_healthy" MetricRaftIsHealthy = "raft.is_healthy" MetricRaftIsLeader = "raft.is_leader" // for aggregated discovery metric FailedDiscoveries CounterKey = "FailedDiscoveries" Discoveries = "Discoveries" InstanceKeys HostKey = "InstanceKeys" OkInstanceKeys = "OkInstanceKeys" FailedInstanceKeys = "FailedInstanceKeys" TotalSeconds TimerKey = "TotalSeconds" BackendSeconds = "BackendSeconds" InstanceSeconds = "InstanceSeconds" FailedTotalSeconds = "FailedTotalSeconds" FailedBackendSeconds = "FailedBackendSeconds" FailedInstanceSeconds = "FailedInstanceSeconds" // monitor type MonitorGraphite = "Graphite" )
const ( RaftCommandDiscover = "discover" RaftCommandForget = "forget" SnapshotTypeRDMS = "rdms" )
const ( IP = `` /* 659-byte string literal not displayed */ URLSchema = `((https?):\/\/)` URLPath = `((\/|\?|#)[^\s]*)` URLPort = `(:(\d{1,5}))` URLIP = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))` URLSubdomain = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))` URL = `^` + URLSchema + `?` + `((` + URLIP + `|(\[` + IP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + URLSubdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + URLPort + `?` + URLPath + `?$` )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CounterKey ¶
type CounterKey string
type StopReplicationMethod ¶
type StopReplicationMethod string