提交 6cd1441d 编写于 作者: H Helin Wang

add bufSize parameter for creating master client

上级 094106ad
......@@ -55,9 +55,9 @@ func (a addresser) Address() string {
}
//export paddle_new_master_client
func paddle_new_master_client(addr *C.char) C.paddle_master_client {
func paddle_new_master_client(addr *C.char, bufSize int) C.paddle_master_client {
a := C.GoString(addr)
c := master.NewClient(addresser(a))
c := master.NewClient(addresser(a), bufSize)
return add(c)
}
......
......@@ -21,10 +21,13 @@ type Client struct {
}
// NewClient creates a new Client.
func NewClient(addr Addresser) *Client {
//
// bufSize is the record buffer size. NextRecord will read from this
// buffer.
func NewClient(addr Addresser, bufSize int) *Client {
c := &Client{}
c.conn = connection.New()
c.ch = make(chan []byte)
c.ch = make(chan []byte, bufSize)
go c.monitorMaster(addr)
go c.getRecords()
return c
......
......@@ -60,7 +60,7 @@ func TestNextRecord(t *testing.T) {
w.Close()
f.Close()
c := master.NewClient(master.TestAddresser(fmt.Sprintf(":%d", p)))
c := master.NewClient(master.TestAddresser(fmt.Sprintf(":%d", p)), 10)
c.SetDataset([]string{path})
for pass := 0; pass < 50; pass++ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册