models

package
v0.0.0-...-a18f44e Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2016 License: MIT Imports: 11 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
	Nats           []string               `json:"nats"`            // list of nats servers http://127.0.0.1:4222,http://127.0.0.1:4223
	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
	Nodes          []*schema.ConfigNode   `json:"nodes"`           // list of nodes that host sources
	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. list of server/nodes for Sources
  5. nats,etcd coordinators

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

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

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"`
}

type ServerCtx

type ServerCtx struct {
	// The dataux server config info on schema, backends, frontends, etc
	Config *Config

	// The underlying qlbridge schema holds info about the available datasource's
	Reg *datasource.Registry
	// PlanGrid is our real-time multi-node coordination and messaging system
	PlanGrid *planner.PlannerGrid
	// contains filtered or unexported fields
}

ServerCtx Server Context for the DataUX Server giving access to the shared

memory objects Config, Schemas, Grid runtime

func NewServerCtx

func NewServerCtx(conf *Config) *ServerCtx

func (*ServerCtx) InfoSchema

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

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.ExecutorGrid, error)

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"`
}

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