atom

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Unlicense, ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	*atomic.String
	ForNet *chaincfg.Params
}

Address is an atomic wrapper around util.Address

func NewAddress

func NewAddress(tt btcaddr.Address, forNet *chaincfg.Params) *Address

NewAddress creates a Hash.

func (*Address) Load

func (at *Address) Load() btcaddr.Address

Load atomically loads the wrapped value.

func (*Address) Store

func (at *Address) Store(h btcaddr.Address)

Store atomically stores the passed value. The passed value is copied so further mutations are not propagated.

func (*Address) Swap

func (at *Address) Swap(n btcaddr.Address) btcaddr.Address

Swap atomically swaps the wrapped util.Address and returns the old value.

type Bool

type Bool struct{ *atomic.Bool }

import all the atomics from uber atomic

type Duration

type Duration struct{ *atomic.Duration }

import all the atomics from uber atomic

type Float64

type Float64 struct{ *atomic.Float64 }

import all the atomics from uber atomic

type Hash

type Hash struct {
	*Value
}

Hash is an atomic wrapper around chainhash.Hash Note that there isn't really any reason to have CAS or arithmetic or comparisons as it is fine to do these non-atomically between Load / Store and they are (slightly) long operations)

func NewHash

func NewHash(tt chainhash.Hash) *Hash

NewHash creates a Hash.

func (*Hash) Load

func (at *Hash) Load() chainhash.Hash

Load atomically loads the wrapped value. The returned value copied so as to prevent mutation by concurrent users of the atomic, as arrays, slices and maps are pass-by-reference variables

func (*Hash) Store

func (at *Hash) Store(h chainhash.Hash)

Store atomically stores the passed value. The passed value is copied so further mutations are not propagated.

func (*Hash) Swap

func (at *Hash) Swap(n chainhash.Hash) chainhash.Hash

Swap atomically swaps the wrapped chainhash.Hash and returns the old value.

type Int32

type Int32 struct{ *atomic.Int32 }

import all the atomics from uber atomic

type Int64

type Int64 struct{ *atomic.Int64 }

import all the atomics from uber atomic

type ListTransactionsResult

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

ListTransactionsResult is an atomic wrapper around []btcjson.ListTransactionsResult

func NewListTransactionsResult

func NewListTransactionsResult(ltr []btcjson.ListTransactionsResult) *ListTransactionsResult

NewListTransactionsResult creates a btcjson.ListTransactionsResult.

func (*ListTransactionsResult) Len

func (at *ListTransactionsResult) Len() int

Len returns the length of the []btcjson.ListTransactionsResult

func (*ListTransactionsResult) Load

Load atomically loads the wrapped value. Note that it is copied and the stored value remains as it is

func (*ListTransactionsResult) Store

Store atomically stores the passed value. Note that it is copied and the passed value remains as it is

func (*ListTransactionsResult) Swap

Swap atomically swaps the wrapped chainhash.ListTransactionsResult and returns the old value.

type Time

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

Time is an atomic wrapper around time.Time https://godoc.org/time#Time

func NewTime

func NewTime(tt time.Time) *Time

NewTime creates a Time.

func (*Time) Add

func (at *Time) Add(n time.Time) time.Time

Add atomically adds to the wrapped time.Duration and returns the new value.

func (*Time) CAS

func (at *Time) CAS(old, new time.Time) bool

CAS is an atomic compare-and-swap.

func (*Time) Load

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

Load atomically loads the wrapped value.

func (*Time) Store

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

Store atomically stores the passed value.

func (*Time) Sub

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

Sub atomically subtracts from the wrapped time.Duration and returns the new value.

func (*Time) Swap

func (at *Time) Swap(n time.Time) time.Time

Swap atomically swaps the wrapped time.Duration and returns the old value.

type Uint32

type Uint32 struct{ *atomic.Uint32 }

import all the atomics from uber atomic

type Uint64

type Uint64 struct{ *atomic.Uint64 }

import all the atomics from uber atomic

type Value

type Value struct{ *atomic.Value }

import all the atomics from uber atomic

Jump to

Keyboard shortcuts

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