skipmap

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Introduction

skipmap is a high-performance concurrent map based on skip list. In typical pattern(one million operations, 90%LOAD 9%STORE 1%DELETE), the skipmap up to 3x ~ 10x faster than the built-in sync.Map.

The main idea behind the skipmap is A Simple Optimistic Skiplist Algorithm.

Different from the sync.Map, the items in the skipmap are always sorted, and the Load and Range operations are wait-free (A goroutine is guaranteed to complete a operation as long as it keeps taking steps, regardless of the activity of other goroutines).

Features

  • Concurrent safe API with high-performance.
  • Wait-free Load and Range operations.
  • Sorted items.

When should you use skipmap

In these situations, skipmap is better

  • Sorted elements is needed.
  • Concurrent calls multiple operations. such as use both Load and Store at the same time.

In these situations, sync.Map is better

  • Only one goroutine access the map for most of the time, such as insert a batch of elements and then use only Load (use built-in map is even better).

QuickStart

package main

import (
	"fmt"

	"github.com/songzhibin97/gkit/structure/skipmap"
)

func main() {
	l := skipmap.NewInt()

	for _, v := range []int{10, 12, 15} {
		l.Store(v, v+100)
	}

	v, ok := l.Load(10)
	if ok {
		fmt.Println("skipmap load 10 with value ", v)
	}

	l.Range(func(key int, value interface{}) bool {
		fmt.Println("skipmap range found ", key, value)
		return true
	})

	l.Delete(15)
	fmt.Printf("skipmap contains %d items\r\n", l.Len())
}

Benchmark

Go version: go1.16.2 linux/amd64

CPU: AMD 3700x(8C16T), running at 3.6GHz

OS: ubuntu 18.04

MEMORY: 16G x 2 (3200MHz)

benchmark

$ go test -run=NOTEST -bench=. -benchtime=100000x -benchmem -count=20 -timeout=60m  > x.txt
$ benchstat x.txt
name                                            time/op
Int64/Store/skipmap-16                           158ns ±12%
Int64/Store/sync.Map-16                          700ns ± 4%
Int64/Load50Hits/skipmap-16                     10.1ns ±14%
Int64/Load50Hits/sync.Map-16                    14.8ns ±23%
Int64/30Store70Load/skipmap-16                  50.6ns ±20%
Int64/30Store70Load/sync.Map-16                  592ns ± 7%
Int64/1Delete9Store90Load/skipmap-16            27.5ns ±13%
Int64/1Delete9Store90Load/sync.Map-16            480ns ± 4%
Int64/1Range9Delete90Store900Load/skipmap-16    34.2ns ±26%
Int64/1Range9Delete90Store900Load/sync.Map-16   1.00µs ±12%
String/Store/skipmap-16                          171ns ±15%
String/Store/sync.Map-16                         873ns ± 4%
String/Load50Hits/skipmap-16                    21.3ns ±38%
String/Load50Hits/sync.Map-16                   19.9ns ±12%
String/30Store70Load/skipmap-16                 75.6ns ±16%
String/30Store70Load/sync.Map-16                 726ns ± 5%
String/1Delete9Store90Load/skipmap-16           34.3ns ±20%
String/1Delete9Store90Load/sync.Map-16           584ns ± 5%
String/1Range9Delete90Store900Load/skipmap-16   41.0ns ±21%
String/1Range9Delete90Store900Load/sync.Map-16  1.17µs ± 8%

name                                            alloc/op
Int64/Store/skipmap-16                            112B ± 0%
Int64/Store/sync.Map-16                           128B ± 0%
Int64/Load50Hits/skipmap-16                      0.00B     
Int64/Load50Hits/sync.Map-16                     0.00B     
Int64/30Store70Load/skipmap-16                   33.0B ± 0%
Int64/30Store70Load/sync.Map-16                  81.2B ±11%
Int64/1Delete9Store90Load/skipmap-16             10.0B ± 0%
Int64/1Delete9Store90Load/sync.Map-16            57.9B ± 5%
Int64/1Range9Delete90Store900Load/skipmap-16     10.0B ± 0%
Int64/1Range9Delete90Store900Load/sync.Map-16     261B ±17%
String/Store/skipmap-16                           144B ± 0%
String/Store/sync.Map-16                          152B ± 0%
String/Load50Hits/skipmap-16                     15.0B ± 0%
String/Load50Hits/sync.Map-16                    15.0B ± 0%
String/30Store70Load/skipmap-16                  54.0B ± 0%
String/30Store70Load/sync.Map-16                 96.9B ±12%
String/1Delete9Store90Load/skipmap-16            27.0B ± 0%
String/1Delete9Store90Load/sync.Map-16           74.2B ± 4%
String/1Range9Delete90Store900Load/skipmap-16    27.0B ± 0%
String/1Range9Delete90Store900Load/sync.Map-16    257B ±10%

name                                            allocs/op
Int64/Store/skipmap-16                            3.00 ± 0%
Int64/Store/sync.Map-16                           4.00 ± 0%
Int64/Load50Hits/skipmap-16                       0.00     
Int64/Load50Hits/sync.Map-16                      0.00     
Int64/30Store70Load/skipmap-16                    0.00     
Int64/30Store70Load/sync.Map-16                   1.00 ± 0%
Int64/1Delete9Store90Load/skipmap-16              0.00     
Int64/1Delete9Store90Load/sync.Map-16             0.00     
Int64/1Range9Delete90Store900Load/skipmap-16      0.00     
Int64/1Range9Delete90Store900Load/sync.Map-16     0.00     
String/Store/skipmap-16                           4.00 ± 0%
String/Store/sync.Map-16                          5.00 ± 0%
String/Load50Hits/skipmap-16                      1.00 ± 0%
String/Load50Hits/sync.Map-16                     1.00 ± 0%
String/30Store70Load/skipmap-16                   1.00 ± 0%
String/30Store70Load/sync.Map-16                  2.00 ± 0%
String/1Delete9Store90Load/skipmap-16             1.00 ± 0%
String/1Delete9Store90Load/sync.Map-16            1.00 ± 0%
String/1Range9Delete90Store900Load/skipmap-16     1.00 ± 0%
String/1Range9Delete90Store900Load/sync.Map-16    1.00 ± 0%

Documentation

Overview

Package skipmap is a high-performance, scalable, concurrent-safe map based on skip-list. In the typical pattern(100000 operations, 90%LOAD 9%STORE 1%DELETE, 8C16T), the skipmap up to 10x faster than the built-in sync.Map.

Code generated by go run types_gen.go; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteMap added in v1.2.6

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

ByteMap represents a map based on skip list in ascending order.

func NewByte added in v1.2.6

func NewByte() *ByteMap

NewByte return an empty byte skipmap.

func (*ByteMap) Delete added in v1.2.6

func (s *ByteMap) Delete(key byte) bool

Delete deletes the value for a key.

func (*ByteMap) Len added in v1.2.6

func (s *ByteMap) Len() int

Len return the length of this skipmap.

func (*ByteMap) Load added in v1.2.6

func (s *ByteMap) Load(key byte) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*ByteMap) LoadAndDelete added in v1.2.6

func (s *ByteMap) LoadAndDelete(key byte) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*ByteMap) LoadOrStore added in v1.2.6

func (s *ByteMap) LoadOrStore(key byte, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*ByteMap) LoadOrStoreLazy added in v1.2.6

func (s *ByteMap) LoadOrStoreLazy(key byte, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*ByteMap) Range added in v1.2.6

func (s *ByteMap) Range(f func(key byte, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*ByteMap) Store added in v1.2.6

func (s *ByteMap) Store(key byte, value interface{})

Store sets the value for a key.

type ByteMapDesc added in v1.2.6

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

ByteMapDesc represents a map based on skip list in descending order.

func NewByteDesc added in v1.2.6

func NewByteDesc() *ByteMapDesc

NewByteDesc return an empty byte skipmap.

func (*ByteMapDesc) Delete added in v1.2.6

func (s *ByteMapDesc) Delete(key byte) bool

Delete deletes the value for a key.

func (*ByteMapDesc) Len added in v1.2.6

func (s *ByteMapDesc) Len() int

Len return the length of this skipmap.

func (*ByteMapDesc) Load added in v1.2.6

func (s *ByteMapDesc) Load(key byte) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*ByteMapDesc) LoadAndDelete added in v1.2.6

func (s *ByteMapDesc) LoadAndDelete(key byte) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*ByteMapDesc) LoadOrStore added in v1.2.6

func (s *ByteMapDesc) LoadOrStore(key byte, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*ByteMapDesc) LoadOrStoreLazy added in v1.2.6

func (s *ByteMapDesc) LoadOrStoreLazy(key byte, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*ByteMapDesc) Range added in v1.2.6

func (s *ByteMapDesc) Range(f func(key byte, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*ByteMapDesc) Store added in v1.2.6

func (s *ByteMapDesc) Store(key byte, value interface{})

Store sets the value for a key.

type Float32Map

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

Float32Map represents a map based on skip list in ascending order.

func NewFloat32

func NewFloat32() *Float32Map

NewFloat32 return an empty float32 skipmap.

func (*Float32Map) Delete

func (s *Float32Map) Delete(key float32) bool

Delete deletes the value for a key.

func (*Float32Map) Len

func (s *Float32Map) Len() int

Len return the length of this skipmap.

func (*Float32Map) Load

func (s *Float32Map) Load(key float32) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Float32Map) LoadAndDelete

func (s *Float32Map) LoadAndDelete(key float32) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Float32Map) LoadOrStore

func (s *Float32Map) LoadOrStore(key float32, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Float32Map) LoadOrStoreLazy

func (s *Float32Map) LoadOrStoreLazy(key float32, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Float32Map) Range

func (s *Float32Map) Range(f func(key float32, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Float32Map) Store

func (s *Float32Map) Store(key float32, value interface{})

Store sets the value for a key.

type Float32MapDesc

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

Float32MapDesc represents a map based on skip list in descending order.

func NewFloat32Desc

func NewFloat32Desc() *Float32MapDesc

NewFloat32Desc return an empty float32 skipmap.

func (*Float32MapDesc) Delete

func (s *Float32MapDesc) Delete(key float32) bool

Delete deletes the value for a key.

func (*Float32MapDesc) Len

func (s *Float32MapDesc) Len() int

Len return the length of this skipmap.

func (*Float32MapDesc) Load

func (s *Float32MapDesc) Load(key float32) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Float32MapDesc) LoadAndDelete

func (s *Float32MapDesc) LoadAndDelete(key float32) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Float32MapDesc) LoadOrStore

func (s *Float32MapDesc) LoadOrStore(key float32, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Float32MapDesc) LoadOrStoreLazy

func (s *Float32MapDesc) LoadOrStoreLazy(key float32, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Float32MapDesc) Range

func (s *Float32MapDesc) Range(f func(key float32, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Float32MapDesc) Store

func (s *Float32MapDesc) Store(key float32, value interface{})

Store sets the value for a key.

type Float64Map

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

Float64Map represents a map based on skip list in ascending order.

func NewFloat64

func NewFloat64() *Float64Map

NewFloat64 return an empty float64 skipmap.

func (*Float64Map) Delete

func (s *Float64Map) Delete(key float64) bool

Delete deletes the value for a key.

func (*Float64Map) Len

func (s *Float64Map) Len() int

Len return the length of this skipmap.

func (*Float64Map) Load

func (s *Float64Map) Load(key float64) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Float64Map) LoadAndDelete

func (s *Float64Map) LoadAndDelete(key float64) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Float64Map) LoadOrStore

func (s *Float64Map) LoadOrStore(key float64, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Float64Map) LoadOrStoreLazy

func (s *Float64Map) LoadOrStoreLazy(key float64, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Float64Map) Range

func (s *Float64Map) Range(f func(key float64, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Float64Map) Store

func (s *Float64Map) Store(key float64, value interface{})

Store sets the value for a key.

type Float64MapDesc

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

Float64MapDesc represents a map based on skip list in descending order.

func NewFloat64Desc

func NewFloat64Desc() *Float64MapDesc

NewFloat64Desc return an empty float64 skipmap.

func (*Float64MapDesc) Delete

func (s *Float64MapDesc) Delete(key float64) bool

Delete deletes the value for a key.

func (*Float64MapDesc) Len

func (s *Float64MapDesc) Len() int

Len return the length of this skipmap.

func (*Float64MapDesc) Load

func (s *Float64MapDesc) Load(key float64) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Float64MapDesc) LoadAndDelete

func (s *Float64MapDesc) LoadAndDelete(key float64) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Float64MapDesc) LoadOrStore

func (s *Float64MapDesc) LoadOrStore(key float64, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Float64MapDesc) LoadOrStoreLazy

func (s *Float64MapDesc) LoadOrStoreLazy(key float64, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Float64MapDesc) Range

func (s *Float64MapDesc) Range(f func(key float64, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Float64MapDesc) Store

func (s *Float64MapDesc) Store(key float64, value interface{})

Store sets the value for a key.

type Int16Map

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

Int16Map represents a map based on skip list in ascending order.

func NewInt16

func NewInt16() *Int16Map

NewInt16 return an empty int16 skipmap.

func (*Int16Map) Delete

func (s *Int16Map) Delete(key int16) bool

Delete deletes the value for a key.

func (*Int16Map) Len

func (s *Int16Map) Len() int

Len return the length of this skipmap.

func (*Int16Map) Load

func (s *Int16Map) Load(key int16) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int16Map) LoadAndDelete

func (s *Int16Map) LoadAndDelete(key int16) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int16Map) LoadOrStore

func (s *Int16Map) LoadOrStore(key int16, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int16Map) LoadOrStoreLazy

func (s *Int16Map) LoadOrStoreLazy(key int16, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int16Map) Range

func (s *Int16Map) Range(f func(key int16, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int16Map) Store

func (s *Int16Map) Store(key int16, value interface{})

Store sets the value for a key.

type Int16MapDesc

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

Int16MapDesc represents a map based on skip list in descending order.

func NewInt16Desc

func NewInt16Desc() *Int16MapDesc

NewInt16Desc return an empty int16 skipmap.

func (*Int16MapDesc) Delete

func (s *Int16MapDesc) Delete(key int16) bool

Delete deletes the value for a key.

func (*Int16MapDesc) Len

func (s *Int16MapDesc) Len() int

Len return the length of this skipmap.

func (*Int16MapDesc) Load

func (s *Int16MapDesc) Load(key int16) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int16MapDesc) LoadAndDelete

func (s *Int16MapDesc) LoadAndDelete(key int16) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int16MapDesc) LoadOrStore

func (s *Int16MapDesc) LoadOrStore(key int16, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int16MapDesc) LoadOrStoreLazy

func (s *Int16MapDesc) LoadOrStoreLazy(key int16, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int16MapDesc) Range

