flush

package
v0.0.2-0...-4ce78c8 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtTheEnd

type AtTheEnd struct{}

AtTheEnd strategy is the simply flushing the data at the end of the execution of the function.

func (*AtTheEnd) ShouldFlush

func (s *AtTheEnd) ShouldFlush(moment Moment, t time.Time) bool

ShouldFlush returns true if this strategy want to flush at the given moment.

func (*AtTheEnd) String

func (s *AtTheEnd) String() string

type Moment

type Moment string

Moment represents at which moment we're asking the flush strategy if we should flush or not. Note that there is no entry for the shutdown of the environment because we always flush in this situation.

const (
	// Starting is used to represent the moment the function is starting because
	// it has been invoked.
	Starting Moment = "starting"
	// Stopping is used to represent the moment right after the function has finished
	// its execution.
	Stopping Moment = "stopping"
)

type Periodically

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

Periodically is the strategy flushing at least every N [nano/micro/milli]seconds at the start of the function.

func NewPeriodically

func NewPeriodically(interval time.Duration) *Periodically

NewPeriodically returns an initialized Periodically flush strategy.

func (*Periodically) ShouldFlush

func (s *Periodically) ShouldFlush(moment Moment, t time.Time) bool

ShouldFlush returns true if this strategy want to flush at the given moment.

func (*Periodically) String

func (s *Periodically) String() string

type Strategy

type Strategy interface {
	String() string
	ShouldFlush(moment Moment, t time.Time) bool
}

Strategy is deciding whether the data should be flushed or not at the given moment.

func StrategyFromString

func StrategyFromString(str string) (Strategy, error)

StrategyFromString returns a flush strategy from the given string. Possible values:

  • end
  • periodically[,milliseconds]

Jump to

Keyboard shortcuts

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