Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1563-snmp-Types-and-specs-for-snmp_generic-vari...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1563-snmp-Types-and-specs-for-snmp_generic-variable_set-2.patch of Package erlang
From a79e2bbf23130830b7f401ae1b5e3bc0be788aaf Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Mon, 15 Jan 2024 10:04:11 +0100 Subject: [PATCH 43/67] [snmp] Types and specs for snmp_generic:variable_set/2 --- lib/snmp/doc/src/snmp_generic.xml | 12 ++++-------- lib/snmp/src/agent/snmp_generic.erl | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/snmp/doc/src/snmp_generic.xml b/lib/snmp/doc/src/snmp_generic.xml index 0b1552463b..3f15c5c54b 100644 --- a/lib/snmp/doc/src/snmp_generic.xml +++ b/lib/snmp/doc/src/snmp_generic.xml @@ -590,18 +590,14 @@ value() = term() </func> <func> - <name since="">variable_set(NameDb, NewVal) -> true | false</name> + <name name="variable_set" arity="2" clause_i="1" since=""/> <fsummary>Set a value for a variable</fsummary> - <type> - <v>NameDb = name_db()</v> - <v>NewVal = value()</v> - </type> <desc> <p>Sets a new value to a variable. The variable is created if - it does not exist. No checks are made on the type of the - new value. </p> + it does not exist. No checks are made on the type of the + new value. </p> <p>Returns <c>false</c> if the <c>NameDb</c> argument - is incorrectly specified, otherwise <c>true</c>.</p> + is incorrectly specified, otherwise <c>true</c>. </p> </desc> </func> </funcs> diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl index 433231d8fc..7dd67c3b08 100644 --- a/lib/snmp/src/agent/snmp_generic.erl +++ b/lib/snmp/src/agent/snmp_generic.erl @@ -80,18 +80,26 @@ variable_get({Name, mnesia}) -> snmp_generic_mnesia:variable_get(Name); -variable_get(NameDb) -> % ret {value, Val} | undefined - snmpa_local_db:variable_get(NameDb). +variable_get(Name) -> % ret {value, Val} | undefined + snmpa_local_db:variable_get(Name). + + +-spec variable_set(Name, Value) -> boolean() when + Name :: snmpa:name() | snmpa:name_db(), + Value :: term(). + variable_set({Name, mnesia}, Val) -> snmp_generic_mnesia:variable_set(Name, Val); -variable_set(NameDb, Val) -> % ret true - snmpa_local_db:variable_set(NameDb, Val). +variable_set(Name, Val) -> % ret true + snmpa_local_db:variable_set(Name, Val). + variable_inc({Name, mnesia}, N) -> snmp_generic_mnesia:variable_inc(Name, N); variable_inc(NameDb, N) -> % ret true snmpa_local_db:variable_inc(NameDb, N). + %%----------------------------------------------------------------- %% Returns: {value, Val} | undefined %% -- 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