MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / createShard

Function createShard

cmd/client/command/create.go:158–177  ·  view source on GitHub ↗
(cli *client, options *CreateOptions)

Source from the content-addressed store, hash-verified

156}
157
158func createShard(cli *client, options *CreateOptions) error {
159 rsp, err := cli.restyCli.R().
160 SetPathParam("namespace", options.namespace).
161 SetPathParam("cluster", options.cluster).
162 SetBody(map[string]interface{}{
163 "name": options.cluster,
164 "nodes": options.nodes,
165 "password": options.password,
166 }).
167 Post("/namespaces/{namespace}/clusters/{cluster}/shards")
168 if err != nil {
169 return err
170 }
171
172 if rsp.IsError() {
173 return unmarshalError(rsp.Body())
174 }
175 printLine("create the new shard successfully.")
176 return nil
177}
178
179func createNodes(cli *client, options *CreateOptions) error {
180 rsp, err := cli.restyCli.R().

Callers 1

create.goFile · 0.70

Calls 2

unmarshalErrorFunction · 0.85
printLineFunction · 0.85

Tested by

no test coverage detected