cockroach: github.com/cockroachdb/cockroach/pkg/util/ring Index | Files

package ring

import "github.com/cockroachdb/cockroach/pkg/util/ring"

Index

Package Files

ring_buffer.go

type Buffer Uses

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

Buffer is a deque maintained over a ring buffer. Note: it is backed by a slice (unlike container/ring one that is backed by a linked list).

func (*Buffer) AddFirst Uses

func (r *Buffer) AddFirst(element interface{})

AddFirst add element to the front of the deque and doubles it's underlying slice if necessary.

func (*Buffer) AddLast Uses

func (r *Buffer) AddLast(element interface{})

AddLast adds element to the end of the deque and doubles it's underlying slice if necessary.

func (Buffer) Get Uses

func (r Buffer) Get(pos int) interface{}

Get returns an element at position pos in the deque (zero-based).

func (Buffer) GetFirst Uses

func (r Buffer) GetFirst() interface{}

GetFirst returns an element at the front of the deque.

func (Buffer) GetLast Uses

func (r Buffer) GetLast() interface{}

GetLast returns an element at the front of the deque.

func (Buffer) Len Uses

func (r Buffer) Len() int

Len returns the number of elements in the deque.

func (*Buffer) RemoveFirst Uses

func (r *Buffer) RemoveFirst()

RemoveFirst removes a single element from the front of the deque.

func (*Buffer) RemoveLast Uses

func (r *Buffer) RemoveLast()

RemoveLast removes a single element from the end of the deque.

func (*Buffer) Reset Uses

func (r *Buffer) Reset()

Reset makes Buffer treat its underlying memory as if it were empty. This allows for reusing the same memory again without explicitly removing old elements.

Package ring is imported by 4 packages. Updated 2019-07-23. Refresh now. Tools for package owners.