pilosa: github.com/pilosa/pilosa/server Index | Files

package server

import "github.com/pilosa/pilosa/server"

Index

Package Files

config.go default.go server.go setup_logger.go tlsconfig.go

func GetTLSConfig Uses

func GetTLSConfig(tlsConfig *TLSConfig, logger *log.Logger) (TLSConfig *tls.Config, err error)

func NewKeypairReloader Uses

func NewKeypairReloader(certPath, keyPath string, logger *log.Logger) (*keypairReloader, error)

type Command Uses

type Command struct {
    Server *pilosa.Server

    // Configuration.
    Config *Config

    // Standard input/output
    *pilosa.CmdIO

    // Started will be closed once Command.Start is finished.
    Started chan struct{}

    Handler pilosa.Handler
    API     *pilosa.API
    // contains filtered or unexported fields
}

Command represents the state of the pilosa server command.

func NewCommand Uses

func NewCommand(stdin io.Reader, stdout, stderr io.Writer, opts ...CommandOption) *Command

NewCommand returns a new instance of Main.

func (*Command) Close Uses

func (m *Command) Close() error

Close shuts down the server.

func (*Command) GossipTransport Uses

func (m *Command) GossipTransport() *gossip.Transport

GossipTransport allows a caller to return the gossip transport created when setting up the GossipMemberSet. This is useful if one needs to determine the allocated ephemeral port programmatically. (usually used in tests)

func (*Command) SetupServer Uses

func (m *Command) SetupServer() error

SetupServer uses the cluster configuration to set up this server.

func (*Command) Start Uses

func (m *Command) Start() (err error)

Start starts the pilosa server - it returns once the server is running.

func (*Command) UpAndDown Uses

func (m *Command) UpAndDown() (err error)

func (*Command) Wait Uses

func (m *Command) Wait() error

Wait waits for the server to be closed or interrupted.

type CommandOption Uses

type CommandOption func(c *Command) error

func OptCommandCloseTimeout Uses

func OptCommandCloseTimeout(d time.Duration) CommandOption

func OptCommandConfig Uses

func OptCommandConfig(config *Config) CommandOption

func OptCommandServerOptions Uses

func OptCommandServerOptions(opts ...pilosa.ServerOption) CommandOption

type Config Uses

type Config struct {
    // DataDir is the directory where Pilosa stores both indexed data and
    // running state such as cluster topology information.
    DataDir string `toml:"data-dir"`

    // Bind is the host:port on which Pilosa will listen.
    Bind string `toml:"bind"`

    // Advertise is the address advertised by the server to other nodes
    // in the cluster. It should be reachable by all other nodes and should
    // route to an interface that Bind is listening on.
    Advertise string `toml:"advertise"`

    // MaxWritesPerRequest limits the number of mutating commands that can be in
    // a single request to the server. This includes Set, Clear,
    // SetRowAttrs & SetColumnAttrs.
    MaxWritesPerRequest int `toml:"max-writes-per-request"`

    // LogPath configures where Pilosa will write logs.
    LogPath string `toml:"log-path"`

    // Verbose toggles verbose logging which can be useful for debugging.
    Verbose bool `toml:"verbose"`

    // HTTP Handler options
    Handler struct {
        // CORS Allowed Origins
        AllowedOrigins []string `toml:"allowed-origins"`
    }   `toml:"handler"`

    // MaxMapCount puts an in-process limit on the number of mmaps. After this
    // is exhausted, Pilosa will fall back to reading the file into memory
    // normally.
    MaxMapCount uint64 `toml:"max-map-count"`

    // MaxFileCount puts a soft, in-process limit on the number of open fragment
    // files. Once this limit is passed, Pilosa will only keep files open while
    // actively working with them, and will close them afterward. This has a
    // negative effect on performance for workloads which make small appends to
    // lots of fragments.
    MaxFileCount uint64 `toml:"max-file-count"`

    // TLS
    TLS TLSConfig `toml:"tls"`

    // WorkerPoolSize controls how many goroutines are created for
    // processing queries. Defaults to runtime.NumCPU(). It is
    // intentionally not defined as a flag... only exposed here so
    // that we can limit the size while running tests in CI so we
    // don't exhaust the goroutine limit.
    WorkerPoolSize int

    // ImportWorkerPoolSize controls how many goroutines are created for
    // processing importRoaring jobs. Defaults to runtime.NumCPU(). It is
    // intentionally not defined as a flag... only exposed here so
    // that we can limit the size while running tests in CI so we
    // don't exhaust the goroutine limit.
    ImportWorkerPoolSize int

    Cluster struct {
        // Disabled controls whether clustering functionality is enabled.
        Disabled    bool     `toml:"disabled"`
        Coordinator bool     `toml:"coordinator"`
        ReplicaN    int      `toml:"replicas"`
        Hosts       []string `toml:"hosts"`
        // TODO(2.0) move this out of cluster. (why is it here??)
        LongQueryTime toml.Duration `toml:"long-query-time"`
    }   `toml:"cluster"`

    // Gossip config is based around memberlist.Config.
    Gossip gossip.Config `toml:"gossip"`

    Translation struct {
        MapSize int `toml:"map-size"`
        // DEPRECATED: Translation config supports translation store replication.
        PrimaryURL string `toml:"primary-url"`
    }   `toml:"translation"`

    AntiEntropy struct {
        Interval toml.Duration `toml:"interval"`
    }   `toml:"anti-entropy"`

    Metric struct {
        // Service can be statsd, expvar, or none.
        Service string `toml:"service"`
        // Host tells the statsd client where to write.
        Host         string        `toml:"host"`
        PollInterval toml.Duration `toml:"poll-interval"`
        // Diagnostics toggles sending some limited diagnostic information to
        // Pilosa's developers.
        Diagnostics bool `toml:"diagnostics"`
    }   `toml:"metric"`

    Tracing struct {
        // SamplerType is the type of sampler to use.
        SamplerType string `toml:"sampler-type"`
        // SamplerParam is the parameter passed to the tracing sampler.
        // Its meaning is dependent on the type of sampler.
        SamplerParam float64 `toml:"sampler-param"`
        // AgentHostPort is the host:port of the local agent.
        AgentHostPort string `toml:"agent-host-port"`
    }   `toml:"tracing"`

    Profile struct {
        // BlockRate is passed directly to runtime.SetBlockProfileRate
        BlockRate int `toml:"block-rate"`
        // MutexFraction is passed directly to runtime.SetMutexProfileFraction
        MutexFraction int `toml:"mutex-fraction"`
    }   `toml:"profile"`
}

Config represents the configuration for the command.

func NewConfig Uses

func NewConfig() *Config

NewConfig returns an instance of Config with default options.

type TLSConfig Uses

type TLSConfig struct {
    // CertificatePath contains the path to the certificate (.crt or .pem file)
    CertificatePath string `toml:"certificate"`
    // CertificateKeyPath contains the path to the certificate key (.key file)
    CertificateKeyPath string `toml:"key"`
    // CACertPath is the path to a CA certificate (.crt or .pem file)
    CACertPath string `toml:"ca-certificate"`
    // SkipVerify disables verification of server certificates when connecting to another Pilosa node
    SkipVerify bool `toml:"skip-verify"`
    // EnableClientVerification enables verification of client TLS certificates (Mutual TLS)
    EnableClientVerification bool `toml:"enable-client-verification"`
}

TLSConfig contains TLS configuration

Package server imports 34 packages (graph) and is imported by 10 packages. Updated 2019-11-16. Refresh now. Tools for package owners.