models

package
v0.0.0-...-48dec30 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenerRegister

func ListenerRegister(name string, l Listener)

func Listeners

func Listeners() map[string]Listener

Types

type Config

type Config struct {
	SupressRecover bool                   `json:"supress_recover"` // do we recover?
	WorkerCt       int                    `json:"worker_ct"`       // 4 how many worker nodes on this instance
	LogLevel       string                 `json:"log_level"`       // [debug,info,error,]
	Etcd           []string               `json:"etcd"`            // list of etcd servers http://127.0.0.1:2379,http://127.0.0.1:2380
	Frontends      []*ListenerConfig      `json:"frontends"`       // tcp listener configs
	Sources        []*schema.ConfigSource `json:"sources"`         // backend servers/sources (es, mysql etc)
	Schemas        []*schema.ConfigSchema `json:"schemas"`         // Schemas, each backend has 1 schema
	Rules          *RulesConfig           `json:"rules"`           // rules for routing
}

Config for DataUX Server config made up of blocks 1) Frontend Listeners (protocols) 2) Sources (types of backends such as elasticsearch, mysql, mongo, ...) 3) Schemas: n number of sources can create a "Virtual Schema" 4) etcd coordinators hosts

func LoadConfig

func LoadConfig(conf string) (*Config, error)

LoadConfig load a confl formatted file from string (assumes came) from file or passed in

func LoadConfigFromFile

func LoadConfigFromFile(filename string) (*Config, error)

LoadConfigFromFile Read a Confl formatted config file from disk

func (*Config) DistributedMode

func (c *Config) DistributedMode() bool

DistributedMode Does this config operate in distributed mode?

type Listener

type Listener interface {
	Init(*ListenerConfig, *ServerCtx) error
	Run(stop chan bool) error
	Close() error
}

A listener is a protocol specific, and transport specific

reader of requests which will be routed to a handler

func ListenerGet

func ListenerGet(name string) Listener

type ListenerConfig

type ListenerConfig struct {
	Type     string `json:"type"`     // named protocol type [mysql,mongo,mc,postgres,etc]
	Addr     string `json:"address"`  // net.Conn compatible ip/dns address
	User     string `json:"user"`     // user to talk to backend with
	Password string `json:"password"` // optional pwd for backend
}

ListenerConfig Frontend Listener to listen for inbound traffic on specific protocol aka transport (mysql)

type Request

type Request struct {
	Raw     []byte // raw full byte statement
	Db      string // Db name parsed from statement
	Schema  *schema.Schema
	Session expr.ContextReader
}

a DataUx Request contains the request/command from client and references to session and schema

type Result

type Result interface{}

type ResultWriter

type ResultWriter interface {
	WriteResult(Result) error
}

type RulesConfig

type RulesConfig struct {
	Schema    string        `json:"schema"`
	Default   string        `json:"default"`
	ShardRule []ShardConfig `json:"shard"`
}

RulesConfig

type ServerCtx

type ServerCtx struct {
	// The dataux server config info on schema, backends, frontends, etc
	Config *Config
	// The underlying qlbridge registry holds info about the available datasource providers
	Reg *schema.Registry
	// PlanGrid is swapping out the qlbridge planner
	// with a distributed version that uses Grid lib to split
	// tasks across nodes
	PlanGrid *planner.PlannerGrid
	// contains filtered or unexported fields
}

ServerCtx Singleton global Context for the DataUX Server giving access to the shared Config, Schemas, Grid runtime

func NewServerCtx

func NewServerCtx(conf *Config) *ServerCtx

NewServerCtx create new server context. Main stateful object for sharing server state.

func (*ServerCtx) InfoSchema

func (m *ServerCtx) InfoSchema() (*schema.Schema, error)

InfoSchema Get A schema

func (*ServerCtx) Init

func (m *ServerCtx) Init() error

Init Load all the config info for this server and start the grid/messaging/coordination systems

func (*ServerCtx) JobMaker

func (m *ServerCtx) JobMaker(ctx *plan.Context) (*planner.GridTask, error)

JobMaker create job

func (*ServerCtx) Schema

func (m *ServerCtx) Schema(source string) (*schema.Schema, bool)

func (*ServerCtx) SchemaLoader

func (m *ServerCtx) SchemaLoader(db string) (*schema.Schema, error)

SchemaLoader finds a schema by name from the registry

func (*ServerCtx) Table

func (m *ServerCtx) Table(schemaName, tableName string) (*schema.Table, error)

Table Get by schema, name

type ShardConfig

type ShardConfig struct {
	Table string   `json:"table"`
	Key   string   `json:"key"`
	Nodes []string `json:"nodes"`
	Type  string   `json:"type"`
	Range string   `json:"range"`
}

ShardConfig

type StatementHandler

type StatementHandler interface {
	SchemaUse(db string) *schema.Schema
	Handle(writer ResultWriter, req *Request) error
	Close() error
}

A statement handler fulfills a frontend network client request. Examples of handlers are mysql, mongo, etc

type StatementHandlerCreator

type StatementHandlerCreator interface {
	Open(conn interface{}) StatementHandler
}

Jump to

Keyboard shortcuts

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