-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CAS-23 propagate ShareProtocol from the wire to Nexus::share (#2)
* CAS-23 propagate ShareProtocol from the wire to Nexus::share Once the value get to Nexus::shaere, discard it.
- Loading branch information
1 parent
123a44c
commit 80b32a9
Showing
8 changed files
with
143 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const protoLoader = require('@grpc/proto-loader'); | ||
// we can't use grpc-kit because we need to connect to UDS and that's currently | ||
// possible only with grpc-uds. | ||
const grpc = require('grpc-uds'); | ||
|
||
function getConstants() { | ||
const pkgDef = grpc.loadPackageDefinition( | ||
protoLoader.loadSync( | ||
path.join(__dirname, '..', 'rpc', 'proto', 'mayastor.proto'), | ||
{ | ||
// this is to load google/descriptor.proto | ||
includeDirs: ['./node_modules/protobufjs'], | ||
keepCase: true, | ||
longs: String, | ||
enums: String, | ||
defaults: true, | ||
oneofs: true, | ||
} | ||
) | ||
); | ||
|
||
//FIXME: the correct way to do this is to enumerate all the members of ShareProtocol, | ||
// ans create the map from that. This will do for now. | ||
return { | ||
ShareProtocol: { | ||
NONE: pkgDef.mayastor.ShareProtocol.type.value.find(ent => ent.name == 'NONE').number, | ||
NVMF: pkgDef.mayastor.ShareProtocol.type.value.find(ent => ent.name == 'NVMF').number, | ||
ISCSI: pkgDef.mayastor.ShareProtocol.type.value.find(ent => ent.name == 'ISCSI').number, | ||
NBD: pkgDef.mayastor.ShareProtocol.type.value.find(ent => ent.name == 'NBD').number, | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
getConstants, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters