Documentation ¶
Index ¶
- type ExecutorsMap
- func (m *ExecutorsMap) Load(tpid types.TopicID, lsid types.LogStreamID) (extor *logstream.Executor, loaded bool)
- func (m *ExecutorsMap) LoadAndDelete(tpid types.TopicID, lsid types.LogStreamID) (*logstream.Executor, bool)
- func (m *ExecutorsMap) LoadOrStore(tpid types.TopicID, lsid types.LogStreamID, extor *logstream.Executor) (actual *logstream.Executor, loaded bool)
- func (m *ExecutorsMap) Range(f func(types.LogStreamID, types.TopicID, *logstream.Executor) bool)
- func (m *ExecutorsMap) Size() int
- func (m *ExecutorsMap) Store(tpid types.TopicID, lsid types.LogStreamID, extor *logstream.Executor) (err error)
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 ¶
func (m *ExecutorsMap) Range(f func(types.LogStreamID, types.TopicID, *logstream.Executor) bool)
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.