Skip to content

Commit

Permalink
ndb: update outdated documentation for sources
Browse files Browse the repository at this point in the history
SourcesView has no .details() method.
  • Loading branch information
pkulev committed Dec 24, 2023
1 parent f14421b commit 8e7f6ce
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pyroute2/ndb/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,29 @@
starts with one local RTNL source names `localhost`::
>>> ndb = NDB()
>>> ndb.sources.details()
{'kind': u'local', u'nlm_generator': 1, 'target': u'localhost'}
>>> ndb.sources.summary().format("json")
[
{
"name": "localhost",
"spec": "{'target': 'localhost', 'nlm_generator': 1}",
"state": "running"
},
{
"name": "localhost/nsmanager",
"spec": "{'target': 'localhost/nsmanager'}",
"state": "running"
}
]
>>> ndb.sources['localhost']
[running] <IPRoute {'nlm_generator': 1}>
[running] <IPRoute {'target: 'localhost', 'nlm_generator': 1}>
The `localhost` RTNL source starts an additional async cache thread.
The `nlm_generator` option means that instead of collections the
`IPRoute` object returns generators, so `IPRoute` responses will not
consume memory regardless of the RTNL objects number::
>>> ndb.sources['localhost'].nl.link('dump')
<generator object _match at 0x7fa444961e10>
<generator object RTNL_API.filter_messages at 0x7f61a99a34a0>
See also: :ref:`iproute`
Expand Down

0 comments on commit 8e7f6ce

Please sign in to comment.