gosync

package module
v0.0.0-...-d883876 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(fn ...func() error) error

func Do

func Do(fn ...func())

Types

type Cache

type Cache struct {
	Map
	Limit int
}

func NewCache

func NewCache(size int) *Cache

func (*Cache) Set

func (m *Cache) Set(key, value interface{})

type CallGroup

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

func (*CallGroup) Add

func (c *CallGroup) Add(fn func() error) *CallGroup

func (*CallGroup) Wait

func (c *CallGroup) Wait() error

type Map

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

A Map is a set of temporary objects that may be individually set, get and deleted.

A Map is safe for use by multiple goroutines simultaneously.

func NewMap

func NewMap(values map[interface{}]interface{}) Map

func (*Map) BinaryDecode

func (m *Map) BinaryDecode(r io.Reader) (err error)

func (*Map) BinaryEncode

func (m *Map) BinaryEncode(w io.Writer) error

func (*Map) Clear

func (m *Map) Clear()

func (*Map) Delete

func (m *Map) Delete(key interface{})

func (*Map) Exists

func (m *Map) Exists(key interface{}) bool

func (*Map) Get

func (m *Map) Get(key interface{}) interface{}

func (*Map) Increment

func (m *Map) Increment(key interface{}, val int64) int64

func (*Map) KeyValues

func (m *Map) KeyValues() map[interface{}]interface{}

func (*Map) Keys

func (m *Map) Keys() []interface{}

func (*Map) Pop

func (m *Map) Pop() (key, value interface{})

func (*Map) PopAll

func (m *Map) PopAll() (values map[interface{}]interface{})

func (*Map) Random

func (m *Map) Random() (key, value interface{})

func (*Map) RandomKey

func (m *Map) RandomKey() interface{}

func (*Map) RandomValue

func (m *Map) RandomValue() interface{}

func (*Map) Set

func (m *Map) Set(key, value interface{})

func (*Map) Size

func (m *Map) Size() int

func (*Map) String

func (m *Map) String() string

func (*Map) Strings

func (m *Map) Strings() []string

func (*Map) Values

func (m *Map) Values() []interface{}

func (*Map) Version

func (m *Map) Version() uint64

type MutexMap

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

func (*MutexMap) Lock

func (m *MutexMap) Lock(key interface{})

func (*MutexMap) Unlock

func (m *MutexMap) Unlock(key interface{})

type Pool

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

func NewPool

func NewPool() *Pool

func (*Pool) Clear

func (q *Pool) Clear()

func (*Pool) Pop

func (q *Pool) Pop() (val interface{})

func (*Pool) PopAll

func (q *Pool) PopAll() (vals []interface{})

func (*Pool) Push

func (q *Pool) Push(value interface{})

func (*Pool) Size

func (q *Pool) Size() int

func (*Pool) String

func (q *Pool) String() string

func (*Pool) Strings

func (q *Pool) Strings() []string

func (*Pool) Values

func (q *Pool) Values() []interface{}

type Stack

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

func (*Stack) Clear

func (s *Stack) Clear()

func (*Stack) Pop

func (s *Stack) Pop() (val interface{})

func (*Stack) PopAll

func (s *Stack) PopAll() (vals []interface{})

func (*Stack) Push

func (s *Stack) Push(value interface{})

func (*Stack) Size

func (s *Stack) Size() int

func (*Stack) Values

func (s *Stack) Values() []interface{}

type Trigger

type Trigger chan struct{}

Trigger is asynchronous event.

func NewTrigger

func NewTrigger() Trigger

NewTrigger makes asynchronous event

func (Trigger) AfterTriggeredStart

func (t Trigger) AfterTriggeredStart(fn func())

func (Trigger) Set

func (t Trigger) Set(v bool)

func (Trigger) Trigger

func (t Trigger) Trigger()

Done triggers the event. It can be called only once.

func (Trigger) Wait

func (t Trigger) Wait()

Wait waits when the event happens.

Jump to

Keyboard shortcuts

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