Skip to content

Commit

Permalink
add flatbuffers bits; fix coverage/tox (#1135)
Browse files Browse the repository at this point in the history
* add WAMP-FlatBuffers first support (incomplete)
* roundtrip EVENT and PUBLISH in WAMP-FlatBuffers
  • Loading branch information
oberstet authored Mar 15, 2019
1 parent 502ceb1 commit e00005e
Show file tree
Hide file tree
Showing 19 changed files with 1,591 additions and 235 deletions.
13 changes: 2 additions & 11 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[run]
source = autobahn
branch = True

[report]
precision = 2
exclude_lines =
def __repr__
raise AssertionError
pragma: no cover
if self\._debug
raise NotImplementedError
omit =
*/test/*.py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ node.key
*.swo
*.swn
*.so
coverage.xml
.coverage.*
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ install:
script:
- tox -c tox.ini -e $TOX_ENV

after_script:
- codecov

cache:
directories:
- $HOME/.cache/pip
Expand Down Expand Up @@ -107,6 +104,11 @@ matrix:
env:
- TOX_ENV=py27-asyncio


- python: "3.7"
skip_cleanup: true
env: TOX_ENV=coverage

#
# Build wheel and upload to S3
# https://docs.travis-ci.com/user/build-stages/matrix-expansion/
Expand Down
31 changes: 26 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: test docs pep8
.PHONY: test docs pep8 build

all:
@echo "Targets:"
Expand All @@ -12,12 +12,20 @@ all:

# install locally
install:
-pip uninstall -y pytest_asyncio # remove the broken shit
-pip uninstall -y pytest_cov # remove the broken shit
# enforce use of bundled libsodium
SODIUM_INSTALL=bundled pip install -e .[all,dev]
AUTOBAHN_USE_NVX=1 SODIUM_INSTALL=bundled pip install -e .[all,dev]

build:
-rm -f dist/*
# python setup.py sdist bdist_wheel --universal
AUTOBAHN_USE_NVX=1 python setup.py sdist bdist_wheel
ls -la dist

# upload to our internal deployment system
upload: clean
python setup.py bdist_wheel
python setup.py sdist bdist_wheel --universal
aws s3 cp --acl public-read \
dist/autobahn-*.whl \
s3://fabric-deploy/autobahn/
Expand All @@ -34,6 +42,11 @@ clean:
-rm -rf ./_trial_temp
-rm -rf ./.tox
-rm -rf ./.eggs
-rm -rf ./htmlcov
-rm -f ./.coverage
-rm -f ./coverage.xml
-rm -f ./.coverage.*
-rm -rf ~/coverage
-rm -f ./twisted/plugins/dropin.cache
-find . -name "*dropin.cache.new" -type f -exec rm -f {} \;
-find . -name "*.tar.gz" -type f -exec rm -f {} \;
Expand Down Expand Up @@ -70,7 +83,10 @@ test_pytest:
test_setuptools:
python setup.py test

test: flake8 test_twisted test_asyncio
test:
tox -e flake8,py37-twtrunk,py37-asyncio,coverage

#test: flake8 test_twisted test_asyncio

# test under Twisted
test_twisted:
Expand All @@ -80,6 +96,9 @@ test_twisted:
test_tx_serializer:
USE_TWISTED=1 trial autobahn.wamp.test.test_serializer

test_tx_cryptobox:
USE_TWISTED=1 trial autobahn.wamp.test.test_cryptobox

test_tx_choosereactor:
USE_TWISTED=1 trial autobahn.twisted.test.test_choosereactor

Expand Down Expand Up @@ -141,7 +160,9 @@ autopep8:

# This will run pep8, pyflakes and can skip lines that end with # noqa
flake8:
flake8 --ignore=E402,E501,E722,E741,N801,N802,N803,N805,N806,N815 autobahn
flake8 --ignore=E402,E501,E722,E741,N801,N802,N803,N805,N806,N815 \
--exclude "autobahn/wamp/message_fbs.py,autobahn/wamp/gen/*"\
autobahn

# run PyLint
pylint:
Expand Down
2 changes: 1 addition & 1 deletion autobahn/twisted/test/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
# Copyright (c) Crossbar.io Technologies GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 23 additions & 2 deletions autobahn/wamp/flatbuffers/pubsub.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ table Publish
// The WAMP or application URI of the PubSub topic the event should be published to.
topic: string (required, uri);

// Raw application payload: error arguments. This might be encrypted (with Payload==Payload.CRYPTOBOX), and is serialized according to enc_serializer.
/// Positional values for application-defined event payload.
args: [uint8];

/// Keyword values for application-defined event payload.
kwargs: [uint8];

/// Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
payload: [uint8];

// The encoding algorithm that was used to encode the payload.
Expand Down Expand Up @@ -135,7 +141,13 @@ table Event
// The publication ID of the dispatched event.
publication: uint64;

// Raw application payload: error arguments. This might be encrypted (with Payload==Payload.CRYPTOBOX), and is serialized according to enc_serializer.
/// Positional values for application-defined event payload.
args: [uint8];

/// Keyword values for application-defined event payload.
kwargs: [uint8];

/// Alternative, transparent payload. If given, ``args`` and ``kwargs`` must be left unset.
payload: [uint8];

// The encoding algorithm that was used to encode the payload.
Expand Down Expand Up @@ -164,6 +176,15 @@ table Event

// Hint to request acknowledgement of the reception of this Event by a subscriber.
acknowledge: bool;

// The WAMP session ID of the pubisher. Only filled when the publisher is disclosed.
forward_for: uint64;

// The WAMP authrole of the publisher. Only filled when publisher is disclosed.
forward_for_authid: string (principal);

// The WAMP authrole of the publisher. Only filled when publisher is disclosed.
forward_for_authrole: string (principal);
}


Expand Down
25 changes: 25 additions & 0 deletions autobahn/wamp/gen/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
###############################################################################
Binary file modified autobahn/wamp/gen/schema/pubsub.bfbs
Binary file not shown.
Binary file modified autobahn/wamp/gen/schema/wamp.bfbs
Binary file not shown.
Loading

0 comments on commit e00005e

Please sign in to comment.