Created
August 25, 2016 21:58
-
-
Save callmehiphop/2eb047a2ab48b9453c21ff4d82a0b1f5 to your computer and use it in GitHub Desktop.
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
{ | |
"id": "bigtable", | |
"type": "class", | |
"name": "Bigtable", | |
"overview": "<p>\n This class allows you interact with Google Cloud Bigtable.\n</p>\n\n<p>\n First, install <code>@google-cloud/bigtable</code> with npm:\n</p>\n\n<div hljs language=\"bash\">$ npm install --save @google-cloud/bigtable</div>\n\n<p>\n If you are running your app on Google Compute Engine, you won't need to worry about supplying connection configuration options to <code>@google-cloud/bigtable</code>— we figure that out for you.\n</p>\n\n<p>\n However, if you're running your app elsewhere, you will need to provide project details to authenticate API requests.\n</p>\n\n<h4>Compute Engine</h4>\n<div hljs language=\"javascript\">\nvar bigtable = require('@google-cloud/bigtable')();\n</div>\n\n<h4>Elsewhere</h4>\n<div hljs language=\"javascript\">\nvar bigtable = require('@google-cloud/bigtable')({\n projectId: 'grape-spaceship-123',\n keyFilename: '/path/to/keyfile.json'\n});\n</div>\n\n<p>\n The full set of options which can be passed to <code>@google-cloud/bigtable</code> are outlined in our <a href=\"#/docs/bigtable/0.1.1/guides/authentication\">Authentication guide</a>.\n</p>\n\n", | |
"description": "", | |
"source": "packages/bigtable/src/index.js", | |
"parent": null, | |
"children": ["bigtable/node_modules", "bigtable/packageon", "bigtable/src", "bigtable/system-test", "bigtable/test"], | |
"methods": [{ | |
"id": "Bigtable", | |
"name": "Bigtable", | |
"type": "constructor", | |
"description": "", | |
"source": "packages/bigtable/src/index.js#L259", | |
"resources": [{ | |
"title": "Creating a Cloud Bigtable Cluster", | |
"link": "https://cloud.google.com/bigtable/docs/creating-compute-instance" | |
}, { | |
"title": "Google Cloud Bigtable Concepts Overview", | |
"link": "https://cloud.google.com/bigtable/docs/concepts" | |
}], | |
"examples": [], | |
"params": [{ | |
"name": "options", | |
"description": "<ul> <li><a href=\"#/docs\">Configuration object</a>.</li> </ul> ", | |
"types": ["object"], | |
"optional": true, | |
"nullable": false | |
}, { | |
"name": "options.cluster", | |
"description": "<ul> <li>The cluster name that hosts your tables.</li> </ul> ", | |
"types": ["string"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "options.zone", | |
"description": "<ul> <li>The zone in which your cluster resides.</li> </ul> <p>//- // <h3>Creating a Cluster</h3> // // Before you create your table, you first need to create a Bigtable Cluster // for the table to be served from. This can be done from either the // Google Cloud Platform Console or the <code>gcloud</code> cli tool. Please refer to // the <a href=\"https://cloud.google.com/bigtable/docs/creating-compute-instance\"> // official Bigtable documentation</a> for more information. //-</p><p>//- // <h3>Creating Tables</h3> // // After creating your cluster and enabling the Bigtable APIs, you are now // ready to create your table with <a data-custom-type=\"bigtable\" data-method=\"createTable\">bigtable#createTable</a>. //- bigtable.createTable('prezzy', function(err, table) { // <code>table</code> is your newly created Table object. });</p><p>//- // <h3>Creating Column Families</h3> // // Column families are used to group together various pieces of data within // your table. You can think of column families as a mechanism to categorize // all of your data. // // We can create a column family with <a data-custom-type=\"bigtable/table\" data-method=\"createFamily\">bigtable/table#createFamily</a>. //- var table = bigtable.table('prezzy');</p><p>table.createFamily('follows', function(err, family) { // <code>family</code> is your newly created Family object. });</p><p>//- // <h3>Creating Rows</h3> // // New rows can be created within your table using // <a data-custom-type=\"bigtable/table\" data-method=\"insert\">bigtable/table#insert</a>. You must provide a unique key for each row // to be inserted, this key can then be used to retrieve your row at a later // time. // // With Bigtable, all columns have a unique id composed of a column family // and a column qualifier. In the example below <code>follows</code> is the column // family and <code>tjefferson</code> is the column qualifier. Together they could be // referred to as <code>follows:tjefferson</code>. //- var rows = [ { key: 'wmckinley', data: { follows: { tjefferson: 1 } } } ];</p><p>table.insert(rows, function(err) { if (!err) { // Your rows were successfully inserted. } });</p><p>//- // <h3>Retrieving Rows</h3> // // If you're anticipating a large number of rows to be returned, we suggest // using the <a data-custom-type=\"bigtable/table\" data-method=\"getRows\">bigtable/table#getRows</a> streaming API. //- table.getRows() .on('error', console.error) .on('data', function(row) { // <code>row</code> is a Row object. });</p><p>//- // If you're not anticpating a large number of results, a callback mode // is also available. //- var callback = function(err, rows) { // <code>rows</code> is an array of Row objects. };</p><p>table.getRows(callback);</p><p>//- // A range of rows can be retrieved by providing <code>start</code> and <code>end</code> row keys. //- var options = { start: 'gwashington', end: 'wmckinley' };</p><p>table.getRows(options, callback);</p><p>//- // Retrieve an individual row with <a data-custom-type=\"bigtable/row\" data-method=\"get\">bigtable/row#get</a>. //- var row = table.row('alincoln');</p><p>row.get(function(err) { // <code>row.data</code> is now populated. });</p><p>//- // <h3>Accessing Row Data</h3> // // When retrieving rows, upon success the <code>row.data</code> property will be // populated by an object. That object will contain additional objects // for each family in your table that the row has data for. // // By default, when retrieving rows, each column qualifier will provide you // with all previous versions of the data. So your <code>row.data</code> object could // resemble the following. //- console.log(row.data); // { // follows: { // wmckinley: [ // { // value: 1, // timestamp: 1466017315951 // }, { // value: 2, // timestamp: 1458619200000 // } // ] // } // }</p><p>//- // The <code>timestamp</code> field can be used to order cells from newest to oldest. // If you only wish to retrieve the most recent version of the data, you // can specify the number of cells with a <a data-custom-type=\"bigtable/filter\" data-method=\"\">bigtable/filter</a> object. //- var filter = [ { column: { cellLimit: 1 } } ];</p><p>table.getRows({ filter: filter }, callback);</p><p>//- // <h3>Deleting Row Data</h3> // // We can delete all of an individual row's cells using // <a data-custom-type=\"bigtable/row\" data-method=\"delete\">bigtable/row#delete</a>. //- var callback = function(err) { if (!err) { // All cells for this row were deleted successfully. } };</p><p>row.delete(callback);</p><p>//- // To delete a specific set of cells, we can provide an array of // column families and qualifiers. //- var cells = [ 'follows:gwashington', 'traits' ];</p><p>row.delete(cells, callback);</p><p>//- // <h3>Deleting Rows</h3> // // If you wish to delete multiple rows entirely, we can do so with // <a data-custom-type=\"bigtable/table\" data-method=\"deleteRows\">bigtable/table#deleteRows</a>. You can provide this method with a // row key prefix. //- var options = { prefix: 'gwash' };</p><p>table.deleteRows(options, function(err) { if (!err) { // Rows were deleted successfully. } });</p><p>//- // If you omit the prefix, you can delete all rows in your table. //- table.deleteRows(function(err) { if (!err) { // All rows were deleted successfully. } });</p>", | |
"types": ["string", "<a data-custom-type=\"compute/zone\" data-method=\"\">compute/zone</a>"], | |
"optional": false, | |
"nullable": false | |
}], | |
"exceptions": [{ | |
"type": "error", | |
"description": "<p>If a cluster is not provided.</p>" | |
}, { | |
"type": "error", | |
"description": "<p>If a zone is not provided.</p>" | |
}], | |
"returns": [] | |
}, { | |
"id": "createTable", | |
"name": "createTable", | |
"type": "instance", | |
"description": "<p>Create a table on your Bigtable cluster.</p>", | |
"source": "packages/bigtable/src/index.js#L396", | |
"resources": [{ | |
"title": "Designing Your Schema", | |
"link": "https://cloud.google.com/bigtable/docs/schema-design" | |
}, { | |
"title": "Splitting Keys", | |
"link": "https://cloud.google.com/bigtable/docs/managing-tables#splits" | |
}], | |
"examples": [{ | |
"code": "var callback = function(err, table, apiResponse) {\n // `table` is a Table object.\n};\n\nbigtable.createTable('prezzy', callback);" | |
}, { | |
"caption": "<p>Optionally specify column families to be created within the table.</p>", | |
"code": "var options = {\n families: ['follows']\n};\n\nbigtable.createTable('prezzy', options, callback);" | |
}, { | |
"caption": "<p>You can also specify garbage collection rules for your column families. \nSee <a data-custom-type=\"bigtable/table\" data-method=\"createFamily\">bigtable/table#createFamily</a> for more information about \ncolumn families and garbage collection rules.</p>", | |
"code": "var options = {\n families: [\n {\n name: 'follows',\n rule: {\n age: {\n seconds: 0,\n nanos: 5000\n },\n versions: 3,\n union: true\n }\n }\n ]\n};\n\nbigtable.createTable('prezzy', options, callback);" | |
}, { | |
"caption": "<p>Pre-split the table based on the row key to spread the load across \nmultiple Cloud Bigtable nodes.</p>", | |
"code": "var options = {\n splits: ['10', '20']\n};\n\nbigtable.createTable('prezzy', options, callback);" | |
}], | |
"params": [{ | |
"name": "name", | |
"description": "<ul> <li>The name of the table.</li> </ul> ", | |
"types": ["string"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "options", | |
"description": "<ul> <li>Table creation options.</li> </ul> ", | |
"types": ["object"], | |
"optional": true, | |
"nullable": false | |
}, { | |
"name": "options.families", | |
"description": "<ul> <li>Column families to be created within the table.</li> </ul> ", | |
"types": ["object", "string[]"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "options.operation", | |
"description": "<ul> <li>Operation used for table that has already been queued to be created.</li> </ul> ", | |
"types": ["string"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "options.splits", | |
"description": "<ul> <li>Initial <a href=\"https://cloud.google.com/bigtable/docs/managing-tables#splits\">split keys</a>.</li> </ul> ", | |
"types": ["string[]"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "callback", | |
"description": "<ul> <li>The callback function.</li> </ul> ", | |
"types": ["function"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "callback.err", | |
"description": "<ul> <li>An error returned while making this request.</li> </ul> ", | |
"types": ["error"], | |
"optional": false, | |
"nullable": true | |
}, { | |
"name": "callback.table", | |
"description": "<ul> <li>The newly created table.</li> </ul> ", | |
"types": ["<a data-custom-type=\"bigtable/table\" data-method=\"\">bigtable/table</a>"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "callback.apiResponse", | |
"description": "<ul> <li>The full API response.</li> </ul> ", | |
"types": ["object"], | |
"optional": false, | |
"nullable": false | |
}], | |
"exceptions": [{ | |
"type": "error", | |
"description": "<p>If a name is not provided.</p>" | |
}], | |
"returns": [] | |
}, { | |
"id": "getTables", | |
"name": "getTables", | |
"type": "instance", | |
"description": "<p>Get Table objects for all the tables in your Bigtable cluster.</p>", | |
"source": "packages/bigtable/src/index.js#L483", | |
"resources": [], | |
"examples": [{ | |
"code": "bigtable.getTables(function(err, tables) {\n if (!err) {\n // `tables` is an array of Table objects.\n }\n});" | |
}], | |
"params": [{ | |
"name": "callback", | |
"description": "<ul> <li>The callback function.</li> </ul> ", | |
"types": ["function"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "callback.err", | |
"description": "<ul> <li>An error returned while making this request.</li> </ul> ", | |
"types": ["error"], | |
"optional": false, | |
"nullable": true | |
}, { | |
"name": "callback.tables", | |
"description": "<ul> <li>List of all Tables.</li> </ul> ", | |
"types": ["<a data-custom-type=\"bigtable/table[]\" data-method=\"\">bigtable/table[]</a>"], | |
"optional": false, | |
"nullable": false | |
}, { | |
"name": "callback.apiResponse", | |
"description": "<ul> <li>The full API response.</li> </ul> ", | |
"types": ["object"], | |
"optional": false, | |
"nullable": false | |
}], | |
"exceptions": [], | |
"returns": [] | |
}, { | |
"id": "table", | |
"name": "table", | |
"type": "instance", | |
"description": "<p>Get a reference to a Bigtable table.</p>", | |
"source": "packages/bigtable/src/index.js#L522", | |
"resources": [], | |
"examples": [{ | |
"code": "var table = bigtable.table('presidents');" | |
}], | |
"params": [{ | |
"name": "name", | |
"description": "<ul> <li>The name of the table.</li> </ul> ", | |
"types": ["string"], | |
"optional": false, | |
"nullable": false | |
}], | |
"exceptions": [], | |
"returns": [{ | |
"types": ["<a data-custom-type=\"bigtable/table\" data-method=\"\">bigtable/table</a>"], | |
"description": "" | |
}] | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment