Amazon的DynamoDB差異數據同步:dynamo-sync

jopen 10年前發布 | 16K 次閱讀 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.


項目主頁:http://www.baiduhome.net/lib/view/home/1417188282237

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!