Commit graph

64 commits

Author SHA1 Message Date
intractable
b9ed537f64
Minor cleanup (#130)
* Remove unnecessary self-dependency

* Regenerate core/default.nix and build -core via callCabal2nix

* grpc-haskell-core: -Wall -Werror and fix warnings

* grpc-haskell: -Wall -Werror and fix warnings

* Update documentation

* Remove LD_LIBRARY_PATH sets from usesGRPC

...as they no longer seem to be needed.

* Remove dead code

* Remove core/default.nix

...as suggested by @evanrelf.
2021-06-30 12:31:45 -05:00
Gabriel Gonzalez
d821e58c2b
Fix lower bound on proto3-suite dependency (#124)
Fixes https://github.com/awakesecurity/gRPC-haskell/issues/122
2021-04-26 12:33:51 -07:00
Gabriel Gonzalez
1bdc3662db
Version 0.1.0 (#119)
This is to prepare for an upcoming release to Hackage.  I increased the
version to 0.1.0 to reflect what I believe is a breaking change in #117
(since `grpc-haskell` will now require a newer version of the C `grpc`
dependency).
2021-03-23 10:40:51 -07:00
Gabriel Gonzalez
2af32db3a9
Fix examples (#115)
Fixes https://github.com/awakesecurity/gRPC-haskell/issues/112
2021-01-11 09:24:25 -08:00
intractable
6382857e2c
grpc-haskell-0.2.0.0: Upgrade to proto3-wire-1.2.0, proto3-suite-0.4.2.0 (#110)
* .gitignore

* release.nix: Minor cleanup

* Fix warning

* Expose max receive message length channel arg in `ServiceOptions`

* Fix warning

* Bump upstream dependencies and patch parameterized-0.5.0.0

* grpc-haskell 0.0.1.0 -> 0.0.2.0
2020-11-16 11:43:28 -06:00
Gabriel Gonzalez
595cb6a3bf
Update Arithmetic example to use newer proto3-suite (#102)
Related to https://github.com/awakesecurity/proto3-suite/issues/119
2020-02-10 10:19:29 -08:00
Moritz Kiefer
11681ec6b9
Fix sdist tarballs (#88)
A bunch of files have been missing from the tarballs created by `cabal
sdist`. I’ve changed the nix config to check for this and also found
some examples that I forgot to update in a previous PR (sorry about
that).
2019-08-28 09:28:26 +02:00
j6carey
c83eacd1f3
Move to newer proto3-suite. (#81) 2019-06-18 12:51:25 -07:00
j6carey
75cf21839b
Port grpc-haskell[-core] to ghc-8.6 and modern tasty. (#77)
Note that even though we can now build grpc-haskell and grpc-haskell-core
with modern tasty, the environment in which we built those test programs
did not support actually running all them successfully, due to the need to test
generated code in the context of the appropriate libraries.  We do not yet
know whether test programs built with new versions of tasty would succeed
in the appropriate environment.  In principle this could be discovered, but
the work involved is far from trivial, and therefore we defer it to another
time.  Tests built with the old tasty still succeed.
2019-03-25 16:52:04 -07:00
j6carey
c2a3aa6496
Allow dependency upon async-2.2.* (#75) 2019-02-11 10:44:16 -08:00
intractable
28288a17b7
Client helpers, re-exports, and fixups (#70)
* Derive `Show` instance for `ClientSSLKeyCertPair`

* Add a couple client helper functions & add additional exports

* Add `grpc-haskell-core` target; add `c2hs` dep

* Fix examples broken by #68

* rm `build-tools` and `include-dirs` directives from toplevel `.cabal`

* More `ClientConfig` fixes

* Ensure examples are built
2018-10-14 17:52:59 -05:00
Ewout
9c6b3f63b6 Fix build on GHC 8.4 (#63)
* Fix haddock: postfix comments on GADT constructors don't work.

See https://github.com/haskell/haddock/issues/43 .

* Remove unused dependencies from cabal file..

* Semigroup instances for compatibility with GHC 8.4.
2018-06-18 12:24:19 -07:00
Christian Lavoie
9cfb3da770 Extract lowlevel bits into a core package (#42) 2018-01-29 08:59:34 -08:00
intractable
19125b42be
proto3-suite => 97c4f66 (#37)
* `proto3-suite` => `9394ade` and regenerate CG artifacts

* `proto3-suite` => `56cf36f`

* `proto3-wire` => `a938330`

* `proto3-suite` => `e8f2acb`

* Update `stack.yaml`

* Update CG artifacts for Echo and Arithmetic examples

* Update `stack.yaml`

* `proto3-suite` => `aff63e6` and add related nix deps

* Update CG artifacts for Echo and Arithmetic examples

* `proto3-suite` => `97c4f66`

* Nitpick: Rename test exe from `test` to `tests`

* Add `.gitattributes` files to mark generated modules
2017-11-02 15:36:57 -05:00
intractable
fe55845d3f Update to latest proto3-suite, remove compile-proto-file exe (#23)
* Squash merge from branch `joel-fix-build-issues-and-broken-tests`

* Update `proto3-wire` and `proto3-suite` refs in `stack.yaml`

* Update `proto3-wire` and `proto3-suite` refs via `cabal2nix` for `nix` builds

* Remove `compile-proto-file` from the repo, as it is now available via `proto3-suite`

* Update `proto3-suite` ref in `stack.yaml`

* Update `proto3-suite` ref via `cabal2nix` for `nix` builds

* Update `proto3-suite` and `proto3-wire` gitrevs

* Regenerate Echo and Arithmetic example modules from their respective .protos

* Fix typo
2017-07-17 20:42:35 -05:00
intractable
d95052ebe6 Update nix-shell env and update tasty-quickcheck dep (#18)
* Add tasty-quickcheck to library deps

* Add shell hook to no-tests target and export it at toplevel

* cabal2nix . > default.nix

* PR feedback from @parnell (better shell hooks)
2017-05-30 11:45:22 -05:00
Connor Clark
169dbb7fff First draft of a tutorial (#15)
* add basic tutorial, re-export client stuff in HighLevel.Generated

* add a relative link in README.md

* forgot to document the language extensions

* cabal file fixup

* more context to compile-proto-file

* haskell syntax highlighting in markdown

* link to gRPC official tutorials for basic concepts

* add a note on how to build the examples

* prominent notice of required gRPC version

* fix typo

* do some error handling, show how to run the example executables

* use mapM
2017-04-30 15:38:29 -07:00
Connor Clark
b550607f60 gRPC 1.2.0 compatibility (#12)
* update for reorganized headers in gRPC v1.1: https://github.com/grpc/grpc/pull/7559

* update nix files

* rename all gpr_slice to grpc_slice since we can't be backwards compatible anyway

* use gRPC 1.1.4

* now compatible with gRPC 1.2.0

* use nixpkgs 17.03 to get protobuf3_2, newer proto3-* deps, fix some warnings

* another warning
2017-04-14 19:28:01 -07:00
Gabriel Gonzalez
54a735eeab Update homepage field of .cabal file 2017-03-06 11:06:17 -08:00
Gabriel Gonzalez
d94598129f Update contact information 2017-02-28 16:29:04 -08:00
Gabriel Gonzalez
bff8fb7c7e Switch from protobuf-wire to proto3-suite (#92)
`protobuf-wire` was open sourced as `proto3-suite` (with a corresponding module
rename) so this change updates the dependency and import lists
2017-02-27 08:43:37 -08:00
Joel Stanley
9a3be32ed7 Update echo client/server to use CG and high-level interfaces (#88)
* echo client/server example: dead code removal, add command line params, improve output messages

* Add nix-build result to .gitignore

* Merge echo-client and echo-server directories to echo-hs/ directory; rename main modules accordingly

* Use our protobuf compiler to generate bindings for the Echo service

* Simplify echo.proto to just one endpoint; use highlevel client/server interfaces and codegen for echo example

* Remove repetition counts and thread spawns from echo client, parameterize payload

* Update default.nix
2016-12-22 14:33:44 -06:00
Joel Stanley
db3d66c4eb Add compile-proto-file helper cli tool (#87)
* Add compile-proto-file helper cli tool (.proto -> ast -> .hs)

* Update default.nix
2016-12-21 11:47:05 -06:00
Joel Stanley
b78b15ecdb Fix author/maintainer/copyright in grpc-haskell.cabal (#82)
Update LICENSE, update fields in grpc-haskell.cabal
2016-12-14 12:55:56 -06:00
Connor Clark
1d8f811906 MONAPP-1369: Server options for generated code. (#76)
* add ServiceOptions for generated servers

* drop opt prefix in ServiceOptions fields

* add default options

* tweak exports, add docs

* re-export stuff from Generated so that users need don't need to import lots of modules

* remove threaded from library -- doesn't do anything

* add defaultServiceOptions export

* more exports

* export GRPCMethodType
2016-11-30 14:22:47 -08:00
Travis Athougies
26dc36dc64 GADT-based high level interface 2016-11-17 16:00:07 -08:00
Connor Clark
a12e5ae8a0 update bounds for GHC 8 (#73) 2016-10-24 14:25:08 -07:00
Connor Clark
3366dde7ab Connor/security (#68)
* begin security bindings

* secure channel creation

* SSL credentials support

* add client-side ssl support

* ssl test

* read file before passing to channel credentials, free credentials when done creating

* use localhost key/cert for test

* WIP sketch of callbacks for metadata plugins

* conversion from Haskell auth processor to C

* add test for custom server metadata auth processor

* wip auth failure test

* rebase tweak

* working test of custom auth metadata server processor

* improve security docs, clean up

* add unsafe layer client-side auth metadata plugin functionality

* add client config option for custom auth metadata

* WIP client-side metadata auth plugin. Crashing when calling C callback.

* get initial version of client-side metadata plugins working

* replace String with ByteString in a few places, add function for getting AuthProperty

* AuthContext utilities and more documentation

* end-to-end test of client and server auth plugins

* remove redundant tests

* function for parents in unary calls, add deactivated failing test for auth metadata propagation from parent to child

* some cleanup

* tweaks

* more tweaks

* remove unused file

* docs tweak

* consolidate exports

* update protobuf-wire commit
2016-08-17 09:55:06 -07:00
Connor Clark
b9b548d8eb Fix metadata marshalling bug, add QuickCheck properties (#63)
* make metadatamap a newtype of multimap

* update tests for new MetadataMap

* remove multimap dependency, reproduce needed functionality instead

* add repeated key to payload test

* QuickCheck properties for C bindings, fix bug in metadata FFI wrappers

* add quickcheck bound

* fix merge
2016-08-17 09:54:46 -07:00
Connor Clark
f8bbe3abd2 Connor/metadata improvements (#52)
* make metadatamap a newtype of multimap

* update tests for new MetadataMap

* remove multimap dependency, reproduce needed functionality instead

* add repeated key to payload test

* bump LTS version for sorted-list, use SortedList for MetadataMap

* remove unneeded conversion

* MetadataMap documentation

* minor fixes
2016-08-01 12:38:35 -07:00
Connor Clark
bd2c4092de use c99 (#62) 2016-07-29 14:54:03 -07:00
Phil Freeman
7be33c2792 Relax bounds 2016-07-27 15:41:50 -07:00
Connor Clark
0d70a6c960 Criterion benchmarks (#50)
* begin bench executable

* tweak benchmark, fork serverLoop for interruptibility

* client streaming benchmarks

* add server streaming handler

* server streaming benchmark

* bidi streaming benchmark

* cleanup, create benchmark html

* improve error messages

* benchmarks: add bounds, remove -g, add -O2

* eliminate explicit sleep at shutdown

* bump protobuf-wire version

* remove superfluous parens, remove benchmarks.html
2016-07-26 15:48:25 -07:00
Joel Stanley
c1fa7956c7 "Hellos" C++/Haskell programs for exercising interop for streaming modes (#49)
* Hellos example: skeleton and server-streaming mode use

* Catch IO exceptions in dispatchLoop

* Distinguish decoding errors from other errors; convert error calls to explicit throws of GRPCIOErrors

* instance Exception GRPCIOError

* Add error checks and error messages to hellos cpp client

* Change fixed32 to uint32

* Add prelim hellos-client, hellos-server executables

* Hellos cpp example: add client-streaming mode use

* In unregistered high-level server, aggressively catch all exceptions raised in
handlers and promote then to a new GRPCIOError constructor.

* Hellos hs example: add client-streaming mode use

* Hellos cpp example: add simple bidi mode use

* Hellos hs example: add simple bidi mode use

* wibbles

* Add GRPCIOErrorEq newtype wrapper w/ Eq instance for testing purposes

* Refactoring wibbles

* README wibbles

* DCR

* Fix rebase derp

* Remove libdl dep, update protobuf github link in hellos cpp Makefile.

* Use Data.Coerce.coerce for GRPCIOErrorEq; remove warnings

* Report expected/got errors in Haskell hellos client/server

* Report expected/got errors in cpp hellos client/server

* Add some instructions for running the hellos client/server

* Fix warnings

* Rename logShow to logMsg and use stderr for logging

* Tweak compliation parameters for hellos hs executables; increase constant workload

* Remove unnecessary type annotation

* Simplify handleError in dispatchLoop

* Remove GRPCIOErrorEq and coerce use; change GRPCIOHandlerException type
2016-07-26 15:21:35 -07:00
Travis Athougies
1d7526da70 Added tests for grpc server generation 2016-07-25 16:39:25 -07:00
Connor Clark
ab4dea344d Server performance and stability improvements (#48)
* concurrent echo client for stress testing

* update examples for benchmarking, tweak cabal file

* mark frequently-used call as unsafe for performance boost

* add unsafe annotation to non-blocking C calls on critical path

* more unsafe annotations -- server performance almost doubled now

* one CQ for all call ops

* unsafe annotation on start_batch

* wait for all client threads, replace error with fail

* add -O2
2016-07-21 12:55:16 -07:00
Connor Clark
a34107b740 add new module to exposed-modules (#47) 2016-07-20 11:34:39 -07:00
Connor Clark
cc5d30acd2 Travis/service generation (#46)
* higher bound on clock versions

* Added helper module for generated service code
2016-07-20 11:26:53 -07:00
Connor Clark
65026eb79c Fix async race causing crash on server shutdown (#43)
* clean up forked threads before shutting down server

* get rid of sleep, wait until all forked threads are dead to shutdown server

* add todo
2016-07-18 11:04:01 -05:00
Connor Clark
e4a28e9e4b High-level unregistered concurrent interface (#41)
* remove parent ptr from unregistered calls -- unneeded

* begin unregistered high level server loop

* undo changes to highlevel server, add mkConfig for unregistered server

* move call CQ create/destroy into call create/destroy

* async normal call function

* preliminary unregistered server loop for non-streaming methods

* working unregistered highlevel example

* loop counters for benchmarking

* changes for benchmarking, add ruby example server for benchmarking

* async version of withCall, refactor unregistered server loop to handle all method types

* unregistered client streaming

* add remaining streaming modes

* unregistered server streaming test

* unregistered streaming tests

* add error logging

* fix bug in add example

* remove old TODOs

* fix bug: don't assume slices are null-terminated

* add TODO re: unregistered client streaming functions
2016-07-14 09:53:28 -07:00
Connor Clark
9113e416e7 Joel/highlevelv2 (#40)
* Tweak runOps param order, inline common op sequences, clean up serverHandleNormalCall

* More ops sequence inlining for clarity, experimenting with Managed

* Checkpoint: preliminary support for all streaming modes; much cleanup/refactoring and api design still needed

* Use mempty for default StatusDetails; tweak bad status matching mechanism

* Preliminary user-facing, server-streaming, low-level api and test

* renaming wibbles

* Preliminary user-facing, client-streaming, low-level api and test

* Move sendMsgs comb to Network.GRPC.LowLevel.Op; misc cleanup/DCR

* Modify bidi streaming to omit request payload

* Add transformers dep

* Preliminary user-facing low-level bidirectional streaming api and test

* Fix missing peek import

* Remove TimeoutSeconds params on streaming mode functions

* Fix serverHandleNormalCall rebase wart

* Fix rebase warts; minor hlint fixes and wibbles

* Post-rebase tweaks to optional payload use in serverRequestCall (i.e., now respects payloadHandling again)

* Cleanup/refactor serverRequestCall

* Fix comment

* Change ServerRWHandler type so that handler does not have to invoke a finalizer

* Change ServerReaderHandler type so that handler does not have to invoke a finalizer

* Simplify serverWriter interface and ServerWriterHandler structure

* Simplify serverRW (get rid of exec param), improve bidi streaming tests

* Use ExceptT in serverRW impl

* Change ServerRWHandler type to pass recv/send operations.

* Renaming

* Define ClientRWHandler, pass recv/send ops

* wibbles

* Use ExceptT in clientRW impl

* Add DataKinded phantom typing to RegisteredMethod; misc cleanup

* Simplify sendMsgs interface; add SingleSend type and related helpers

* Rename SingleSend to SendSingle, use ExceptT to clean up {client,server}Writer and sendMsgs

* More ExceptT cleanup in clientWriter

* Factor out reusable bits of clientWriter

* Shrink ServerReaderHandler

* Delete stale comments

* begin high-level server interface

* update to datakind representation

* clean up

* move method type info to type level, parametrize ServerCall by payload

* convert for writer handler

* start switching over to Message-based handlers

* begin work on highlevel example

* comment out old code

* parametrize StreamSend

* parametrize StreamRecv

* conversion for ServerReaderHandler

* finish handler conversions

* Add high level version and payload checking to echo-client

* Decouple server CQs from call-bound CQs (registered methods); use more consistent naming conventions

* Decouple server/call-bound CQs for unregistered methods; refactor U.serverRequestCall; misc cleanup

* Make convertRecv total; formatting wibbles
2016-07-12 11:28:21 -07:00
Connor Clark
b7a02a63e7 Fix Linux tests (#38)
* fix debug mode

* handle deadline differently depending on OS

* remove unneeded tests
2016-07-11 11:20:13 -07:00
Joel Stanley
96d12c1e6c Preliminary streaming mode support (client streaming, server streaming, bidirectional) (#37)
* Tweak runOps param order, inline common op sequences, clean up serverHandleNormalCall

* More ops sequence inlining for clarity, experimenting with Managed

* Checkpoint: preliminary support for all streaming modes; much cleanup/refactoring and api design still needed

* Use mempty for default StatusDetails; tweak bad status matching mechanism

* Preliminary user-facing, server-streaming, low-level api and test

* renaming wibbles

* Preliminary user-facing, client-streaming, low-level api and test

* Move sendMsgs comb to Network.GRPC.LowLevel.Op; misc cleanup/DCR

* Modify bidi streaming to omit request payload

* Add transformers dep

* Preliminary user-facing low-level bidirectional streaming api and test

* Fix missing peek import

* Remove TimeoutSeconds params on streaming mode functions

* Fix serverHandleNormalCall rebase wart

* Fix rebase warts; minor hlint fixes and wibbles

* Post-rebase tweaks to optional payload use in serverRequestCall (i.e., now respects payloadHandling again)

* Cleanup/refactor serverRequestCall

* Fix comment

* Change ServerRWHandler type so that handler does not have to invoke a finalizer

* Change ServerReaderHandler type so that handler does not have to invoke a finalizer

* Simplify serverWriter interface and ServerWriterHandler structure

* Simplify serverRW (get rid of exec param), improve bidi streaming tests

* Use ExceptT in serverRW impl

* Change ServerRWHandler type to pass recv/send operations.

* Renaming

* Define ClientRWHandler, pass recv/send ops

* wibbles

* Use ExceptT in clientRW impl

* Add DataKinded phantom typing to RegisteredMethod; misc cleanup

* Simplify sendMsgs interface; add SingleSend type and related helpers

* Rename SingleSend to SendSingle, use ExceptT to clean up {client,server}Writer and sendMsgs

* More ExceptT cleanup in clientWriter

* Factor out reusable bits of clientWriter

* Shrink ServerReaderHandler

* Delete stale comments

* Use common machinery for all streaming modes; make handler types more consistent

* wibbles
2016-07-06 08:59:38 -05:00
Connor Clark
accc8b8573 fix all warnings (#35) 2016-06-23 16:35:11 -05:00
Connor Clark
a530faf912 Channel options: user agents and compression (#32)
* get_peer: fix todo

* add documentation for server registered call function

* test roundtrip conversion of larger bytestrings (32 mb)

* Add channel args interface: currently supports user agents and compression.

* fix build failure after stack clean
2016-06-22 13:07:38 -07:00
Connor Clark
1907fa66c4 Server-side call cancellation (#26)
* begin module with LowLevel tests of Op stuff, cancel functions, refactor Ops a little.

* refactor op tests, add server-side cancellation test

* add cancel function for unregistered calls, move some unregistered stuff

* remove unnecessary threadDelay

* update test description

* fix init metadata api for registered server calls

* pass call into handler for cancelling, add cancel test
2016-06-13 13:51:53 -07:00
Joel Stanley
acefc35b8f Oops: remove runServerOps, -Network.GRPC.LowLevel.Op.Unregistered module as it is no longer needed 2016-06-08 15:53:09 -05:00
Joel Stanley
8069ebba07 Rename reg operations in all modules; use qualified imports whenever selecting unregistered variants 2016-06-08 15:29:12 -05:00
Joel Stanley
e8d3e6450e Split up CompletionQueue into CompletionQueue.{Unregistered,Internal} and add Unregistered namespace for Op 2016-06-08 15:29:12 -05:00
Joel Stanley
27a9a6283a Rename unreg operations in Network.GRPC.LowLevel.Call.Unregistered 2016-06-08 15:29:12 -05:00