shard

package
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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(msg string) error

func New

func New(name string, cfg json.RawMessage) (weaver.Sharder, error)

func NewHashRingStrategy

func NewHashRingStrategy(data json.RawMessage) (weaver.Sharder, error)

func NewLookupStrategy

func NewLookupStrategy(data json.RawMessage) (weaver.Sharder, error)

func NewModuloStrategy

func NewModuloStrategy(data json.RawMessage) (weaver.Sharder, error)

func NewNoStrategy

func NewNoStrategy(data json.RawMessage) (weaver.Sharder, error)

func NewPrefixLookupStrategy

func NewPrefixLookupStrategy(data json.RawMessage) (weaver.Sharder, error)

func NewS2Strategy

func NewS2Strategy(data json.RawMessage) (weaver.Sharder, error)

Types

type BackendDefinition

type BackendDefinition struct {
	BackendName string   `json:"backend_name"`
	BackendURL  string   `json:"backend"`
	Timeout     *float64 `json:"timeout,omitempty"`
}

func (BackendDefinition) Validate

func (bd BackendDefinition) Validate() error

type CustomError

type CustomError struct {
	ExitMessage string
}

func (*CustomError) Error

func (e *CustomError) Error() string

type HashRingStrategy

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

func (HashRingStrategy) Shard

func (rs HashRingStrategy) Shard(key string) (*weaver.Backend, error)

type HashRingStrategyConfig

type HashRingStrategyConfig struct {
	TotalVirtualBackends *int                         `json:"totalVirtualBackends"`
	Backends             map[string]BackendDefinition `json:"backends"`
}

func (HashRingStrategyConfig) Validate

func (hrCfg HashRingStrategyConfig) Validate() error

type LookupStrategy

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

func (*LookupStrategy) Shard

func (ls *LookupStrategy) Shard(key string) (*weaver.Backend, error)

type ModuloStrategy

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

func (ModuloStrategy) Shard

func (ms ModuloStrategy) Shard(key string) (*weaver.Backend, error)

type NoStrategy

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

func (*NoStrategy) Shard

func (ns *NoStrategy) Shard(key string) (*weaver.Backend, error)

type NoStrategyConfig

type NoStrategyConfig struct {
	BackendDefinition `json:",inline"`
}

type PrefixLookupStrategy

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

func (*PrefixLookupStrategy) Shard

func (pls *PrefixLookupStrategy) Shard(key string) (*weaver.Backend, error)

type S2Strategy

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

func (*S2Strategy) Shard

func (s2s *S2Strategy) Shard(key string) (*weaver.Backend, error)

type S2StrategyConfig

type S2StrategyConfig struct {
	ShardKeySeparator string                       `json:"shard_key_separator"`
	ShardKeyPosition  *int                         `json:"shard_key_position,omitempty"`
	Backends          map[string]BackendDefinition `json:"backends"`
}

func (S2StrategyConfig) Validate

func (s2cfg S2StrategyConfig) Validate() error

Jump to

Keyboard shortcuts

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