logsnarf.state module

Persistent state

Basically just a wrapper around a dict that saves on mutate. This doesn’t change often, so is fine for our needs at the moment.

class logsnarf.state.State(state_path)[source]

Bases: MutableMapping

A persistent dictionary.

State is initially loaded from a json encoded file. State is saved to that file on every mutate.

Create the state object from a file.

Parameters:

state_path (string) – Path the JSON encoded state file.

save()[source]

Save current state.