datastructure

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Golang的list简直就是辣鸡

Index

Constants

This section is empty.

Variables

View Source
var OutOfCapacity = errors.New("Out of capacity")

Functions

This section is empty.

Types

type CircleArray

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

func (*CircleArray) Append

func (a *CircleArray) Append(v interface{}) error

func (*CircleArray) Get

func (a *CircleArray) Get(index int) interface{}

func (*CircleArray) Init

func (a *CircleArray) Init(size int)

func (*CircleArray) Len

func (a *CircleArray) Len() int

func (*CircleArray) Pop

func (a *CircleArray) Pop() interface{}

func (*CircleArray) Push

func (a *CircleArray) Push(v interface{})

func (*CircleArray) Put

func (a *CircleArray) Put(index int, v interface{})

func (*CircleArray) Resize

func (a *CircleArray) Resize(size int)

type Element

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

type Iterator

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

func (*Iterator) Empty

func (it *Iterator) Empty() bool

func (*Iterator) Next

func (it *Iterator) Next()

func (*Iterator) Value

func (it *Iterator) Value() interface{}

type LeakyBucket

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

func (*LeakyBucket) Acquire

func (b *LeakyBucket) Acquire(size uint64) bool

func (*LeakyBucket) Close

func (b *LeakyBucket) Close()

func (*LeakyBucket) Init

func (b *LeakyBucket) Init(rate uint64)

func (*LeakyBucket) SetRate

func (b *LeakyBucket) SetRate(rate uint64)

type LinkedList

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

func (*LinkedList) Iterator

func (q *LinkedList) Iterator() Iterator

func (*LinkedList) Len

func (q *LinkedList) Len() int

func (*LinkedList) PopFront

func (q *LinkedList) PopFront() interface{}

func (*LinkedList) PushBack

func (q *LinkedList) PushBack(v interface{})

func (*LinkedList) PushFront

func (q *LinkedList) PushFront(v interface{})

func (*LinkedList) Remove

func (q *LinkedList) Remove(filter func(interface{}) bool)

type SpinLock

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

SpinLock implements a simple atomic spin lock, the zero value for a SpinLock is an unlocked spinlock.

func (*SpinLock) Lock

func (sl *SpinLock) Lock()

Lock locks sl. If the lock is already in use, the caller blocks until Unlock is called

func (*SpinLock) String

func (sl *SpinLock) String() string

func (*SpinLock) TryLock

func (sl *SpinLock) TryLock() bool

TryLock will try to lock sl and return whether it succeed or not without blocking.

func (*SpinLock) Unlock

func (sl *SpinLock) Unlock()

Unlock unlocks sl, unlike [Mutex.Unlock](http://golang.org/pkg/sync/#Mutex.Unlock), there's no harm calling it on an unlocked SpinLock

Jump to

Keyboard shortcuts

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