snmpa_mib_storage(3erl)

πŸ“¦
version 25.3.2.8 Β· 4 versions
, in ubuntu noble

πŸ’– snmpa_mib_storage πŸ’–

This is the snmpa_mib_storage(3erl) page β€” Erlang module definition, bestie. It’s the behaviour module for the SNMP agent mib storage. Come get the tea β˜•βœ¨

🌸 NAME 🌸

snmpa_mib_storage β€” Behaviour module for the SNMP agent mib storage.

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this module defines the behaviour of the SNMP agent mib storage. No cap.

The mib storage is what the agent uses to store internal mib-related information. The mib storage module is used by several entities β€” not just the mib-server, bestie. It’s giving main character energy across the agent πŸ’…

A snmpa_mib_storage compliant module must export these functions:

  • open/5
  • close/1
  • read/2
  • write/2
  • delete/1
  • delete/2
  • match_object/2
  • match_delete/2
  • tab2list/1
  • info/1
  • sync/1
  • backup/2

The semantics of them and their exact signatures are explained below. Periodt πŸ’–

πŸŽ€ CALLBACK FUNCTIONS πŸŽ€

The source says: The following functions must be exported from a mib-server data callback module: Then it rolls straight into EXPORTS. Keeping that exact section order, bestie 🫢

🌈 EXPORTS 🌈

πŸ“ open/5

Module:open(Name, RecordName, Fields, Type, Options) -> {ok, TabId} | {error, Reason}

Types:

  • Name = atom()
  • RecordName = atom()
  • Fields = [atom()]
  • Type = set | bag()
  • Options = list()
  • TabId = term()
  • Reason = term()

Create or open a mib storage table. Slay.

Heads up: the RecordName and Fields arguments might not be used in all implementations β€” they're actually only needed for mnesia-based implementations. No shade, just facts πŸ’…

Also note that the Options argument comes from the options config option of the mib-storage config option, and is passed on as is. Iconic config pipeline behavior.

🧚 close/1

Module:close(TabId) -> void()

Types:

  • State = term()

Close the mib-storage table. (Yes, the type block says State = term() while the signature says TabId β€” that’s literally what the page has, bestie 😭 I’m not fixing it.)

πŸ¦‹ read/2

Module:read(TabId, Key) -> false | {value, Record}

Types:

  • TabId = term()
  • Key = term()
  • Record = tuple()

Read a record from the mib-storage table. Lowkey straightforward πŸ’–

πŸ’œ write/2

Module:write(TabId, Record) -> ok | {error, Reason}

Types:

  • TabId = term()
  • Record = tuple()
  • Reason = term()

Write a record to the mib-storage table. Ate.

πŸŽ€ delete/1

Module:delete(TabId) -> void()

Types:

  • TabId = term()

Delete an entire mib-storage table. Whole table? Gone. Periodt.

🫢 delete/2

Module:delete(TabId, Key) -> ok | {error, Reason}

Types:

  • TabId = term()
  • Key = term()
  • Reason = term()

Delete a record from the mib-storage table. Just one, bestie.

🌟 match_object/2

Module:match_object(TabId, Pattern) -> Recs | {error, Reason}

Types:

  • TabId = term()
  • Pattern = match_pattern()
  • Recs = [tuple()]
  • Reason = term()

Search the mib-storage table for records that match the specified pattern. Vibe check: pattern in, matching records out ✨

πŸ”₯ match_delete/2

Module:match_delete(TabId, Pattern) -> Recs | {error, Reason}

Types:

  • TabId = term()
  • Pattern = match_pattern()
  • Recs = [tuple()]
  • Reason = term()

Search the mib-storage table for records that match the specified pattern, then delete them. The records deleted are also returned. So it’s find, delete, and show receipts β€” iconic.

🌸 tab2list/1

Module:tab2list(TabId) -> Recs

Types:

  • TabId = term()
  • Recs = [tuple()]

Return all records in the mib-storage table in the form of a list. The whole table, served on a list platter πŸ“

πŸ‘‘ info/1

Module:info(TabId) -> {ok, Info} | {error, Reason}

Types:

  • TabId = term()
  • Info = term()
  • Reason = term()

Retrieve implementation dependent mib-storage table information. Iykyk β€” what β€œinfo” means depends on the implementation.

🌈 sync/1

Module:sync(TabId) -> void()

Types:

  • TabId = term()

Synchronize the mib-storage table. What this means, if anything, is implementation dependent. No cap.

⭐ backup/2

Module:backup(TabId, BackupDir) -> ok | {error, Reason}

Types:

  • TabId = term()
  • BackupDir = string()
  • Reason = term()

Perform a backup of the mib-storage table. What this means, if anything, is implementation dependent. Backup vibes: implementation’s choice πŸ’…


Sign-off πŸ’–: Ericsson AB made this, the version is snmp 5.13.5, the page is snmpa_mib_storage(3erl), and the footer date slot is not present in the original β€” so no fake date from me, bestie. That’s the source/version/date sign-off energy, periodt.

πŸ“¦ where this page comes from