github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/x/config.go (about) 1 /* 2 * Copyright 2017-2018 Dgraph Labs, Inc. and Contributors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package x 18 19 import ( 20 "net" 21 "time" 22 ) 23 24 // Options stores the options for this package. 25 type Options struct { 26 // PortOffset will be used to determine the ports to use (port = default port + offset). 27 PortOffset int 28 // QueryEdgeLimit is the maximum number of edges that will be traversed during 29 // recurse and shortest-path queries. 30 QueryEdgeLimit uint64 31 // NormalizeNodeLimit is the maximum number of nodes allowed in a normalize query. 32 NormalizeNodeLimit int 33 } 34 35 // Config stores the global instance of this package's options. 36 var Config Options 37 38 // IPRange represents an IP range. 39 type IPRange struct { 40 Lower, Upper net.IP 41 } 42 43 // WorkerOptions stores the options for the worker package. It's declared here 44 // since it's used by multiple packages. 45 type WorkerOptions struct { 46 // ExportPath indicates the folder to which exported data will be saved. 47 ExportPath string 48 // NumPendingProposals indicates the maximum number of pending mutation proposals. 49 NumPendingProposals int 50 // Tracing tells Dgraph to only sample a percentage of the traces equal to its value. 51 // The value of this option must be between 0 and 1. 52 // TODO: Get rid of this here. 53 Tracing float64 54 // MyAddr stores the address and port for this alpha. 55 MyAddr string 56 // ZeroAddr stores the address and port for the zero instance associated with this alpha. 57 ZeroAddr string 58 // RaftId represents the id of this alpha instance for participating in the RAFT 59 // consensus protocol. 60 RaftId uint64 61 // WhiteListedIPRanges is a list of IP ranges from which requests will be allowed. 62 WhiteListedIPRanges []IPRange 63 // MaxRetries is the maximum number of times to retry a commit before giving up. 64 MaxRetries int 65 // StrictMutations will cause mutations to unknown predicates to fail if set to true. 66 StrictMutations bool 67 // AclEnabled indicates whether the enterprise ACL feature is turned on. 68 AclEnabled bool 69 // AbortOlderThan tells Dgraph to discard transactions that are older than this duration. 70 AbortOlderThan time.Duration 71 // SnapshotAfter indicates the number of entries in the RAFT logs that are needed 72 // to allow a snapshot to be created. 73 SnapshotAfter int 74 } 75 76 // WorkerConfig stores the global instance of the worker package's options. 77 var WorkerConfig WorkerOptions