counters

package
v0.0.0-...-bc12874 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PersistentAutoDecrementCounter

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

PersistentAutoDecrementCounter is an AutoDecrementCounter which uses a file in GCS to persist its value between program restarts.

func NewPersistentAutoDecrementCounter

func NewPersistentAutoDecrementCounter(ctx context.Context, gcsClient gcs.GCSClient, path string, d time.Duration) (*PersistentAutoDecrementCounter, error)

NewPersistentAutoDecrementCounter returns a PersistentAutoDecrementCounter instance using the given file.

func (*PersistentAutoDecrementCounter) Get

Get returns the current value of the PersistentAutoDecrementCounter.

func (*PersistentAutoDecrementCounter) GetDecrementTimes

func (c *PersistentAutoDecrementCounter) GetDecrementTimes() []time.Time

GetDecrementTimes returns a slice of time.Time which indicate *roughly* when the counter will be decremented. This is informational only, and the caller should not rely on the times to be perfectly accurate.

func (*PersistentAutoDecrementCounter) Inc

Inc increments the PersistentAutoDecrementCounter and schedules a decrement.

func (*PersistentAutoDecrementCounter) Reset

Reset resets the value of the PersistentAutoDecrementCounter to zero.

Jump to

Keyboard shortcuts

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