Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1568-snmp-Types-and-specs-for-snmp_index-insert...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1568-snmp-Types-and-specs-for-snmp_index-insert-3.patch of Package erlang
From 29f2438fac9ccfa69479bf2204d41fba8f1b5488 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Mon, 15 Jan 2024 17:01:48 +0100 Subject: [PATCH 48/67] [snmp] Types and specs for snmp_index:insert/3 --- lib/snmp/doc/src/snmp_index.xml | 11 +++-------- lib/snmp/src/agent/snmp_index.erl | 8 +++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/snmp/doc/src/snmp_index.xml b/lib/snmp/doc/src/snmp_index.xml index 7dce842ba4..a0161cad15 100644 --- a/lib/snmp/doc/src/snmp_index.xml +++ b/lib/snmp/doc/src/snmp_index.xml @@ -281,17 +281,12 @@ get_next_pid(Oid, SnmpIndex) -> </func> <func> - <name since="">insert(Index, Key, Value) -> NewIndex</name> + <name name="insert" arity="3" clause_i="1" since=""/> <fsummary>Insert an item into the index</fsummary> - <type> - <v>Index = NewIndex = index()</v> - <v>Key = key()</v> - <v>Value = term()</v> - </type> <desc> <p>Inserts a new key value tuple into the index structure. If - an item with the same key already exists, the new <c>Value</c> - overwrites the old value.</p> + an item with the same key already exists, the new <c>Value</c> + overwrites the old value. </p> </desc> </func> <func> diff --git a/lib/snmp/src/agent/snmp_index.erl b/lib/snmp/src/agent/snmp_index.erl index d04fa9cded..8590492086 100644 --- a/lib/snmp/src/agent/snmp_index.erl +++ b/lib/snmp/src/agent/snmp_index.erl @@ -135,7 +135,7 @@ get_last(#tab{id = OrdSet} = Index) -> KeyOid :: snmp:oid(), NextKeyOid :: snmp:oid(), Value :: term(). - + get_next(#tab{id = OrdSet} = Tab, KeyOid) -> ?vlog("get_next -> entry with" "~n Tab: ~p" @@ -148,6 +148,12 @@ get_next(#tab{id = OrdSet} = Tab, KeyOid) -> end. +-spec insert(Index, Key, Value) -> NewIndex when + Index :: index(), + Key :: key(), + Value :: term(), + NewIndex :: index(). + insert(#tab{id = OrdSet, keys = KeyTypes} = Tab, Key, Val) -> ets:insert(OrdSet, {key_to_oid_i(Key, KeyTypes), Val}), Tab. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor