atomichandlers

package
v0.18.8 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSwapTries max tries for swaping timestamp
	DefaultSwapTries = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicCounter

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

AtomicCounter atomic integer counter

func (*AtomicCounter) Add

func (value *AtomicCounter) Add(u uint64) uint64

Add value to counter

func (*AtomicCounter) CompareAndSwap

func (value *AtomicCounter) CompareAndSwap(old, new uint64) bool

SwapAndCompare new value, returns false without updating to new value if old value no longer the same

func (*AtomicCounter) Current

func (value *AtomicCounter) Current() uint64

Current value of counter

func (*AtomicCounter) Dec

func (value *AtomicCounter) Dec() uint64

Dec decrease the counter by 1

func (*AtomicCounter) Inc

func (value *AtomicCounter) Inc() uint64

Inc increase counter by 1

func (*AtomicCounter) Reset

func (value *AtomicCounter) Reset()

Reset counter to 0

func (*AtomicCounter) String

func (value *AtomicCounter) String() string

String representation of counter

type AtomicTimeStamp

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

AtomicTimeStamp goroutine safe timestamp

func (*AtomicTimeStamp) Current

func (ats *AtomicTimeStamp) Current() time.Time

Current timestamp

func (*AtomicTimeStamp) Reset

func (ats *AtomicTimeStamp) Reset()

Reset timestamp to zero

func (*AtomicTimeStamp) Set

func (ats *AtomicTimeStamp) Set(ts time.Time)

Set new timestamp

func (*AtomicTimeStamp) SetIfNewer

func (ats *AtomicTimeStamp) SetIfNewer(ts time.Time) error

SetIfNewer set new timestamp if new than current

func (*AtomicTimeStamp) SetIfOlder

func (ats *AtomicTimeStamp) SetIfOlder(ts time.Time) error

SetIfOlder set new timestamp if older than current

Jump to

Keyboard shortcuts

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