memory

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package memory provides NSM registry chain elements to building memory-based registries

Code generated by "-output ns_sync_map.gen.go -type NetworkServiceSyncMap<string,*github.com/networkservicemesh/api/pkg/api/registry.NetworkService> -output ns_sync_map.gen.go -type NetworkServiceSyncMap<string,*github.com/networkservicemesh/api/pkg/api/registry.NetworkService>"; DO NOT EDIT.

Code generated by "-output nse_sync_map.gen.go -type NetworkServiceEndpointSyncMap<string,*github.com/networkservicemesh/api/pkg/api/registry.NetworkServiceEndpoint> -output nse_sync_map.gen.go -type NetworkServiceEndpointSyncMap<string,*github.com/networkservicemesh/api/pkg/api/registry.NetworkServiceEndpoint>"; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNetworkServiceEndpointRegistryServer

func NewNetworkServiceEndpointRegistryServer(options ...Option) registry.NetworkServiceEndpointRegistryServer

NewNetworkServiceEndpointRegistryServer creates new memory based NetworkServiceEndpointRegistryServer

func NewNetworkServiceRegistryServer

func NewNetworkServiceRegistryServer(options ...Option) registry.NetworkServiceRegistryServer

NewNetworkServiceRegistryServer creates new memory based NetworkServiceRegistryServer

Types

type NetworkServiceEndpointSyncMap

type NetworkServiceEndpointSyncMap sync.Map

NetworkServiceEndpointSyncMap is like a Go map[string]*registry.NetworkServiceEndpoint but is safe for concurrent use by multiple goroutines without additional locking or coordination.

func (*NetworkServiceEndpointSyncMap) Delete

func (m *NetworkServiceEndpointSyncMap) Delete(key string)

Delete deletes the value for a key.

func (*NetworkServiceEndpointSyncMap) Load

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 (*NetworkServiceEndpointSyncMap) LoadAndDelete

func (m *NetworkServiceEndpointSyncMap) LoadAndDelete(key string) (value *registry.NetworkServiceEndpoint, loaded bool)

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

func (*NetworkServiceEndpointSyncMap) LoadOrStore

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.

func (*NetworkServiceEndpointSyncMap) Range

Range calls f sequentially for each key and value present in the map. 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.

Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.

func (*NetworkServiceEndpointSyncMap) Store

Store sets the value for a key.

type NetworkServiceSyncMap

type NetworkServiceSyncMap sync.Map

NetworkServiceSyncMap is like a Go map[string]*registry.NetworkService but is safe for concurrent use by multiple goroutines without additional locking or coordination.

func (*NetworkServiceSyncMap) Delete

func (m *NetworkServiceSyncMap) Delete(key string)

Delete deletes the value for a key.

func (*NetworkServiceSyncMap) Load

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 (*NetworkServiceSyncMap) LoadAndDelete

func (m *NetworkServiceSyncMap) LoadAndDelete(key string) (value *registry.NetworkService, loaded bool)

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

func (*NetworkServiceSyncMap) LoadOrStore

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.

func (*NetworkServiceSyncMap) Range

func (m *NetworkServiceSyncMap) Range(f func(key string, value *registry.NetworkService) bool)

Range calls f sequentially for each key and value present in the map. 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.

Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.

func (*NetworkServiceSyncMap) Store

func (m *NetworkServiceSyncMap) Store(key string, value *registry.NetworkService)

Store sets the value for a key.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is memory registry configuration option

func WithEventChannelSize

func WithEventChannelSize(l int) Option

WithEventChannelSize sets specific size of event channels

Jump to

Keyboard shortcuts

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