Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StrictMonotonousCounter ¶
type StrictMonotonousCounter struct {
// contains filtered or unexported fields
}
StrictMonotonousCounter is a helper struct which implements a strict monotonous counter. StrictMonotonousCounter is implemented using atomic operations and doesn't allow to set a value which is lower or equal to the already stored one. The counter is implemented solely with non-blocking atomic operations for concurrency safety.
func NewMonotonousCounter ¶
func NewMonotonousCounter(initialValue uint64) StrictMonotonousCounter
NewMonotonousCounter creates new counter with initial value
func (*StrictMonotonousCounter) Set ¶
func (c *StrictMonotonousCounter) Set(newValue uint64) bool
Set updates value of counter if and only if it's strictly larger than value which is already stored. Returns true if update was successful or false if stored value is larger.
func (*StrictMonotonousCounter) Value ¶
func (c *StrictMonotonousCounter) Value() uint64
Value returns value which is stored in atomic variable
Click to show internal directories.
Click to hide internal directories.