sozu

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package sozu contains implementation details for the sozu strategy.

The sozu strategy attempts to execute the batch function everytime the keys array hits capacity. Then subsequent calls to Load(), after the batch function has been called once, start a new worker which will call the batch function once again after the keys array capacity has been hit. It's goal is to ensure that they batch function is called with the most number of keys possible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSozuStrategy

func NewSozuStrategy(opts ...Option) dataloader.StrategyFunction

NewSozuStrategy returns a new instance of the Sozu strategy. The Sozu strategy calls the batch function everytime the keys array hits capacity. The Sozu Strategy also implements a timer that triggers the batch load function after a specified timeout duration (see Options) to ensure it doesn't block for too long. It attempts to ensure that each call to the batch function includes an array of keys whose length is >= 1 and <= the capacity.

Types

type Option added in v0.4.0

type Option func(*options)

Option accepts the dataloader and sets an option on it.

func WithLogger added in v0.5.0

func WithLogger(l log.Logger) Option

WithLogger adds a logger to the strategy. Default is a no op logger.

func WithTimeout added in v0.4.0

func WithTimeout(t time.Duration) Option

WithTimeout sets the timeout value for the strategy

Jump to

Keyboard shortcuts

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