uidstore

package
v0.0.0-...-0798a42 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package uidstore provides a concurrency-safe two-way mapping between UIDs used by the UI and arbitrary string keys as used by different mail backends.

Multiple Store instances can safely be created and the UIDs that they generate will be globally unique.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store holds a mapping between application keys and globally-unique UIDs.

func NewStore

func NewStore() *Store

NewStore creates a new, empty Store.

func (*Store) GetKey

func (s *Store) GetKey(uid uint32) (string, bool)

GetKey returns the key for the provided UID, if available.

func (*Store) GetOrInsert

func (s *Store) GetOrInsert(key string) uint32

GetOrInsert returns the UID for the provided key. If the key was already present in the store, the same UID value is returned. Otherwise, the key is inserted and the newly generated UID is returned.

func (*Store) RemoveUID

func (s *Store) RemoveUID(uid uint32)

RemoveUID removes the specified UID from the store.

Jump to

Keyboard shortcuts

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