https://github.com/cfhamlet/os-qdb-protocal
qdb protocal
https://github.com/cfhamlet/os-qdb-protocal
protocal qdb
Last synced: 3 months ago
JSON representation
qdb protocal
- Host: GitHub
- URL: https://github.com/cfhamlet/os-qdb-protocal
- Owner: cfhamlet
- License: mit
- Created: 2018-11-27T12:07:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-09T03:30:16.000Z (over 7 years ago)
- Last Synced: 2025-12-16T03:50:26.475Z (6 months ago)
- Topics: protocal, qdb
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# os-qdb-protocal
[](https://www.travis-ci.org/cfhamlet/os-qdb-protocal)
[](https://codecov.io/gh/cfhamlet/os-qdb-protocal)
[](https://pypi.python.org/pypi/os-qdb-protocal)
[](https://pypi.python.org/pypi/os-qdb-protocal)
qdb protocal.
Support qdb commands: ``get``, ``test``
# Install
`pip install os-qdb-protocal`
# Usage
* create a protocal object from cmd and key
```
from os_qdb_protocal import create_protocal
proto = create_protocal('get', b'test-key')
```
* use upstream method to generate data to be send
```
# s is something which used to write data to, like socket, file, etc.
for data in proto.upstream():
s.send(data)
```
* use downstream method to parse data and get size will be recived
```
downstream = proto.downstream()
read_size = next(downstream)
while read_size >= 0:
# s is something which used to recieve data from, like socket, file, etc.
data = s.read(read_size)
read_size = downstream.send(data)
```
* access key and value
```
proto.key
proto.value
```
# Unit Tests
`$ tox`
# License
MIT licensed.