MCPcopy
hub / github.com/TarsCloud/TarsGo / ListConfigWithContext

Method ListConfigWithContext

tars/protocol/res/configf/Config.tars.go:87–193  ·  view source on GitHub ↗

ListConfigWithContext is the proxy function for the method defined in the tars file, with the context

(tarsCtx context.Context, app string, server string, vf *[]string, opts ...map[string]string)

Source from the content-addressed store, hash-verified

85
86// ListConfigWithContext is the proxy function for the method defined in the tars file, with the context
87func (obj *Config) ListConfigWithContext(tarsCtx context.Context, app string, server string, vf *[]string, opts ...map[string]string) (ret int32, err error) {
88 var (
89 length int32
90 have bool
91 ty byte
92 )
93 buf := codec.NewBuffer()
94 err = buf.WriteString(app, 1)
95 if err != nil {
96 return ret, err
97 }
98
99 err = buf.WriteString(server, 2)
100 if err != nil {
101 return ret, err
102 }
103
104 err = buf.WriteHead(codec.LIST, 3)
105 if err != nil {
106 return ret, err
107 }
108 err = buf.WriteInt32(int32(len(*vf)), 0)
109 if err != nil {
110 return ret, err
111 }
112 for _, v := range *vf {
113 err = buf.WriteString(v, 0)
114 if err != nil {
115 return ret, err
116 }
117 }
118
119 var statusMap map[string]string
120 var contextMap map[string]string
121 if len(opts) == 1 {
122 contextMap = opts[0]
123 } else if len(opts) == 2 {
124 contextMap = opts[0]
125 statusMap = opts[1]
126 }
127
128 tarsResp := new(requestf.ResponsePacket)
129 err = obj.servant.TarsInvoke(tarsCtx, 0, "ListConfig", buf.ToBytes(), statusMap, contextMap, tarsResp)
130 if err != nil {
131 return ret, err
132 }
133 readBuf := codec.NewReader(tools.Int8ToByte(tarsResp.SBuffer))
134 err = readBuf.ReadInt32(&ret, 0, true)
135 if err != nil {
136 return ret, err
137 }
138
139 _, ty, err = readBuf.SkipToNoCheck(3, true)
140 if err != nil {
141 return ret, err
142 }
143 if ty == codec.LIST {
144 err = readBuf.ReadInt32(&length, 0, true)

Callers 1

ListConfigMethod · 0.95

Calls 12

WriteStringMethod · 0.95
WriteHeadMethod · 0.95
WriteInt32Method · 0.95
ToBytesMethod · 0.95
ReadInt32Method · 0.95
SkipToNoCheckMethod · 0.95
ReadStringMethod · 0.95
NewBufferFunction · 0.92
NewReaderFunction · 0.92
Int8ToByteFunction · 0.92
TarsInvokeMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected