incmap

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package incmap implements a write-only lock free map

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is a write-only lock free map. Its implementation is simplified by not supplying a way of deleting keys. It is also a fixed size. Keys are assigned using linear probing.

func New

func New(l int) *Map

New creates a Map with the size l.

func (*Map) Get

func (m *Map) Get(k uint64) (uint64, bool)

Get retrieves the value stored against key k. The second return value will be false if the key could not be found in the map.

func (*Map) Inc

func (m *Map) Inc(k uint64, d uint64) bool

Inc increments the value stored against key k by amount d. It returns true if the increment succeeded, false otherwise, e.g. when the map is full.

Source Files

Jump to

Keyboard shortcuts

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