Skip to content

Commit

Permalink
fixed reference leak (#18), and renamed loads/dumps to loadb/dumpb
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Feb 22, 2020
1 parent 9b80c67 commit 8695500
Show file tree
Hide file tree
Showing 3 changed files with 431 additions and 461 deletions.
15 changes: 15 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ with db.stream(match_event_handler=on_match, context=2345) as stream:
stream.scan(b'qux', match_event_handler=on_qux_match)
```

## Serialization

Refer to the [Hyperscan documentation][8] for more information on
serialization, its use cases, and caveats. Usage is simple:

```python
# Serializing (dumping to bytes)
serialized = hyperscan.dumpb(db)
with open('hs.db', 'wb') as f:
f.write(serialized)

# Deserializing (loading from bytes):
db = hyperscan.loadb(serialized)
```

[1]: http://intel.github.io/hyperscan/dev-reference/chimera.html
[2]: http://intel.github.io/hyperscan/dev-reference/runtime.html#stream-compression
Expand All @@ -133,3 +147,4 @@ with db.stream(match_event_handler=on_match, context=2345) as stream:
[5]: https://github.com/darvid/python-hyperscan/issues
[6]: http://intel.github.io/hyperscan/dev-reference/api_files.html#c.match_event_handler
[7]: http://intel.github.io/hyperscan/dev-reference/runtime.html#scratch-space
[8]: https://intel.github.io/hyperscan/dev-reference/serialization.html
Loading

0 comments on commit 8695500

Please sign in to comment.