Move gRPC boilerplate from :core to :daemon

This change moves gRPC boilerplate classes from the :core.grpc pkg
into a new :daemon.grpc pkg.

* The :core.grpc pkg was renamed :core.api, and no longer has any
  dependencies on gRPC libraries.

* All core service classes in the :core.api pkg are now package
  protected, excepting CoreApi, making CoreApi the only possible
  entry point for all Grpc*Service -> -Core*Service calls.

* All grpc service classes in the :daemon.grpc pkg are now package
  protected, excepting GrpcServer;  the only class depending on
  Grpc*Service class is GrpcServer.

* gRPC dependencies were moved from the gradle.build file's :core
  subproject to :daemon.
This commit is contained in:
ghubstan 2020-08-24 15:09:15 -03:00
parent d5c81cedd6
commit d0397c1c62
No known key found for this signature in database
GPG key ID: E35592D6800A861E
13 changed files with 31 additions and 34 deletions

View file

@ -328,19 +328,6 @@ configure(project(':core')) {
exclude(module: 'jackson-annotations')
}
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation("io.grpc:grpc-protobuf:$grpcVersion") {
exclude(module: 'guava')
exclude(module: 'animal-sniffer-annotations')
}
implementation("io.grpc:grpc-stub:$grpcVersion") {
exclude(module: 'guava')
exclude(module: 'animal-sniffer-annotations')
}
compileOnly "javax.annotation:javax.annotation-api:$javaxAnnotationVersion"
runtimeOnly("io.grpc:grpc-netty-shaded:$grpcVersion") {
exclude(module: 'guava')
exclude(module: 'animal-sniffer-annotations')
}
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
@ -577,6 +564,10 @@ configure(project(':daemon')) {
exclude(module: 'guava')
exclude(module: 'animal-sniffer-annotations')
}
runtimeOnly("io.grpc:grpc-netty-shaded:$grpcVersion") {
exclude(module: 'guava')
exclude(module: 'animal-sniffer-annotations')
}
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation "ch.qos.logback:logback-core:$logbackVersion"
implementation "ch.qos.logback:logback-classic:$logbackVersion"

View file

@ -15,9 +15,9 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.core.api;
import bisq.core.grpc.model.AddressBalanceInfo;
import bisq.core.api.model.AddressBalanceInfo;
import bisq.core.monetary.Price;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferPayload;

View file

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.core.api;
import bisq.core.monetary.Price;
import bisq.core.offer.CreateOfferService;
@ -40,7 +40,7 @@ import lombok.extern.slf4j.Slf4j;
import static bisq.core.offer.OfferPayload.Direction.BUY;
@Slf4j
public class CoreOffersService {
class CoreOffersService {
private final CreateOfferService createOfferService;
private final OfferBookService offerBookService;

View file

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.core.api;
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.locale.FiatCurrency;
@ -34,7 +34,7 @@ import java.util.Set;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CorePaymentAccountsService {
class CorePaymentAccountsService {
private final Config config;
private final AccountAgeWitnessService accountAgeWitnessService;

View file

@ -15,13 +15,13 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.core.api;
import bisq.core.api.model.AddressBalanceInfo;
import bisq.core.btc.Balances;
import bisq.core.btc.model.AddressEntry;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.WalletsManager;
import bisq.core.grpc.model.AddressBalanceInfo;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.TransactionConfidence;

View file

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc.model;
package bisq.core.api.model;
import bisq.common.Payload;

View file

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc.model;
package bisq.core.api.model;
import bisq.common.Payload;

View file

@ -20,7 +20,6 @@ package bisq.daemon.app;
import bisq.core.app.BisqHeadlessAppMain;
import bisq.core.app.BisqSetup;
import bisq.core.app.CoreModule;
import bisq.core.grpc.GrpcServer;
import bisq.common.UserThread;
import bisq.common.app.AppModule;
@ -33,10 +32,14 @@ import java.util.concurrent.ThreadFactory;
import lombok.extern.slf4j.Slf4j;
import bisq.daemon.grpc.GrpcServer;
@Slf4j
public class BisqDaemonMain extends BisqHeadlessAppMain implements BisqSetup.BisqSetupListener {
public static void main(String[] args) {
public static void main(String[] args) {
new BisqDaemonMain().execute(args);
}
@ -67,7 +70,6 @@ public class BisqDaemonMain extends BisqHeadlessAppMain implements BisqSetup.Bis
headlessApp.setGracefulShutDownHandler(this);
}
///////////////////////////////////////////////////////////////////////////////////////////
// We continue with a series of synchronous execution tasks
///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -15,9 +15,10 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.daemon.grpc;
import bisq.core.grpc.model.OfferInfo;
import bisq.core.api.CoreApi;
import bisq.core.api.model.OfferInfo;
import bisq.core.trade.handlers.TransactionResultHandler;
import bisq.proto.grpc.CreateOfferReply;

View file

@ -15,8 +15,9 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.daemon.grpc;
import bisq.core.api.CoreApi;
import bisq.core.payment.PaymentAccount;
import bisq.proto.grpc.CreatePaymentAccountReply;
@ -32,7 +33,7 @@ import javax.inject.Inject;
import java.util.stream.Collectors;
public class GrpcPaymentAccountsService extends PaymentAccountsGrpc.PaymentAccountsImplBase {
class GrpcPaymentAccountsService extends PaymentAccountsGrpc.PaymentAccountsImplBase {
private final CoreApi coreApi;

View file

@ -15,8 +15,9 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.daemon.grpc;
import bisq.core.api.CoreApi;
import bisq.core.trade.statistics.TradeStatistics2;
import bisq.common.config.Config;

View file

@ -15,9 +15,10 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.daemon.grpc;
import bisq.core.grpc.model.AddressBalanceInfo;
import bisq.core.api.CoreApi;
import bisq.core.api.model.AddressBalanceInfo;
import bisq.proto.grpc.GetAddressBalanceReply;
import bisq.proto.grpc.GetAddressBalanceRequest;

View file

@ -15,7 +15,7 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.core.grpc;
package bisq.daemon.grpc;
import io.grpc.Metadata;
import io.grpc.ServerCall;