MCPcopy Create free account
hub / github.com/distributedio/titan / BytesArray

Function BytesArray

command/command.go:62–80  ·  view source on GitHub ↗

BytesArray replies a [][]byte when commit

(w io.Writer, a [][]byte)

Source from the content-addressed store, hash-verified

60
61// BytesArray replies a [][]byte when commit
62func BytesArray(w io.Writer, a [][]byte) OnCommit {
63 return func() {
64 start := time.Now()
65 resp.ReplyArray(w, len(a))
66 zap.L().Debug("reply array size", zap.Int64("cost(us)", time.Since(start).Nanoseconds()/1000))
67 start = time.Now()
68 for i := range a {
69 if a[i] == nil {
70 resp.ReplyNullBulkString(w)
71 continue
72 }
73 resp.ReplyBulkString(w, string(a[i]))
74 if i % 10 == 9 {
75 zap.L().Debug("reply 10 bulk string", zap.Int64("cost(us)", time.Since(start).Nanoseconds()/1000))
76 start = time.Now()
77 }
78 }
79 }
80}
81
82// TxnCommand runs a command in transaction
83type TxnCommand func(ctx *Context, txn *db.Transaction) (OnCommit, error)

Callers 15

ObjectFunction · 0.85
KeysFunction · 0.85
MGetFunction · 0.85
SMembersFunction · 0.85
SPopFunction · 0.85
SUnionFunction · 0.85
SInterFunction · 0.85
SDiffFunction · 0.85
LRangeFunction · 0.85
zAnyOrderRangeFunction · 0.85
zAnyOrderRangeByScoreFunction · 0.85
HGetAllFunction · 0.85

Calls 3

ReplyArrayFunction · 0.92
ReplyNullBulkStringFunction · 0.92
ReplyBulkStringFunction · 0.92

Tested by

no test coverage detected