immap

package module
v0.0.0-...-a036190 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2017 License: MIT Imports: 2 Imported by: 0

README

Go Report Card Build Status

license GoDoc

goimutmap

This library provides:

  1. A lockless Golang map implementing the Context interface.
  2. An immutable map built on top of 1).

Supports: (with similar semantics as that of golang map)

a) Add b) Exists c) Delete

TODO: Add more documentation.

Documentation

Index

Constants

View Source
const (
	DELETED = "marked as deleted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextMapper

type ContextMapper interface {
	Exists(interface{}) (interface{}, bool)
	Add(interface{}, interface{}) interface{}
	Delete(interface{})
}

contextMapper implements the lockless map interface.

func NewcontextMapper

func NewcontextMapper(ctx context.Context) (ContextMapper, context.CancelFunc)

NewcontextMapper returns a new instance of implementing contextMapper interface.

type ImutMap

type ImutMap baseMap

func (*ImutMap) Add

func (imap *ImutMap) Add(key, value interface{}) IntfMap

Add method allows one to add new keys. Returns error.

func (*ImutMap) Delete

func (imap *ImutMap) Delete(key interface{})

func (*ImutMap) Exists

func (imap *ImutMap) Exists(key interface{}) (interface{}, bool, IntfMap)

Exists method allows to check and return the key.

type ImutMapper

type ImutMapper interface {
	Exists(interface{}) (interface{}, bool, IntfMap)
	Add(interface{}, interface{}) IntfMap
	Delete(interface{})
}

func NewImutMapper

func NewImutMapper(ctx context.Context) (ImutMapper, context.CancelFunc)

NewImutMapper returns a new instance of implementing ImutMapper interface.

type IntfMap

type IntfMap map[interface{}]interface{}

type OperType

type OperType int
const (
	ADD_KEY OperType = iota
	CHECK_KEY
	DEL_KEY
)

Jump to

Keyboard shortcuts

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