import "github.com/abhinavdahiya/cockroach/base"
constants.go context.go test_server_args.go testing_knobs.go
const ( // From IANA Service Name and Transport Protocol Port Number Registry. See // https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=cockroachdb DefaultPort = "26257" // The default port for HTTP-for-humans. DefaultHTTPPort = "8080" // NetworkTimeout is the timeout used for network operations. NetworkTimeout = 3 * time.Second // DefaultRaftTickInterval is the default resolution of the Raft timer. DefaultRaftTickInterval = 100 * time.Millisecond )
Base context defaults.
const ( // DefaultHeartbeatInterval is how often heartbeats are sent from the // transaction coordinator to a live transaction. These keep it from // being preempted by other transactions writing the same keys. If a // transaction fails to be heartbeat within 2x the heartbeat interval, // it may be aborted by conflicting txns. DefaultHeartbeatInterval = 5 * time.Second )
DefaultRetryOptions should be used for retrying most network-dependent operations.
type Context struct { // Insecure specifies whether to use SSL or not. // This is really not recommended. Insecure bool // SSLCA and others contain the paths to the ssl certificates and keys. SSLCA string // CA certificate SSLCAKey string // CA key (to sign only) SSLCert string // Client/server certificate SSLCertKey string // Client/server key // User running this process. It could be the user under which // the server is running or the user passed in client calls. User string // Addr is the server's public address. Addr string // HTTPAddr is server's public HTTP address. // // This is temporary, and will be removed when grpc.(*Server).ServeHTTP // performance problems are addressed upstream. // // See https://github.com/grpc/grpc-go/issues/586. HTTPAddr string // contains filtered or unexported fields }
Context is embedded by server.Context. A base context is not meant to be used directly, but embedding contexts should call ctx.InitDefaults().
AdminURL returns the URL for the admin UI.
GetClientTLSConfig returns the context client TLS config, initializing it if needed. If Insecure is true, return a nil config, otherwise load a config based on the SSLCert file. If SSLCert is empty, use a very permissive config. TODO(marc): empty SSLCert should fail when client certificates are required.
GetHTTPClient returns the context http client, initializing it if needed. It uses the context client TLS config.
GetServerTLSConfig returns the context server TLS config, initializing it if needed. If Insecure is true, return a nil config, otherwise load a config based on the SSLCert file. Fails if Insecure=false and SSLCert="".
HTTPRequestScheme returns "http" or "https" based on the value of Insecure.
InitDefaults sets up the default values for a context.
PGURL returns the URL for the postgres endpoint.
type ModuleTestingKnobs interface { // ModuleTestingKnobs is a dummy function. ModuleTestingKnobs() }
ModuleTestingKnobs is an interface for testing knobs for a submodule.
type TestClusterArgs struct { // ServerArgs will be copied to each constituent TestServer. ServerArgs TestServerArgs // ReplicationMode controls how replication is to be done in the cluster. ReplicationMode TestClusterReplicationMode // Stopper can be used to stop the cluster. If not set, a stopper will be // constructed and it can be gotten through TestCluster.Stopper(). Stopper *stop.Stopper }
TestClusterArgs contains the parameters one can set when creating a test cluster. It contains a TestServerArgs instance which will be copied over to every server.
The zero value means "full replication".
TestClusterReplicationMode represents the replication settings for a TestCluster.
const ( // ReplicationAuto means that ranges are replicated according to the // production default zone config. Replication is performed as in // production, by the replication queue. // TestCluster.WaitForFullReplication() can be used to wait for // replication to be stable at any point in a test. ReplicationAuto TestClusterReplicationMode = iota // ReplicationManual means that the split and replication queues of all // servers are stopped, and the test must manually control splitting and // replication through the TestServer. ReplicationManual )
type TestServerArgs struct { // Knobs for the test server. Knobs TestingKnobs // PartOfCluster must be set if the TestServer is joining others in a cluster. // If not set (and hence the server is the only one in the cluster), the // default zone config will be overridden to disable all replication - so that // tests don't get log spam about ranges not being replicated enough. PartOfCluster bool // JoinAddr (if nonempty) is the address of a node we are joining. JoinAddr string StoresPerNode int // Fields copied to the server.Context. Insecure bool MetricsSampleInterval time.Duration MaxOffset time.Duration SocketFile string ScanInterval time.Duration ScanMaxIdleTime time.Duration SSLCA string SSLCert string SSLCertKey string // If set, this will be appended to the Postgres URL by functions that // automatically open a connection to the server. That's equivalent to running // SET DATABASE=foo, which works even if the database doesn't (yet) exist. UseDatabase string // Stopper can be used to stop the server. If not set, a stopper will be // constructed and it can be gotten through TestServerInterface.Stopper(). Stopper *stop.Stopper }
TestServerArgs contains the parameters one can set when creating a test server. Notably, TestServerArgs are passed to serverutils.StartServer(). They're defined in base because they need to be shared between testutils/serverutils (test code) and server.TestServer (non-test code).
The zero value is suitable for most tests.
type TestingKnobs struct { Store ModuleTestingKnobs SQLExecutor ModuleTestingKnobs SQLLeaseManager ModuleTestingKnobs SQLSchemaChangeManager ModuleTestingKnobs }
TestingKnobs contains facilities for controlling various parts of the system for testing.
Package base imports 14 packages (graph). Updated 2017-03-13. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).