func (s *Int16MapDesc) Range(f func(key int16, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int16MapDesc) Store

func (s *Int16MapDesc) Store(key int16, value interface{})

Store sets the value for a key.

type Int32Map

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

Int32Map represents a map based on skip list in ascending order.

func NewInt32

func NewInt32() *Int32Map

NewInt32 return an empty int32 skipmap.

func (*Int32Map) Delete

func (s *Int32Map) Delete(key int32) bool

Delete deletes the value for a key.

func (*Int32Map) Len

func (s *Int32Map) Len() int

Len return the length of this skipmap.

func (*Int32Map) Load

func (s *Int32Map) Load(key int32) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int32Map) LoadAndDelete

func (s *Int32Map) LoadAndDelete(key int32) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int32Map) LoadOrStore

func (s *Int32Map) LoadOrStore(key int32, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int32Map) LoadOrStoreLazy

func (s *Int32Map) LoadOrStoreLazy(key int32, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int32Map) Range

func (s *Int32Map) Range(f func(key int32, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int32Map) Store

func (s *Int32Map) Store(key int32, value interface{})

Store sets the value for a key.

type Int32MapDesc

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

Int32MapDesc represents a map based on skip list in descending order.

func NewInt32Desc

func NewInt32Desc() *Int32MapDesc

NewInt32Desc return an empty int32 skipmap.

func (*Int32MapDesc) Delete

func (s *Int32MapDesc) Delete(key int32) bool

Delete deletes the value for a key.

func (*Int32MapDesc) Len

func (s *Int32MapDesc) Len() int

Len return the length of this skipmap.

func (*Int32MapDesc) Load

func (s *Int32MapDesc) Load(key int32) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int32MapDesc) LoadAndDelete

func (s *Int32MapDesc) LoadAndDelete(key int32) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int32MapDesc) LoadOrStore

func (s *Int32MapDesc) LoadOrStore(key int32, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int32MapDesc) LoadOrStoreLazy

func (s *Int32MapDesc) LoadOrStoreLazy(key int32, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int32MapDesc) Range

func (s *Int32MapDesc) Range(f func(key int32, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int32MapDesc) Store

func (s *Int32MapDesc) Store(key int32, value interface{})

Store sets the value for a key.

type Int64Map

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

Int64Map represents a map based on skip list in ascending order.

func NewInt64

func NewInt64() *Int64Map

NewInt64 return an empty int64 skipmap.

func (*Int64Map) Delete

func (s *Int64Map) Delete(key int64) bool

Delete deletes the value for a key.

func (*Int64Map) Len

func (s *Int64Map) Len() int

Len return the length of this skipmap.

func (*Int64Map) Load

func (s *Int64Map) Load(key int64) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int64Map) LoadAndDelete

func (s *Int64Map) LoadAndDelete(key int64) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int64Map) LoadOrStore

func (s *Int64Map) LoadOrStore(key int64, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int64Map) LoadOrStoreLazy

func (s *Int64Map) LoadOrStoreLazy(key int64, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int64Map) Range

func (s *Int64Map) Range(f func(key int64, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int64Map) Store

func (s *Int64Map) Store(key int64, value interface{})

Store sets the value for a key.

type Int8Map added in v1.2.6

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

Int8Map represents a map based on skip list in ascending order.

func NewInt8 added in v1.2.6

func NewInt8() *Int8Map

NewInt8 return an empty int8 skipmap.

func (*Int8Map) Delete added in v1.2.6

func (s *Int8Map) Delete(key int8) bool

Delete deletes the value for a key.

func (*Int8Map) Len added in v1.2.6

func (s *Int8Map) Len() int

Len return the length of this skipmap.

func (*Int8Map) Load added in v1.2.6

func (s *Int8Map) Load(key int8) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int8Map) LoadAndDelete added in v1.2.6

func (s *Int8Map) LoadAndDelete(key int8) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int8Map) LoadOrStore added in v1.2.6

func (s *Int8Map) LoadOrStore(key int8, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int8Map) LoadOrStoreLazy added in v1.2.6

func (s *Int8Map) LoadOrStoreLazy(key int8, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int8Map) Range added in v1.2.6

func (s *Int8Map) Range(f func(key int8, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int8Map) Store added in v1.2.6

func (s *Int8Map) Store(key int8, value interface{})

Store sets the value for a key.

type Int8MapDesc added in v1.2.6

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

Int8MapDesc represents a map based on skip list in descending order.

func NewInt8Desc added in v1.2.6

func NewInt8Desc() *Int8MapDesc

NewInt8Desc return an empty int8 skipmap.

func (*Int8MapDesc) Delete added in v1.2.6

func (s *Int8MapDesc) Delete(key int8) bool

Delete deletes the value for a key.

func (*Int8MapDesc) Len added in v1.2.6

func (s *Int8MapDesc) Len() int

Len return the length of this skipmap.

func (*Int8MapDesc) Load added in v1.2.6

func (s *Int8MapDesc) Load(key int8) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Int8MapDesc) LoadAndDelete added in v1.2.6

func (s *Int8MapDesc) LoadAndDelete(key int8) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Int8MapDesc) LoadOrStore added in v1.2.6

