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
<?php | |
// 一个一致性hash实现 http://github.com/pda/flexihash | |
require '/path/to/flexihash/include/init.php'; | |
require '/path/to/lysine/loader.php'; | |
// user和topic数据垂直切分 | |
// user数据放在mysql数据库 | |
// topic数据放在postgresql数据库 | |
// topic数据水平切分,分区到3台服务器上 | |
$config = array( |
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
var _ = require('underscore'); | |
var Q = require('q'); | |
var pool = require('any-db').createPool('postgres://dev:[email protected]/lysine', {name: 'test', min: 3, max: 10, log: true}); | |
function query(sql, params) { | |
return _query(sql, params, false); | |
} | |
function stream_query(sql, params) { |
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
var http = require('http'); | |
// Http错误 | |
function HttpError(code, msg) { | |
Error.captureStackTrace(this, arguments.callee); | |
this.name = arguments.callee.name; | |
var status = http.STATUS_CODES; | |
if (!code || !(code in status)) |
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
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"log" | |
"google.golang.org/grpc" | |
"google.golang.org/grpc/credentials/insecure" |
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
package example | |
import ( | |
"context" | |
"errors" | |
"sync/atomic" | |
"time" | |
"github.com/joyparty/gokit" | |
) |