vermap

package
v0.105.7 Latest Latest
Warning

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

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

Documentation

Overview

Package vermap implements a key value map like used in session variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VerMap

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

A VerMap is a simple map[string]string keeping track changes via a version number. It is safe for concurrent use by multiple goroutines.

func NewVerMap

func NewVerMap() *VerMap

NewVerMap returns a new VerMap instance.

func (*VerMap) Compare

func (vm *VerMap) Compare(m map[string]string) (upd map[string]string, del map[string]bool)

Compare returns the changes (updates and deletes) in VarMap compared to map parameter m.

func (*VerMap) CompareWithRLock

func (vm *VerMap) CompareWithRLock(m map[string]string) (upd map[string]string, del map[string]bool)

CompareWithRLock - same as Compare but needs to be executed in the context of method WithRLock.

func (*VerMap) Load

func (vm *VerMap) Load() map[string]string

Load returns the content of a VarMap as string key value map.

func (*VerMap) LoadWithRLock

func (vm *VerMap) LoadWithRLock() map[string]string

LoadWithRLock - same as Load but needs to be executed in the context of method WithRLock.

func (*VerMap) Store

func (vm *VerMap) Store(m map[string]string)

Store stores a string key value map in VarMap.

func (*VerMap) Version

func (vm *VerMap) Version() int64

Version returns the VarMap version.

func (*VerMap) WithRLock

func (vm *VerMap) WithRLock(f func())

WithRLock executes function f under a read lock.

Jump to

Keyboard shortcuts

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