routernode

package
v0.0.0-...-49e5460 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(ctx context.Context, clientManager clientmanager.ClientManager, datasourceInstance *metadata.DatasourceInstance, q *query.Query) (*query.Result, error)

TODO: remove this method? Doesn't do much. Once we support sending things to more than just the primary this won't be helpful (since each call will need to know what is acceptable)

func QueryStream

func QueryStream(ctx context.Context, clientManager clientmanager.ClientManager, datasourceInstance *metadata.DatasourceInstance, q *query.Query) (*query.ResultStream, error)

TODO: remove this method? Doesn't do much. Once we support sending things to more than just the primary this won't be helpful (since each call will need to know what is acceptable)

Types

type Config

type Config struct {
	HTTP       HTTPApiConfig `yaml:"http_api"`
	MetaConfig MetaConfig    `yaml:"meta"`
}

Common configuration for all storage nodes

type HTTPApi

type HTTPApi struct {
	// contains filtered or unexported fields
}

func NewHTTPApi

func NewHTTPApi(routerNode *RouterNode) *HTTPApi

func (*HTTPApi) Start

func (h *HTTPApi) Start(router *httprouter.Router)

Register any endpoints to the router

type HTTPApiConfig

type HTTPApiConfig struct {
	Addr string `yaml:"addr"`
}

HTTP API configuration

type MetaConfig

type MetaConfig struct {
	URL      string        `yaml:"url"`
	Interval time.Duration `yaml:"interval"`
}

type RouterNode

type RouterNode struct {
	Config *Config
	// contains filtered or unexported fields
}

This node is responsible for routing requests to the appropriate storage node This is also responsible for maintaining schema, indexes, etc. from the metadata store

func NewRouterNode

func NewRouterNode(config *Config) (*RouterNode, error)

func (*RouterNode) FetchMeta

func (s *RouterNode) FetchMeta() error

This method will create a new `Databases` map and swap it in

func (*RouterNode) GetMeta

func (s *RouterNode) GetMeta() *metadata.Meta

func (*RouterNode) HandleQuery

func (s *RouterNode) HandleQuery(ctx context.Context, q *query.Query) *query.Result

Handle a single query

func (*RouterNode) HandleStreamQuery

func (s *RouterNode) HandleStreamQuery(ctx context.Context, q *query.Query) *query.ResultStream

func (*RouterNode) Start

func (s *RouterNode) Start() error

TODO: have a stop?

func (*RouterNode) Sync

func (s *RouterNode) Sync() error

TODO: remove? since we need to do this while holding the lock it seems useless

type RouterNodeMetrics

type RouterNodeMetrics struct {
	MetaLastSync     *metrics.ObserveArray
	MetaLastDuration *metrics.ObserveArray

	QueryTime *metrics.ObserveArray
}

func NewRouterNodeMetrics

func NewRouterNodeMetrics(r metrics.Registry) RouterNodeMetrics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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