Amazon的DynamoDB差异数据同步:dynamo-sync
dynamo-sync
Amazon的DynamoDB差异数据同步。
Differential data synchronization for Amazon's DynamoDB
Example
var aws = require("aws-sdk") var Table = require("dynamo-sync").Table var db = new aws.DynamoDB var table = Table(db, "myTable") var data = [ {id: 1, name: "Jed"}, {id: 2, name: "Michael"}, {id: 3, name: "Martin"} ] table.push(data, function(err){ if (err) throw err }) API
table = new Table(db, name)
Creates a new table, where db is a DynamoDB instance from the aws-sdk library, and name is the name of the table.
table#pull(local, cb)
Fills the local array with the contents of the remote table.
table#push(local, cb)
Diffs the local array with the remote table, and uses the BatchWriteItem API to issue writes only for keys that have changed. Local keys not present remotely will be put, and remote keys not present locally will be deleted.
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!