base

package
v0.0.0-...-5695764 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
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
)

Variables

This section is empty.

Functions

func DefaultRetryOptions

func DefaultRetryOptions() retry.Options

DefaultRetryOptions should be used for retrying most network-dependent operations.

Types

type Context

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().

func (*Context) AdminURL

func (ctx *Context) AdminURL() string

AdminURL returns the URL for the admin UI.

func (*Context) GetClientTLSConfig

func (ctx *Context) GetClientTLSConfig() (*tls.Config, error)

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.

func (*Context) GetHTTPClient

func (ctx *Context) GetHTTPClient() (http.Client, error)

GetHTTPClient returns the context http client, initializing it if needed. It uses the context client TLS config.

func (*Context) GetServerTLSConfig

func (ctx *Context) GetServerTLSConfig() (*tls.Config, error)

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="".

func (*Context) HTTPRequestScheme

func (ctx *Context) HTTPRequestScheme() string

HTTPRequestScheme returns "http" or "https" based on the value of Insecure.

func (*Context) InitDefaults

func (ctx *Context) InitDefaults()

InitDefaults sets up the default values for a context.

func (*Context) PGURL

func (ctx *Context) PGURL(user string) (*url.URL, error)

PGURL returns the URL for the postgres endpoint.

type ModuleTestingKnobs

type ModuleTestingKnobs interface {
	// ModuleTestingKnobs is a dummy function.
	ModuleTestingKnobs()
}

ModuleTestingKnobs is an interface for testing knobs for a submodule.

type TestingKnobs

type TestingKnobs struct {
	Store                  ModuleTestingKnobs
	SQLExecutor            ModuleTestingKnobs
	SQLLeaseManager        ModuleTestingKnobs
	SQLSchemaChangeManager ModuleTestingKnobs
}

TestingKnobs contains facilities for controlling various parts of the system for testing.

Jump to

Keyboard shortcuts

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