func (s *Int8MapDesc) LoadOrStore(key int8, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Int8MapDesc) LoadOrStoreLazy added in v1.2.6

func (s *Int8MapDesc) LoadOrStoreLazy(key int8, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Int8MapDesc) Range added in v1.2.6

func (s *Int8MapDesc) Range(f func(key int8, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Int8MapDesc) Store added in v1.2.6

func (s *Int8MapDesc) Store(key int8, value interface{})

Store sets the value for a key.

type IntMap

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

IntMap represents a map based on skip list in ascending order.

func NewInt

func NewInt() *IntMap

NewInt return an empty int skipmap.

func (*IntMap) Delete

func (s *IntMap) Delete(key int) bool

Delete deletes the value for a key.

func (*IntMap) Len

func (s *IntMap) Len() int

Len return the length of this skipmap.

func (*IntMap) Load

func (s *IntMap) Load(key int) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*IntMap) LoadAndDelete

func (s *IntMap) LoadAndDelete(key int) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*IntMap) LoadOrStore

func (s *IntMap) LoadOrStore(key int, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*IntMap) LoadOrStoreLazy

func (s *IntMap) LoadOrStoreLazy(key int, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*IntMap) Range

func (s *IntMap) Range(f func(key int, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*IntMap) Store

func (s *IntMap) Store(key int, value interface{})

Store sets the value for a key.

type IntMapDesc

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

IntMapDesc represents a map based on skip list in descending order.

func NewIntDesc

func NewIntDesc() *IntMapDesc

NewIntDesc return an empty int skipmap.

func (*IntMapDesc) Delete

func (s *IntMapDesc) Delete(key int) bool

Delete deletes the value for a key.

func (*IntMapDesc) Len

func (s *IntMapDesc) Len() int

Len return the length of this skipmap.

func (*IntMapDesc) Load

func (s *IntMapDesc) Load(key int) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*IntMapDesc) LoadAndDelete

func (s *IntMapDesc) LoadAndDelete(key int) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*IntMapDesc) LoadOrStore

func (s *IntMapDesc) LoadOrStore(key int, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*IntMapDesc) LoadOrStoreLazy

func (s *IntMapDesc) LoadOrStoreLazy(key int, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*IntMapDesc) Range

func (s *IntMapDesc) Range(f func(key int, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*IntMapDesc) Store

func (s *IntMapDesc) Store(key int, value interface{})

Store sets the value for a key.

type RuneMap added in v1.2.6

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

RuneMap represents a map based on skip list in ascending order.

func NewRune added in v1.2.6

func NewRune() *RuneMap

NewRune return an empty rune skipmap.

func (*RuneMap) Delete added in v1.2.6

func (s *RuneMap) Delete(key rune) bool

Delete deletes the value for a key.

func (*RuneMap) Len added in v1.2.6

func (s *RuneMap) Len() int

Len return the length of this skipmap.

func (*RuneMap) Load added in v1.2.6

func (s *RuneMap) Load(key rune) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*RuneMap) LoadAndDelete added in v1.2.6

func (s *RuneMap) LoadAndDelete(key rune) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*RuneMap) LoadOrStore added in v1.2.6

func (s *RuneMap) LoadOrStore(key rune, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*RuneMap) LoadOrStoreLazy added in v1.2.6

func (s *RuneMap) LoadOrStoreLazy(key rune, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*RuneMap) Range added in v1.2.6

func (s *RuneMap) Range(f func(key rune, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*RuneMap) Store added in v1.2.6

func (s *RuneMap) Store(key rune, value interface{})

Store sets the value for a key.

type RuneMapDesc added in v1.2.6

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

RuneMapDesc represents a map based on skip list in descending order.

func NewRuneDesc added in v1.2.6

func NewRuneDesc() *RuneMapDesc

NewRuneDesc return an empty rune skipmap.

func (*RuneMapDesc) Delete added in v1.2.6

func (s *RuneMapDesc) Delete(key rune) bool

Delete deletes the value for a key.

func (*RuneMapDesc) Len added in v1.2.6

func (s *RuneMapDesc) Len() int

Len return the length of this skipmap.

func (*RuneMapDesc) Load added in v1.2.6

func (s *RuneMapDesc) Load(key rune) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*RuneMapDesc) LoadAndDelete added in v1.2.6

func (s *RuneMapDesc) LoadAndDelete(key rune) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*RuneMapDesc) LoadOrStore added in v1.2.6

func (s *RuneMapDesc) LoadOrStore(key rune, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*RuneMapDesc) LoadOrStoreLazy added in v1.2.6

func (s *RuneMapDesc) LoadOrStoreLazy(key rune, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*RuneMapDesc) Range added in v1.2.6

func (s *RuneMapDesc) Range(f func(key rune, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*RuneMapDesc) Store added in v1.2.6

func (s *RuneMapDesc) Store(key rune, value interface{})

Store sets the value for a key.

type StringMap

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

StringMap represents a map based on skip list.

func NewString

func NewString() *StringMap

NewString return an empty int64 skipmap.

func (*StringMap) Delete

func (s *StringMap) Delete(key string) bool

Delete deletes the value for a key.

func (*StringMap) Len

func (s *StringMap) Len() int

Len return the length of this skipmap.

func (*StringMap) Load

func (s *StringMap) Load(key string) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*StringMap) LoadAndDelete

