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 ¶
ShouldFlush returns true if this strategy want to flush at the given moment.
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.
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) Failure ¶
func (s *Periodically) Failure(t time.Time)
Failure modify state to keep track of failure
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
func (*Periodically) Success ¶
func (s *Periodically) Success()
Success reset the state when a flush is successful
type Strategy ¶
type Strategy interface { String() string ShouldFlush(moment Moment, t time.Time) bool Failure(t time.Time) Success() }
Strategy is deciding whether the data should be flushed or not at the given moment.
func StrategyFromString ¶
StrategyFromString returns a flush strategy from the given string. Possible values:
- end
- periodically[,milliseconds]