MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Sub

Function Sub

IceFireDB-PubSub/pkg/ppubsub/pubsubStore.go:61–76  ·  view source on GitHub ↗
(local *RESPHandle.WriterHandle, topicName string)

Source from the content-addressed store, hash-verified

59}
60
61func Sub(local *RESPHandle.WriterHandle, topicName string) (*PubSub, error) {
62 if _, ok := pss.join[topicName]; !ok {
63 _, err := JoinPubSub(pss.p2p, "redis-client", topicName)
64 if err != nil {
65 log.Println(err)
66 return nil, err
67 }
68 }
69 lp := fmt.Sprintf("%p", local)
70 if _, ok := pss.writer[topicName]; !ok {
71 pss.writer[topicName] = make(map[string]*RESPHandle.WriterHandle)
72 }
73 pss.writer[topicName][lp] = local
74 ps := pss.join[topicName]
75 return ps, nil
76}
77
78// A structure that represents a PubSub Chat Room
79type PubSub struct {

Callers 1

cmdPsubMethod · 0.92

Calls 1

JoinPubSubFunction · 0.70

Tested by

no test coverage detected