zhangmeng
2023-05-16 9731130d8be7adc56010f0744ba4a6358d311110
for go get
1个文件已删除
8 文件已重命名
2个文件已修改
264 ■■■■■ 已修改文件
TST/test/test.go 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.go 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/LICENSE 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/README.md 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/channel.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/conn.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/consumer.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/pointer.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/pool.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqcli/producer.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
nsqclient/channel_test.go 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TST/test/test.go
@@ -4,16 +4,16 @@
    "context"
    "fmt"
    "log"
    "nsqclient/nsqclient"
    "nsqclient/nsqcli"
    "time"
)
func produce(two bool) {
    p, _ := nsqclient.NewProducer("192.168.20.108:4150")
    p, _ := nsqcli.NewProducer("192.168.20.108:4150")
    var str string
    for len(str) < 32 {
        str += "cnsqclient dynamic library"
        str += "cnsqcli dynamic library"
    }
    msgx := []byte(str + "--x")
    msgy := []byte(str + "--y")
@@ -40,7 +40,7 @@
func consume(topic, channel string) {
    ctx, cancel := context.WithCancel(context.Background())
    if c, e := nsqclient.NewNsqConsumer(ctx, topic, channel); e != nil {
    if c, e := nsqcli.NewNsqConsumer(ctx, topic, channel); e != nil {
        fmt.Println("NewNsqConsumer failed", e)
        return
    } else {
main.go
@@ -6,7 +6,7 @@
import (
    "nsqclient/TST/test"
    "nsqclient/nsqclient"
    "nsqclient/nsqcli"
    "sync"
    "time"
    "unsafe"
@@ -14,18 +14,18 @@
//export createProducer
func createProducer(addr string) unsafe.Pointer {
    n, _ := nsqclient.NewProducer(addr)
    return nsqclient.Save(n)
    n, _ := nsqcli.NewProducer(addr)
    return nsqcli.Save(n)
}
//export destroyProducer
func destroyProducer(ph unsafe.Pointer) {
    nsqclient.Unref(ph)
    nsqclient.DestroyProducerPool()
    nsqcli.Unref(ph)
    nsqcli.DestroyProducerPool()
}
func pcvt(ph unsafe.Pointer) nsqclient.Producer {
    return nsqclient.Restore(ph).(nsqclient.Producer)
func pcvt(ph unsafe.Pointer) nsqcli.Producer {
    return nsqcli.Restore(ph).(nsqcli.Producer)
}
//export publish
@@ -58,30 +58,30 @@
/////////////////////////////////////////////////////////////
type consumer struct {
    nsqcon *nsqclient.NsqConsumer
    nsqcon *nsqcli.NsqConsumer
    lck    sync.Mutex
    msgs   [][]byte
}
//export createConsumer
func createConsumer(topic, channel string) unsafe.Pointer {
    if c, err := nsqclient.NewNsqConsumer(nil, topic, channel); err == nil {
    if c, err := nsqcli.NewNsqConsumer(nil, topic, channel); err == nil {
        con := &consumer{
            nsqcon: c,
        }
        return nsqclient.Save(con)
        return nsqcli.Save(con)
    }
    return nil
}
func ccvt(ch unsafe.Pointer) *consumer {
    return nsqclient.Restore(ch).(*consumer)
    return nsqcli.Restore(ch).(*consumer)
}
//export destroyConsumer
func destroyConsumer(ch unsafe.Pointer) {
    nsqclient.DestroyNsqConsumer(ccvt(ch).nsqcon)
    nsqclient.Unref(ch)
    nsqcli.DestroyNsqConsumer(ccvt(ch).nsqcon)
    nsqcli.Unref(ch)
}
//export Run
nsqcli/LICENSE
nsqcli/README.md
nsqcli/channel.go
File was renamed from nsqclient/channel.go
@@ -1,4 +1,4 @@
package nsqclient
package nsqcli
import (
    "errors"
nsqcli/conn.go
File was renamed from nsqclient/conn.go
@@ -1,4 +1,4 @@
package nsqclient
package nsqcli
import (
    "sync"
nsqcli/consumer.go
File was renamed from nsqclient/consumer.go
@@ -1,4 +1,4 @@
package nsqclient
package nsqcli
import (
    "context"
nsqcli/pointer.go
File was renamed from nsqclient/pointer.go
@@ -1,4 +1,4 @@
package nsqclient
package nsqcli
// #include <stdlib.h>
import "C"
nsqcli/pool.go
File was renamed from nsqclient/pool.go
@@ -1,5 +1,5 @@
// Package pool implements a pool of net.Conn interfaces to manage and reuse them.
package nsqclient
package nsqcli
import "errors"
nsqcli/producer.go
File was renamed from nsqclient/producer.go
@@ -1,4 +1,4 @@
package nsqclient
package nsqcli
import (
    "fmt"
nsqclient/channel_test.go
File was deleted