func (s *StringMap) LoadAndDelete(key string) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*StringMap) LoadOrStore

func (s *StringMap) LoadOrStore(key string, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*StringMap) LoadOrStoreLazy

func (s *StringMap) LoadOrStoreLazy(key string, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*StringMap) Range

func (s *StringMap) Range(f func(key string, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*StringMap) Store

func (s *StringMap) Store(key string, value interface{})

Store sets the value for a key.

type Uint16Map

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

Uint16Map represents a map based on skip list in ascending order.

func NewUint16

func NewUint16() *Uint16Map

NewUint16 return an empty uint16 skipmap.

func (*Uint16Map) Delete

func (s *Uint16Map) Delete(key uint16) bool

Delete deletes the value for a key.

func (*Uint16Map) Len

func (s *Uint16Map) Len() int

Len return the length of this skipmap.

func (*Uint16Map) Load

func (s *Uint16Map) Load(key uint16) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint16Map) LoadAndDelete

func (s *Uint16Map) LoadAndDelete(key uint16) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint16Map) LoadOrStore

func (s *Uint16Map) LoadOrStore(key uint16, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint16Map) LoadOrStoreLazy

func (s *Uint16Map) LoadOrStoreLazy(key uint16, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint16Map) Range

func (s *Uint16Map) Range(f func(key uint16, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint16Map) Store

func (s *Uint16Map) Store(key uint16, value interface{})

Store sets the value for a key.

type Uint16MapDesc

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

Uint16MapDesc represents a map based on skip list in descending order.

func NewUint16Desc

func NewUint16Desc() *Uint16MapDesc

NewUint16Desc return an empty uint16 skipmap.

func (*Uint16MapDesc) Delete

func (s *Uint16MapDesc) Delete(key uint16) bool

Delete deletes the value for a key.

func (*Uint16MapDesc) Len

func (s *Uint16MapDesc) Len() int

Len return the length of this skipmap.

func (*Uint16MapDesc) Load

func (s *Uint16MapDesc) Load(key uint16) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint16MapDesc) LoadAndDelete

func (s *Uint16MapDesc) LoadAndDelete(key uint16) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint16MapDesc) LoadOrStore

func (s *Uint16MapDesc) LoadOrStore(key uint16, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint16MapDesc) LoadOrStoreLazy

func (s *Uint16MapDesc) LoadOrStoreLazy(key uint16, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint16MapDesc) Range

func (s *Uint16MapDesc) Range(f func(key uint16, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint16MapDesc) Store

func (s *Uint16MapDesc) Store(key uint16, value interface{})

Store sets the value for a key.

type Uint32Map

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

Uint32Map represents a map based on skip list in ascending order.

func NewUint32

func NewUint32() *Uint32Map

NewUint32 return an empty uint32 skipmap.

func (*Uint32Map) Delete

func (s *Uint32Map) Delete(key uint32) bool

Delete deletes the value for a key.

func (*Uint32Map) Len

func (s *Uint32Map) Len() int

Len return the length of this skipmap.

func (*Uint32Map) Load

func (s *Uint32Map) Load(key uint32) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint32Map) LoadAndDelete

func (s *Uint32Map) LoadAndDelete(key uint32) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint32Map) LoadOrStore

func (s *Uint32Map) LoadOrStore(key uint32, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint32Map) LoadOrStoreLazy

func (s *Uint32Map) LoadOrStoreLazy(key uint32, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint32Map) Range

func (s *Uint32Map) Range(f func(key uint32, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint32Map) Store

func (s *Uint32Map) Store(key uint32, value interface{})

Store sets the value for a key.

type Uint32MapDesc

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

Uint32MapDesc represents a map based on skip list in descending order.

func NewUint32Desc

func NewUint32Desc() *Uint32MapDesc

NewUint32Desc return an empty uint32 skipmap.

func (*Uint32MapDesc) Delete

func (s *Uint32MapDesc) Delete(key uint32) bool

Delete deletes the value for a key.

func (*Uint32MapDesc) Len

func (s *Uint32MapDesc) Len() int

Len return the length of this skipmap.

func (*Uint32MapDesc) Load

func (s *Uint32MapDesc) Load(key uint32) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint32MapDesc) LoadAndDelete

func (s *Uint32MapDesc) LoadAndDelete(key uint32) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint32MapDesc) LoadOrStore

func (s *Uint32MapDesc) LoadOrStore(key uint32, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint32MapDesc) LoadOrStoreLazy

func (s *Uint32MapDesc) LoadOrStoreLazy(key uint32, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint32MapDesc) Range

