weaver

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

Weaver

Build Status Go Report Card

Description

A Layer-7 Load Balancer with Dynamic Sharding Strategy

Building

  make

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	ID             string          `json:"id"`
	Criterion      string          `json:"criterion"`
	EndpointConfig *EndpointConfig `json:"endpoint"`

	Endpoint *Endpoint
}

ACL - Connects to an external endpoint

func (*ACL) GenACL

func (acl *ACL) GenACL(val string) error

GenACL - Generates an ACL from JSON

func (ACL) String

func (acl ACL) String() string

type Backend

type Backend struct {
	Handler http.Handler
	Server  *url.URL
	Name    string
}

func NewBackend

func NewBackend(name string, serverURL string, options BackendOptions) (*Backend, error)

type BackendOptions

type BackendOptions struct {
	Timeout time.Duration
}

type Endpoint

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

func NewEndpoint

func NewEndpoint(endpointConfig *EndpointConfig, sharder Sharder) (*Endpoint, error)

func (*Endpoint) Shard

func (endpoint *Endpoint) Shard(request *http.Request) (*Backend, error)

type EndpointConfig

type EndpointConfig struct {
	Matcher     string          `json:"matcher"`
	ShardExpr   string          `json:"shard_expr"`
	ShardFunc   string          `json:"shard_func"`
	ShardConfig json.RawMessage `json:"shard_config"`
}

EndpointConfig - Defines a config for external service

type Sharder

type Sharder interface {
	Shard(key string) (*Backend, error)
}

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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