diff options
| author | Scott Gasch <[email protected]> | 2022-02-09 22:18:59 -0800 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-02-09 22:18:59 -0800 |
| commit | c974b8cde11f133df7680967b759772c624007e9 (patch) | |
| tree | 9d6e60f8cd2317c4b836ca65696d956b644a7bc1 /arper.py | |
| parent | 804988efe7c8b131fc0c4b30088de2b5c5bd0b74 (diff) | |
More spring cleaning.
Diffstat (limited to 'arper.py')
| -rw-r--r-- | arper.py | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -55,6 +55,17 @@ cfg.add_argument( @persistent.persistent_autoloaded_singleton() # type: ignore class Arper(persistent.Persistent): + """A caching layer around the kernel's network mapping between IPs and + MACs. This class restores persisted state that expires + periodically (see --arper_cache_max_staleness) at program startup + time. If it's unable to use the file's contents, it queries the + kernel (via arp) and uses an auxillary utility called arp-scan to + query the network. If it has to do this there's a latency hit but + it persists the collected data in the cache file. Either way, the + class behaves as a global singleton hosting this data thereafter. + + """ + def __init__( self, cached_local_state: Optional[BiDict] = None, @@ -118,10 +129,10 @@ class Arper(persistent.Persistent): @classmethod def load_state( - cls, - cache_file: str, - freshness_threshold_sec: int, - state: BiDict, + cls, + cache_file: str, + freshness_threshold_sec: int, + state: BiDict, ): if not file_utils.file_is_readable(cache_file): logger.debug('Can\'t read %s', cache_file) |
