atomic

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ordinal

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

Ordinal holds a global a value and can only be initialized once

func NewOrdinal

func NewOrdinal() *Ordinal

NewOrdinal returns ordinal with once setup

func (*Ordinal) GetOrdinal

func (o *Ordinal) GetOrdinal() uint64

GetOrdinal will return the current ordinal

func (*Ordinal) Increment

func (o *Ordinal) Increment()

Increment will increment the current ordinal

func (*Ordinal) Init

func (o *Ordinal) Init(val uint64)

Init sets the ordinal value can only be done once

type SafeMap

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

SafeMap uses a mutex to allow getting and setting in a thread-safe way

func NewSafeMap

func NewSafeMap() SafeMap

NewSafeMap creates a SafeMap

func (*SafeMap) Get

func (t *SafeMap) Get(key string) (string, error)

Get uses a RW lock and gets the value if it exists, otherwise an error is returned

func (*SafeMap) Set

func (t *SafeMap) Set(key, value string)

Set uses a write lock and sets the value given a key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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