[bisq-network/bisq] Introduce gRPC API proof of concept (#3888)

Chris Beams notifications at github.com
Fri Jan 10 20:14:39 UTC 2020


This is the third in a series of PRs leading up to a larger refactoring effort. It should be merged immediately after PRs #3886 and #3887, in that order.

The proof of concept introduced here was authored by @chimp1984 and is not strictly related to the refactoring effort that will follow in the next and final PR in this series, but that refactoring effort began on top of these changes. To avoid rework in teasing these changes apart and submitting them fully separately, I'm choosing to introduce the gRPC PoC here such that the refactoring work can be submitted immediately afterward. Please note that commit 65175a7f4 completely disables the PoC functionality such that the API cannot be used in production. Once this series of PRs is merged, I plan to return to the gRPC API effort, where I already have a number of modifications to this proof of concept in flight. So this code won't just "sit there"; it will be reworked into production-readiness as one of my next priorities.

    65175a7f4 (Chris Beams, 3 weeks ago)
       Remove --desktopWith{Grpc|Http}Api options for now

       The previous commit introduces the BisqGrpcServer as a proof of concept,
       but it is not yet ready for production use. This commit removes the
       `--desktopWithGrpcApi` option that starts the gRPC server until such time
       that it is production-ready.

       This change also removes the `--desktopWithHttpApi` option for starting an
       HTTP API server. The option has been in place for some time, but it was
       'false advertising' in the sense that nothing actually happened if the user
       specified it, because there is in fact no HTTP API implementation to be
       started.

       Note that when the gRPC API option is reintroduced, it will be renamed to
       `--rpcserver` or similar, following the convention in Bitcoin Core.

    5c02ce576 (chimp1984, 4 months ago)
       Introduce gRPC API proof of concept

       This commit introduces a new `grpc` module including the following key
       types:

        - BisqGrpcServer: The API implementation itself, along with generated
         gRPC Response/Reploy types defined in grpc/src/main/proto/grpc.proto.

        - BisqGrpcServerMain: A 'headless' / daemon-like entry point for
         running a Bisq node without the JavaFX desktop UI.

        - BisqGrpcClient: A simple, repl-style client for the API that allows
         the user to exercise the various endpoints as seen in the example
         below.

       In the `desktop` module, the BisqAppMain class has been modified to start a
       BisqGrpcServer instance if the `--desktopWithGrpcApi` option has been set
       to `true`.

       In the `core` module, a new `CoreApi` class has been introduced providing a
       kind of comprehensive facade for all Bisq functionality to be exposed via
       the RPC API.

       How to explore the proof of concept:

        1. Run the main() method in BisqAppMain providing
       `--desktopWithGrpcApi=true` as a program argument or alternatively, run
       the main() method in BisqGrpcServerMain, where no special option is
       required. In either case, you'll notice the following entry in the log
       output:

           INFO  bisq.grpc.BisqGrpcServer: Server started, listening on 8888

        2. Now run the main() method in BisqGrpcClient. Once it has started up
       you are connected to the gRPC server started in step 1 above. To
       exercise the API, type `getVersion` via stdin and hit return. You
       should see the following response:

           INFO bisq.grpc.BisqGrpcClient - 1.2.4

        Likewise, you can type `getBalance` and you'll see the following
       response:

           INFO bisq.grpc.BisqGrpcClient - 0.00 BTC

        and so forth for each of the implemented endpoints. For a list of
       implemented endpoints, see BisqGrpcServer.start().

       Note once again that the code here is merely a proof of concept and should
       not be considered complete or production-ready in any way. In a subsequent
       commit, the `--desktopWithGrpcApi` option will be disabled in order to
       avoid any potential production use.

       The content of this commit is the result of squashing a number of commits
       originally authored by chimp1984 in the `chimp1984` fork's `grpc` branch.

       Co-authored-by: Chris Beams <chris at beams.io>

Please disregard the several additional unrelated related commits in this PR. They are part of PRs #3886 and #3887 and will disappear here when those PRs are merged.
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/3888

-- Commit Summary --

  * Introduce gRPC API proof of concept
  * Ignore Structure101 Workspace files
  * Revert "Apply kotlin plugin and convert one unused class to kotlin"
  * Do not strip trailing whitespace in Git diffs
  * Remove --desktopWith{Grpc|Http}Api options for now

-- File Changes --

    M .editorconfig (3)
    M .gitignore (1)
    M build.gradle (74)
    A core/src/main/java/bisq/core/CoreApi.java (163)
    M core/src/main/java/bisq/core/app/AppOptionKeys.java (2)
    M core/src/main/java/bisq/core/app/BisqEnvironment.java (6)
    M core/src/main/java/bisq/core/app/BisqExecutable.java (10)
    M desktop/src/main/java/bisq/desktop/app/BisqAppMain.java (22)
    M gradle/witness/gradle-witness.gradle (53)
    A grpc/src/main/java/bisq/grpc/BisqGrpcApp.java (26)
    A grpc/src/main/java/bisq/grpc/BisqGrpcClient.java (297)
    A grpc/src/main/java/bisq/grpc/BisqGrpcServer.java (236)
    A grpc/src/main/java/bisq/grpc/BisqGrpcServerMain.java (127)
    A grpc/src/main/java/resources/logback.xml (16)
    A grpc/src/main/proto/grpc.proto (148)
    A p2p/src/test/java/bisq/network/p2p/storage/mocks/MockData.java (88)
    D p2p/src/test/java/bisq/network/p2p/storage/mocks/MockData.kt (39)
    M settings.gradle (1)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/3888.patch
https://github.com/bisq-network/bisq/pull/3888.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3888
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200110/ec8c3b27/attachment-0001.html>


More information about the bisq-github mailing list