func (s *Uint32MapDesc) Range(f func(key uint32, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint32MapDesc) Store

func (s *Uint32MapDesc) Store(key uint32, value interface{})

Store sets the value for a key.

type Uint64Map

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

Uint64Map represents a map based on skip list in ascending order.

func NewUint64

func NewUint64() *Uint64Map

NewUint64 return an empty uint64 skipmap.

func (*Uint64Map) Delete

func (s *Uint64Map) Delete(key uint64) bool

Delete deletes the value for a key.

func (*Uint64Map) Len

func (s *Uint64Map) Len() int

Len return the length of this skipmap.

func (*Uint64Map) Load

func (s *Uint64Map) Load(key uint64) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint64Map) LoadAndDelete

func (s *Uint64Map) LoadAndDelete(key uint64) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint64Map) LoadOrStore

func (s *Uint64Map) LoadOrStore(key uint64, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint64Map) LoadOrStoreLazy

func (s *Uint64Map) LoadOrStoreLazy(key uint64, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint64Map) Range

func (s *Uint64Map) Range(f func(key uint64, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint64Map) Store

func (s *Uint64Map) Store(key uint64, value interface{})

Store sets the value for a key.

type Uint64MapDesc

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

Uint64MapDesc represents a map based on skip list in descending order.

func NewUint64Desc

func NewUint64Desc() *Uint64MapDesc

NewUint64Desc return an empty uint64 skipmap.

func (*Uint64MapDesc) Delete

func (s *Uint64MapDesc) Delete(key uint64) bool

Delete deletes the value for a key.

func (*Uint64MapDesc) Len

func (s *Uint64MapDesc) Len() int

Len return the length of this skipmap.

func (*Uint64MapDesc) Load

func (s *Uint64MapDesc) Load(key uint64) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint64MapDesc) LoadAndDelete

func (s *Uint64MapDesc) LoadAndDelete(key uint64) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint64MapDesc) LoadOrStore

func (s *Uint64MapDesc) LoadOrStore(key uint64, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint64MapDesc) LoadOrStoreLazy

func (s *Uint64MapDesc) LoadOrStoreLazy(key uint64, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint64MapDesc) Range

func (s *Uint64MapDesc) Range(f func(key uint64, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint64MapDesc) Store

func (s *Uint64MapDesc) Store(key uint64, value interface{})

Store sets the value for a key.

type Uint8Map added in v1.2.6

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

Uint8Map represents a map based on skip list in ascending order.

func NewUint8 added in v1.2.6

func NewUint8() *Uint8Map

NewUint8 return an empty uint8 skipmap.

func (*Uint8Map) Delete added in v1.2.6

func (s *Uint8Map) Delete(key uint8) bool

Delete deletes the value for a key.

func (*Uint8Map) Len added in v1.2.6

func (s *Uint8Map) Len() int

Len return the length of this skipmap.

func (*Uint8Map) Load added in v1.2.6

func (s *Uint8Map) Load(key uint8) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint8Map) LoadAndDelete added in v1.2.6

func (s *Uint8Map) LoadAndDelete(key uint8) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint8Map) LoadOrStore added in v1.2.6

func (s *Uint8Map) LoadOrStore(key uint8, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint8Map) LoadOrStoreLazy added in v1.2.6

func (s *Uint8Map) LoadOrStoreLazy(key uint8, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint8Map) Range added in v1.2.6

func (s *Uint8Map) Range(f func(key uint8, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint8Map) Store added in v1.2.6

func (s *Uint8Map) Store(key uint8, value interface{})

Store sets the value for a key.

type Uint8MapDesc added in v1.2.6

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

Uint8MapDesc represents a map based on skip list in descending order.

func NewUint8Desc added in v1.2.6

func NewUint8Desc() *Uint8MapDesc

NewUint8Desc return an empty uint8 skipmap.

func (*Uint8MapDesc) Delete added in v1.2.6

func (s *Uint8MapDesc) Delete(key uint8) bool

Delete deletes the value for a key.

func (*Uint8MapDesc) Len added in v1.2.6

func (s *Uint8MapDesc) Len() int

Len return the length of this skipmap.

func (*Uint8MapDesc) Load added in v1.2.6

func (s *Uint8MapDesc) Load(key uint8) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*Uint8MapDesc) LoadAndDelete added in v1.2.6

func (s *Uint8MapDesc) LoadAndDelete(key uint8) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*Uint8MapDesc) LoadOrStore added in v1.2.6

func (s *Uint8MapDesc) LoadOrStore(key uint8, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*Uint8MapDesc) LoadOrStoreLazy added in v1.2.6

func (s *Uint8MapDesc) LoadOrStoreLazy(key uint8, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*Uint8MapDesc) Range added in v1.2.6

func (s *Uint8MapDesc) Range(f func(key uint8, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*Uint8MapDesc) Store added in v1.2.6

func (s *Uint8MapDesc) Store(key uint8, value interface{})

Store sets the value for a key.

type UintMap

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

UintMap represents a map based on skip list in ascending order.

func NewUint

func NewUint() *UintMap

NewUint return an empty uint skipmap.

func (*UintMap) Delete

func (s *UintMap) Delete(key uint) bool

Delete deletes the value for a key.

func (*UintMap) Len

func (s *UintMap) Len() int

Len return the length of this skipmap.

func (*UintMap) Load

func (s *UintMap) Load(key uint) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*UintMap) LoadAndDelete

