Skip to content

Commit

Permalink
FABN-903 Rename fabric-network classes
Browse files Browse the repository at this point in the history
Following design review and feedback, rename the following fabric-network classes:
Network -> Gateway
Channel -> Network

Change-Id: Ib30aa1ce00dca573758dd3ea0a0c455519f14c17
Signed-off-by: Dave Kelsey <d_kelsey@uk.ibm.com>
  • Loading branch information
Dave Kelsey committed Sep 4, 2018
1 parent 5ce3363 commit ba2508f
Show file tree
Hide file tree
Showing 15 changed files with 1,069 additions and 1,074 deletions.
2 changes: 1 addition & 1 deletion fabric-network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

module.exports.Network = require('./lib/network');
module.exports.Gateway = require('./lib/gateway');
module.exports.InMemoryWallet = require('./lib/impl/wallet/inmemorywallet');
module.exports.X509WalletMixin = require('./lib/impl/wallet/x509walletmixin');
module.exports.FileSystemWallet = require('./lib/impl/wallet/filesystemwallet');
Expand Down
200 changes: 0 additions & 200 deletions fabric-network/lib/channel.js

This file was deleted.

8 changes: 4 additions & 4 deletions fabric-network/lib/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const util = require('util');

class Contract {

constructor(channel, chaincodeId, network, queryHandler, eventHandlerFactory) {
constructor(channel, chaincodeId, gateway, queryHandler, eventHandlerFactory) {
logger.debug('in Contract constructor');

this.channel = channel;
this.chaincodeId = chaincodeId;
this.network = network;
this.gateway = gateway;
this.queryHandler = queryHandler;
this.eventHandlerFactory = eventHandlerFactory;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ class Contract {

this._verifyTransactionDetails('submitTransaction', transactionName, parameters);

const txId = this.network.getClient().newTransactionID();
const txId = this.gateway.getClient().newTransactionID();
// createTxEventHandler() will return null if no event handler is requested
const eventHandler = this.eventHandlerFactory.createTxEventHandler(txId.getTransactionID());

Expand Down Expand Up @@ -190,7 +190,7 @@ class Contract {
*/
async executeTransaction(transactionName, ...parameters) {
this._verifyTransactionDetails('executeTransaction', transactionName, parameters);
const txId = this.network.getClient().newTransactionID();
const txId = this.gateway.getClient().newTransactionID();
const result = await this.queryHandler.queryChaincode(this.chaincodeId, txId, transactionName, parameters);
return result ? result : null;
}
Expand Down
20 changes: 10 additions & 10 deletions fabric-network/lib/eventstrategies.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
const AllForTxStrategy = require('fabric-network/lib/impl/event/allfortxstrategy');
const AnyForTxStrategy = require('fabric-network/lib/impl/event/anyfortxstrategy');

function MSPID_SCOPE_ALLFORTX(eventHubFactory, channel, mspId) {
const peers = channel.getPeerMap().get(mspId);
function MSPID_SCOPE_ALLFORTX(eventHubFactory, network, mspId) {
const peers = network.getPeerMap().get(mspId);
return new AllForTxStrategy(eventHubFactory, peers);
}

function MSPID_SCOPE_ANYFORTX(eventHubFactory, channel, mspId) {
const peers = channel.getPeerMap().get(mspId);
function MSPID_SCOPE_ANYFORTX(eventHubFactory, network, mspId) {
const peers = network.getPeerMap().get(mspId);
return new AnyForTxStrategy(eventHubFactory, peers);
}

function CHANNEL_SCOPE_ALLFORTX(eventHubFactory, channel, mspId) {
const peers = channel.getInternalChannel().getPeers();
function NETWORK_SCOPE_ALLFORTX(eventHubFactory, network, mspId) {
const peers = network.getChannel().getPeers();
return new AllForTxStrategy(eventHubFactory, peers);
}

function CHANNEL_SCOPE_ANYFORTX(eventHubFactory, channel, mspId) {
const peers = channel.getInternalChannel().getPeers();
function NETWORK_SCOPE_ANYFORTX(eventHubFactory, network, mspId) {
const peers = network.getChannel().getPeers();
return new AnyForTxStrategy(eventHubFactory, peers);
}

module.exports = {
MSPID_SCOPE_ALLFORTX,
MSPID_SCOPE_ANYFORTX,
CHANNEL_SCOPE_ALLFORTX,
CHANNEL_SCOPE_ANYFORTX
NETWORK_SCOPE_ALLFORTX,
NETWORK_SCOPE_ANYFORTX
};
Loading

0 comments on commit ba2508f

Please sign in to comment.