rings

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

README

rings

the thread safe ring typed container without locker

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	Key() (key string)
}

type HashRing added in v1.1.0

type HashRing[E Entry] struct {
	// contains filtered or unexported fields
}

func NewHashed added in v1.1.0

func NewHashed[E Entry](entries ...E) (v *HashRing[E])

func (*HashRing[E]) Add added in v1.1.0

func (r *HashRing[E]) Add(entry E) (prevActive E, cLow uint64, cHigh uint64, active func(), cancel func(), ok bool)

func (*HashRing[E]) AddDeclared added in v1.1.1

func (r *HashRing[E]) AddDeclared(entry E, low uint64, high uint64) (ok bool)

func (*HashRing[E]) Get added in v1.1.0

func (r *HashRing[E]) Get(key []byte) (entry E, has bool)

func (*HashRing[E]) Size added in v1.1.0

func (r *HashRing[E]) Size() (n int)

func (*HashRing[E]) State added in v1.1.1

func (r *HashRing[E]) State(key string) (active bool, low uint64, high uint64, has bool)

func (*HashRing[E]) States added in v1.1.1

func (r *HashRing[E]) States(fn func(key string, active bool, low uint64, high uint64) bool)

func (*HashRing[E]) String added in v1.1.0

func (r *HashRing[E]) String() (s string)

type HashRingEntries added in v1.1.0

type HashRingEntries[E Entry] []*HashRingEntry[E]

func (HashRingEntries[E]) BiggestRangeAndActiveOne added in v1.1.0

func (entries HashRingEntries[E]) BiggestRangeAndActiveOne() (entry *HashRingEntry[E])

func (HashRingEntries[E]) Get added in v1.1.0

func (entries HashRingEntries[E]) Get(n uint64) (entry *HashRingEntry[E], has bool)

func (HashRingEntries[E]) Len added in v1.1.0

func (entries HashRingEntries[E]) Len() int

func (HashRingEntries[E]) Less added in v1.1.0

func (entries HashRingEntries[E]) Less(i, j int) bool

func (HashRingEntries[E]) Swap added in v1.1.0

func (entries HashRingEntries[E]) Swap(i, j int)

type HashRingEntry added in v1.1.0

type HashRingEntry[E Entry] struct {
	Entry  E
	Active bool
	Low    uint64
	High   uint64
}

func (*HashRingEntry[E]) Less added in v1.1.0

func (entry *HashRingEntry[E]) Less(o *HashRingEntry[E]) bool

func (*HashRingEntry[E]) RangeSize added in v1.1.0

func (entry *HashRingEntry[E]) RangeSize() uint64

func (*HashRingEntry[E]) String added in v1.1.0

func (entry *HashRingEntry[E]) String() (s string)

type ImmutableRing

type ImmutableRing[E Entry] struct {
	// contains filtered or unexported fields
}

func NewImmutable

func NewImmutable[E Entry](key string, values []E) (r *ImmutableRing[E])

func (*ImmutableRing[E]) Get

func (r *ImmutableRing[E]) Get(key string) (value E, has bool)

func (*ImmutableRing[E]) Head

func (r *ImmutableRing[E]) Head() (value E, has bool)

func (*ImmutableRing[E]) Key

func (r *ImmutableRing[E]) Key() (key string)

func (*ImmutableRing[E]) Next

func (r *ImmutableRing[E]) Next() (value E)

func (*ImmutableRing[E]) String

func (r *ImmutableRing[E]) String() (value string)

type RangeSizeSortedHashRingEntries added in v1.1.0

type RangeSizeSortedHashRingEntries[E Entry] []*HashRingEntry[E]

func (RangeSizeSortedHashRingEntries[E]) Len added in v1.1.0

func (entries RangeSizeSortedHashRingEntries[E]) Len() int

func (RangeSizeSortedHashRingEntries[E]) Less added in v1.1.0

func (entries RangeSizeSortedHashRingEntries[E]) Less(i, j int) bool

func (RangeSizeSortedHashRingEntries[E]) Swap added in v1.1.0

func (entries RangeSizeSortedHashRingEntries[E]) Swap(i, j int)

type Ring

type Ring[E Entry] struct {
	// contains filtered or unexported fields
}

func New

func New[E Entry](key string, values ...E) (r *Ring[E])

func (*Ring[E]) Get

func (r *Ring[E]) Get(key string) (value E, has bool)

func (*Ring[E]) Head

func (r *Ring[E]) Head() (value E, has bool)

func (*Ring[E]) Key

func (r *Ring[E]) Key() (key string)

func (*Ring[E]) Len

func (r *Ring[E]) Len() (size int)

func (*Ring[E]) Next

func (r *Ring[E]) Next() (value E)

func (*Ring[E]) Pop

func (r *Ring[E]) Pop() (e E, ok bool)

func (*Ring[E]) Push

func (r *Ring[E]) Push(v E) (ok bool)

func (*Ring[E]) Remove

func (r *Ring[E]) Remove(key string)

func (*Ring[E]) SeekTo

func (r *Ring[E]) SeekTo(key string) (has bool)

func (*Ring[E]) String

func (r *Ring[E]) String() (value string)

type Sequence

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

func NewSequence

func NewSequence() (seq *Sequence)

func (*Sequence) Next

func (seq *Sequence) Next() (n uint32)

func (*Sequence) Value

func (seq *Sequence) Value() (n uint32)

Jump to

Keyboard shortcuts

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