func (s *UintMap) LoadAndDelete(key uint) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*UintMap) LoadOrStore

func (s *UintMap) LoadOrStore(key uint, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*UintMap) LoadOrStoreLazy

func (s *UintMap) LoadOrStoreLazy(key uint, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*UintMap) Range

func (s *UintMap) Range(f func(key uint, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*UintMap) Store

func (s *UintMap) Store(key uint, value interface{})

Store sets the value for a key.

type UintMapDesc

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

UintMapDesc represents a map based on skip list in descending order.

func NewUintDesc

func NewUintDesc() *UintMapDesc

NewUintDesc return an empty uint skipmap.

func (*UintMapDesc) Delete

func (s *UintMapDesc) Delete(key uint) bool

Delete deletes the value for a key.

func (*UintMapDesc) Len

func (s *UintMapDesc) Len() int

Len return the length of this skipmap.

func (*UintMapDesc) Load

func (s *UintMapDesc) Load(key uint) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*UintMapDesc) LoadAndDelete

func (s *UintMapDesc) LoadAndDelete(key uint) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*UintMapDesc) LoadOrStore

func (s *UintMapDesc) LoadOrStore(key uint, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*UintMapDesc) LoadOrStoreLazy

func (s *UintMapDesc) LoadOrStoreLazy(key uint, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*UintMapDesc) Range

func (s *UintMapDesc) Range(f func(key uint, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*UintMapDesc) Store

func (s *UintMapDesc) Store(key uint, value interface{})

Store sets the value for a key.

type UintptrMap added in v1.2.6

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

UintptrMap represents a map based on skip list in ascending order.

func NewUintptr added in v1.2.6

func NewUintptr() *UintptrMap

NewUintptr return an empty uintptr skipmap.

func (*UintptrMap) Delete added in v1.2.6

func (s *UintptrMap) Delete(key uintptr) bool

Delete deletes the value for a key.

func (*UintptrMap) Len added in v1.2.6

func (s *UintptrMap) Len() int

Len return the length of this skipmap.

func (*UintptrMap) Load added in v1.2.6

func (s *UintptrMap) Load(key uintptr) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*UintptrMap) LoadAndDelete added in v1.2.6

func (s *UintptrMap) LoadAndDelete(key uintptr) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*UintptrMap) LoadOrStore added in v1.2.6

func (s *UintptrMap) LoadOrStore(key uintptr, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*UintptrMap) LoadOrStoreLazy added in v1.2.6

func (s *UintptrMap) LoadOrStoreLazy(key uintptr, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*UintptrMap) Range added in v1.2.6

func (s *UintptrMap) Range(f func(key uintptr, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*UintptrMap) Store added in v1.2.6

func (s *UintptrMap) Store(key uintptr, value interface{})

Store sets the value for a key.

type UintptrMapDesc added in v1.2.6

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

UintptrMapDesc represents a map based on skip list in descending order.

func NewUintptrDesc added in v1.2.6

func NewUintptrDesc() *UintptrMapDesc

NewUintptrDesc return an empty uintptr skipmap.

func (*UintptrMapDesc) Delete added in v1.2.6

func (s *UintptrMapDesc) Delete(key uintptr) bool

Delete deletes the value for a key.

func (*UintptrMapDesc) Len added in v1.2.6

func (s *UintptrMapDesc) Len() int

Len return the length of this skipmap.

func (*UintptrMapDesc) Load added in v1.2.6

func (s *UintptrMapDesc) Load(key uintptr) (value interface{}, ok bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*UintptrMapDesc) LoadAndDelete added in v1.2.6

func (s *UintptrMapDesc) LoadAndDelete(key uintptr) (value interface{}, loaded bool)

LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present. (Modified from Delete)

func (*UintptrMapDesc) LoadOrStore added in v1.2.6

func (s *UintptrMapDesc) LoadOrStore(key uintptr, value interface{}) (actual interface{}, loaded bool)

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored. (Modified from Store)

func (*UintptrMapDesc) LoadOrStoreLazy added in v1.2.6

func (s *UintptrMapDesc) LoadOrStoreLazy(key uintptr, f func() interface{}) (actual interface{}, loaded bool)

LoadOrStoreLazy returns the existing value for the key if present. Otherwise, it stores and returns the given value from f, f will only be called once. The loaded result is true if the value was loaded, false if stored. (Modified from LoadOrStore)

func (*UintptrMapDesc) Range added in v1.2.6

func (s *UintptrMapDesc) Range(f func(key uintptr, value interface{}) bool)

Range calls f sequentially for each key and value present in the skipmap. If f returns false, range stops the iteration.

Range does not necessarily correspond to any consistent snapshot of the Map's contents: no key will be visited more than once, but if the value for any key is stored or deleted concurrently, Range may reflect any mapping for that key from any point during the Range call.

func (*UintptrMapDesc) Store added in v1.2.6

func (s *UintptrMapDesc) Store(key uintptr, value interface{})

Store sets the value for a key.

Jump to

Keyboard shortcuts

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