sync

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StripedChannel

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

StripedChannel is a partitioned channel that consistently maps a key space to a set of channels.

func NewStripedChannel

func NewStripedChannel(count, queueSize uint) *StripedChannel

NewStripedChannel returns a new StripedChannel with a static number of channels.

func (*StripedChannel) BlockingSend

func (c *StripedChannel) BlockingSend(key []byte, value interface{})

BlockingSend is a blocking variation of Send.

func (*StripedChannel) Close

func (c *StripedChannel) Close()

Close closes all underlying channels.

func (*StripedChannel) GetChannels

func (c *StripedChannel) GetChannels() []<-chan interface{}

GetChannels returns the set of all receiver channels.

func (*StripedChannel) Send

func (c *StripedChannel) Send(key []byte, value interface{}) bool

Send sends the value to the channel that maps to the key. It is non-blocking and returns whether the value was put on the channel.

type StripedLock

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

StripedLock is a partitioned locking mechanism that consistently maps a key space to a set of locks. This provides concurrent data access while also limiting the total memory footprint.

func NewStripedLock

func NewStripedLock(stripes uint) *StripedLock

NewStripedLock returns a new StripedLock with a static number of stripes.

func (*StripedLock) Get

func (l *StripedLock) Get(key []byte) *base.RWMutex

Get gets the lock for a key

Jump to

Keyboard shortcuts

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