fsatomic

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error = Value[error]

type ErrorCounter added in v0.0.6

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

ErrorCounter 统计成功失败次数

func (*ErrorCounter) AddError added in v0.0.6

func (ec *ErrorCounter) AddError(err error)

func (*ErrorCounter) AddFail added in v0.0.6

func (ec *ErrorCounter) AddFail() int64

func (*ErrorCounter) AddFailN added in v0.0.6

func (ec *ErrorCounter) AddFailN(delta int64) int64

func (*ErrorCounter) AddSuccess added in v0.0.6

func (ec *ErrorCounter) AddSuccess() int64

func (*ErrorCounter) AddSuccessN added in v0.0.6

func (ec *ErrorCounter) AddSuccessN(delta int64) int64

func (*ErrorCounter) Fail added in v0.0.6

func (ec *ErrorCounter) Fail() int64

func (*ErrorCounter) Success added in v0.0.6

func (ec *ErrorCounter) Success() int64

type NumberInt32 added in v0.0.6

type NumberInt32[T ~int32] int32

func (*NumberInt32[T]) Add added in v0.0.6

func (n *NumberInt32[T]) Add(v T)

func (*NumberInt32[T]) CompareAndSwap added in v0.0.6

func (n *NumberInt32[T]) CompareAndSwap(old T, new T) (swapped bool)

func (*NumberInt32[T]) Load added in v0.0.6

func (n *NumberInt32[T]) Load() T

func (*NumberInt32[T]) Store added in v0.0.6

func (n *NumberInt32[T]) Store(v T)

func (*NumberInt32[T]) Swap added in v0.0.6

func (n *NumberInt32[T]) Swap(v T) (old T)

type NumberInt64 added in v0.0.6

type NumberInt64[T ~int64] int64

func (*NumberInt64[T]) Add added in v0.0.6

func (n *NumberInt64[T]) Add(v T)

func (*NumberInt64[T]) CompareAndSwap added in v0.0.6

func (n *NumberInt64[T]) CompareAndSwap(old T, new T) (swapped bool)

func (*NumberInt64[T]) Load added in v0.0.6

func (n *NumberInt64[T]) Load() T

func (*NumberInt64[T]) Store added in v0.0.6

func (n *NumberInt64[T]) Store(v T)

func (*NumberInt64[T]) Swap added in v0.0.6

func (n *NumberInt64[T]) Swap(v T) (old T)

type NumberUint32 added in v0.0.6

type NumberUint32[T ~uint32] uint32

func (*NumberUint32[T]) Add added in v0.0.6

func (n *NumberUint32[T]) Add(v T)

func (*NumberUint32[T]) CompareAndSwap added in v0.0.6

func (n *NumberUint32[T]) CompareAndSwap(old T, new T) (swapped bool)

func (*NumberUint32[T]) Load added in v0.0.6

func (n *NumberUint32[T]) Load() T

func (*NumberUint32[T]) Store added in v0.0.6

func (n *NumberUint32[T]) Store(v T)

func (*NumberUint32[T]) Swap added in v0.0.6

func (n *NumberUint32[T]) Swap(v T) (old T)

type NumberUint64 added in v0.0.6

type NumberUint64[T ~uint64] uint64

func (*NumberUint64[T]) Add added in v0.0.6

func (n *NumberUint64[T]) Add(v T)

func (*NumberUint64[T]) CompareAndSwap added in v0.0.6

func (n *NumberUint64[T]) CompareAndSwap(old T, new T) (swapped bool)

func (*NumberUint64[T]) Load added in v0.0.6

func (n *NumberUint64[T]) Load() T

func (*NumberUint64[T]) Store added in v0.0.6

func (n *NumberUint64[T]) Store(v T)

func (*NumberUint64[T]) Swap added in v0.0.6

func (n *NumberUint64[T]) Swap(v T) (old T)

type String

type String = Value[string]

type TimeDuration added in v0.0.6

type TimeDuration = NumberInt64[time.Duration]

type TimeStamp

type TimeStamp int64

TimeStamp atomic store for time stamp without time Location

func (*TimeStamp) After

func (at *TimeStamp) After(n time.Time) bool

After reports whether the time instant t is after u.

func (*TimeStamp) Before

func (at *TimeStamp) Before(n time.Time) bool

Before reports whether the time instant t is before u.

func (*TimeStamp) Load

func (at *TimeStamp) Load() time.Time

Load atomic load time

func (*TimeStamp) Since

func (at *TimeStamp) Since(n time.Time) time.Duration

Since returns the time elapsed since n.

func (*TimeStamp) Store

func (at *TimeStamp) Store(n time.Time)

Store atomic store time stamp

func (*TimeStamp) Sub

func (at *TimeStamp) Sub(n time.Time) time.Duration

Sub returns the duration t-n

type Value

type Value[T any] struct {
	// contains filtered or unexported fields
}

Value 存储值类型

func (*Value[T]) CompareAndSwap

func (a *Value[T]) CompareAndSwap(old, new T) (swapped bool)

CompareAndSwap atomically compare and swap

func (*Value[T]) Load

func (a *Value[T]) Load() T

Load atomically loads

func (*Value[T]) Store

func (a *Value[T]) Store(v T)

Store atomically store

func (*Value[T]) Swap

func (a *Value[T]) Swap(v T) T

Swap atomically swap

Jump to

Keyboard shortcuts

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