executorsmap

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutorsMap

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

ExecutorsMap is a sorted map that maps pairs of LogStreamID and TopicID to executors. It is safe for concurrent use by multiple goroutines.

func New

func New(initSize int) *ExecutorsMap

New returns a new ExecutorsMap with an initial size of initSize.

func (*ExecutorsMap) Load

func (m *ExecutorsMap) Load(tpid types.TopicID, lsid types.LogStreamID) (extor *logstream.Executor, loaded bool)

Load returns the executor stored in the map for a lsid, or nil if the executor is not present.

func (*ExecutorsMap) LoadAndDelete

func (m *ExecutorsMap) LoadAndDelete(tpid types.TopicID, lsid types.LogStreamID) (*logstream.Executor, bool)

LoadAndDelete deletes the executor for a lsid, and returns the old executor. The loaded result is true if the executor is loaded, otherwise, false.

func (*ExecutorsMap) LoadOrStore

func (m *ExecutorsMap) LoadOrStore(tpid types.TopicID, lsid types.LogStreamID, extor *logstream.Executor) (actual *logstream.Executor, loaded bool)

LoadOrStore returns the existing executor for the lsid if present. If not, it stores the executor. The loaded result is true if the executor is loaded, otherwise, false.

func (*ExecutorsMap) Range

Range calls f in order by LogStreamID for each executor in the map.

func (*ExecutorsMap) Size

func (m *ExecutorsMap) Size() int

Size returns the number of elements in the ExecutorsMap.

func (*ExecutorsMap) Store

func (m *ExecutorsMap) Store(tpid types.TopicID, lsid types.LogStreamID, extor *logstream.Executor) (err error)

Store stores the executor for a lsid. Setting nil as an executor is also possible. However, overwriting a non-nil executor is not possible.

Jump to

Keyboard shortcuts

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