Documentation
¶
Overview ¶
Package buffer
(C) Copyright Alex Gaetano Padula
Licensed under the Mozilla Public License, v. 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.mozilla.org/en-US/MPL/2.0/
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type Buffer
- func (buff *Buffer) Add(item interface{}) (int64, error)
- func (buff *Buffer) Capacity() int64
- func (buff *Buffer) Count() int64
- func (buff *Buffer) ForEach(f func(slot int64, item interface{}) bool)
- func (buff *Buffer) Get(slot int64) (interface{}, error)
- func (buff *Buffer) IsEmpty() bool
- func (buff *Buffer) IsFull() bool
- func (buff *Buffer) List() []interface{}
- func (buff *Buffer) Remove(slot int64) error
- func (buff *Buffer) Update(slot int64, newValue interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a concurrent lock-free buffer with ID/Slot-based access
func (*Buffer) ForEach ¶
ForEach applies function f to each item in the buffer Returns early if f returns false *This is not atomic across all slots
func (*Buffer) List ¶
func (buff *Buffer) List() []interface{}
List returns a snapshot of all non-nil values in the buffer *This is not atomic across all slots, so it provides a point-in-time view