Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
7 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| var program = require('commander'); | ||
| var commandLine = require(__dirname + '/../lib/command-line'); | ||
|
|
||
| program | ||
| .version(require('../package').version) | ||
| .usage('[options] --domain-name <domain name>') | ||
| .option('-d, --domain-name <domain name>', | ||
| 'name for the new domain', | ||
| String) | ||
| .option('--database-path <path>', | ||
| 'database path [' + commandLine.defaultDatabasePath + ']', | ||
| String, | ||
| commandLine.defaultDatabasePath) | ||
| .parse(process.argv); | ||
|
|
||
| if (!program.domainName) { | ||
| console.log('You must specify the domain name.'); | ||
| return false; | ||
| } | ||
|
|
||
| console.log('Creating domain [' + program.domainName + ']'); | ||
|
|
||
| var context = commandLine.getContext(program.databasePath); | ||
| var domain = new commandLine.Domain(program.domainName, context); | ||
| if (domain.exists()) { | ||
| console.log('The domain [' + program.domainName + '] already exists.'); | ||
| return false; | ||
| } | ||
|
|
||
| domain.createSync(); | ||
|
|
||
| consoole.log('Domain endpoints are currently being created. ' + | ||
| 'Use cs-describe-domain to check for endpoints.'); |
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,42 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| var program = require('commander'); | ||
| var commandLine = require(__dirname + '/../lib/command-line'); | ||
|
|
||
| program | ||
| .version(require('../package').version) | ||
| .usage('[options]') | ||
| .option('-d, --domain-name <domain name>', | ||
| 'name for the new domain', | ||
| String) | ||
| .option('-all, --show-all', | ||
| 'name for the new domain', | ||
| String) | ||
| .option('--database-path <path>', | ||
| 'database path [' + commandLine.defaultDatabasePath + ']', | ||
| String, | ||
| commandLine.defaultDatabasePath) | ||
| .parse(process.argv); | ||
|
|
||
| function report(domain) { | ||
| console.log('Domain Name %s', domain.name); | ||
| console.log('Document Service Endpoint %s', domain.getDocumentsEndpoint('localhost')); | ||
| console.log('Search Endpoint %s', domain.getSearchEndpoint('localhost')); | ||
| console.log('Searchable Documents %s', domain.searchableDocumentsCount); | ||
| console.log('Index Fields %s', domain.name); | ||
| // console.log('Ranking Fields %s', ; | ||
| console.log('SearchPartitionCount %s', domain.searchPartitionCount); | ||
| console.log('SearchInstanceCount %s', domain.searchPartitionCount); | ||
| console.log('SearchInstanceType %s', domain.searchInstanceType); | ||
| } | ||
|
|
||
| var context = commandLine.getContext(program.databasePath); | ||
| if (program.domainName) { | ||
| var domain = new Domain(program.domainName, context); | ||
| report(domain); | ||
| } else { | ||
| Domain.getAll(context).forEach(function(domain, index) { | ||
| if (index) console.log('========================================'); | ||
| report(domain); | ||
| }); | ||
| } |
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,11 @@ | ||
| var nroonga = require('./wrapped-nroonga'); | ||
| var context; | ||
|
|
||
| exports.defaultDatabasePath = process.env.HOME + '/.gcs/database/gcs'; | ||
| exports.defaultPrivilegedRanges = '127.0.0.0/8'; | ||
| exports.getContext = function(databasePath) { | ||
| return context || | ||
| (context = new nroonga.Context(databasePath || exports.defaultDatabasePath)); | ||
| }; | ||
|
|
||
| exports.Domain = require('./database/domain'); |