github.com/m3db/m3@v1.5.0/src/dbnode/generated/thrift/rpc/tchan-rpc.go (about) 1 // @generated Code generated by thrift-gen. Do not modify. 2 3 // Copyright (c) 2020 Uber Technologies, Inc. 4 // 5 // Permission is hereby granted, free of charge, to any person obtaining a copy 6 // of this software and associated documentation files (the "Software"), to deal 7 // in the Software without restriction, including without limitation the rights 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 // copies of the Software, and to permit persons to whom the Software is 10 // furnished to do so, subject to the following conditions: 11 // 12 // The above copyright notice and this permission notice shall be included in 13 // all copies or substantial portions of the Software. 14 // 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 // THE SOFTWARE. 22 23 // Package rpc is generated code used to make or handle TChannel calls using Thrift. 24 package rpc 25 26 import ( 27 "fmt" 28 29 athrift "github.com/apache/thrift/lib/go/thrift" 30 "github.com/uber/tchannel-go/thrift" 31 ) 32 33 // Interfaces for the service and client for the services defined in the IDL. 34 35 // TChanCluster is the interface that defines the server handler and client interface. 36 type TChanCluster interface { 37 Aggregate(ctx thrift.Context, req *AggregateQueryRequest) (*AggregateQueryResult_, error) 38 Fetch(ctx thrift.Context, req *FetchRequest) (*FetchResult_, error) 39 Health(ctx thrift.Context) (*HealthResult_, error) 40 Query(ctx thrift.Context, req *QueryRequest) (*QueryResult_, error) 41 Truncate(ctx thrift.Context, req *TruncateRequest) (*TruncateResult_, error) 42 Write(ctx thrift.Context, req *WriteRequest) error 43 WriteTagged(ctx thrift.Context, req *WriteTaggedRequest) error 44 } 45 46 // TChanNode is the interface that defines the server handler and client interface. 47 type TChanNode interface { 48 Aggregate(ctx thrift.Context, req *AggregateQueryRequest) (*AggregateQueryResult_, error) 49 AggregateRaw(ctx thrift.Context, req *AggregateQueryRawRequest) (*AggregateQueryRawResult_, error) 50 AggregateTiles(ctx thrift.Context, req *AggregateTilesRequest) (*AggregateTilesResult_, error) 51 Bootstrapped(ctx thrift.Context) (*NodeBootstrappedResult_, error) 52 BootstrappedInPlacementOrNoPlacement(ctx thrift.Context) (*NodeBootstrappedInPlacementOrNoPlacementResult_, error) 53 DebugIndexMemorySegments(ctx thrift.Context, req *DebugIndexMemorySegmentsRequest) (*DebugIndexMemorySegmentsResult_, error) 54 DebugProfileStart(ctx thrift.Context, req *DebugProfileStartRequest) (*DebugProfileStartResult_, error) 55 DebugProfileStop(ctx thrift.Context, req *DebugProfileStopRequest) (*DebugProfileStopResult_, error) 56 Fetch(ctx thrift.Context, req *FetchRequest) (*FetchResult_, error) 57 FetchBatchRaw(ctx thrift.Context, req *FetchBatchRawRequest) (*FetchBatchRawResult_, error) 58 FetchBatchRawV2(ctx thrift.Context, req *FetchBatchRawV2Request) (*FetchBatchRawResult_, error) 59 FetchBlocksMetadataRawV2(ctx thrift.Context, req *FetchBlocksMetadataRawV2Request) (*FetchBlocksMetadataRawV2Result_, error) 60 FetchBlocksRaw(ctx thrift.Context, req *FetchBlocksRawRequest) (*FetchBlocksRawResult_, error) 61 FetchTagged(ctx thrift.Context, req *FetchTaggedRequest) (*FetchTaggedResult_, error) 62 GetPersistRateLimit(ctx thrift.Context) (*NodePersistRateLimitResult_, error) 63 GetWriteNewSeriesAsync(ctx thrift.Context) (*NodeWriteNewSeriesAsyncResult_, error) 64 GetWriteNewSeriesBackoffDuration(ctx thrift.Context) (*NodeWriteNewSeriesBackoffDurationResult_, error) 65 GetWriteNewSeriesLimitPerShardPerSecond(ctx thrift.Context) (*NodeWriteNewSeriesLimitPerShardPerSecondResult_, error) 66 Health(ctx thrift.Context) (*NodeHealthResult_, error) 67 Query(ctx thrift.Context, req *QueryRequest) (*QueryResult_, error) 68 Repair(ctx thrift.Context) error 69 SetPersistRateLimit(ctx thrift.Context, req *NodeSetPersistRateLimitRequest) (*NodePersistRateLimitResult_, error) 70 SetWriteNewSeriesAsync(ctx thrift.Context, req *NodeSetWriteNewSeriesAsyncRequest) (*NodeWriteNewSeriesAsyncResult_, error) 71 SetWriteNewSeriesBackoffDuration(ctx thrift.Context, req *NodeSetWriteNewSeriesBackoffDurationRequest) (*NodeWriteNewSeriesBackoffDurationResult_, error) 72 SetWriteNewSeriesLimitPerShardPerSecond(ctx thrift.Context, req *NodeSetWriteNewSeriesLimitPerShardPerSecondRequest) (*NodeWriteNewSeriesLimitPerShardPerSecondResult_, error) 73 Truncate(ctx thrift.Context, req *TruncateRequest) (*TruncateResult_, error) 74 Write(ctx thrift.Context, req *WriteRequest) error 75 WriteBatchRaw(ctx thrift.Context, req *WriteBatchRawRequest) error 76 WriteBatchRawV2(ctx thrift.Context, req *WriteBatchRawV2Request) error 77 WriteTagged(ctx thrift.Context, req *WriteTaggedRequest) error 78 WriteTaggedBatchRaw(ctx thrift.Context, req *WriteTaggedBatchRawRequest) error 79 WriteTaggedBatchRawV2(ctx thrift.Context, req *WriteTaggedBatchRawV2Request) error 80 } 81 82 // Implementation of a client and service handler. 83 84 type tchanClusterClient struct { 85 thriftService string 86 client thrift.TChanClient 87 } 88 89 func NewTChanClusterInheritedClient(thriftService string, client thrift.TChanClient) *tchanClusterClient { 90 return &tchanClusterClient{ 91 thriftService, 92 client, 93 } 94 } 95 96 // NewTChanClusterClient creates a client that can be used to make remote calls. 97 func NewTChanClusterClient(client thrift.TChanClient) TChanCluster { 98 return NewTChanClusterInheritedClient("Cluster", client) 99 } 100 101 func (c *tchanClusterClient) Aggregate(ctx thrift.Context, req *AggregateQueryRequest) (*AggregateQueryResult_, error) { 102 var resp ClusterAggregateResult 103 args := ClusterAggregateArgs{ 104 Req: req, 105 } 106 success, err := c.client.Call(ctx, c.thriftService, "aggregate", &args, &resp) 107 if err == nil && !success { 108 switch { 109 case resp.Err != nil: 110 err = resp.Err 111 default: 112 err = fmt.Errorf("received no result or unknown exception for aggregate") 113 } 114 } 115 116 return resp.GetSuccess(), err 117 } 118 119 func (c *tchanClusterClient) Fetch(ctx thrift.Context, req *FetchRequest) (*FetchResult_, error) { 120 var resp ClusterFetchResult 121 args := ClusterFetchArgs{ 122 Req: req, 123 } 124 success, err := c.client.Call(ctx, c.thriftService, "fetch", &args, &resp) 125 if err == nil && !success { 126 switch { 127 case resp.Err != nil: 128 err = resp.Err 129 default: 130 err = fmt.Errorf("received no result or unknown exception for fetch") 131 } 132 } 133 134 return resp.GetSuccess(), err 135 } 136 137 func (c *tchanClusterClient) Health(ctx thrift.Context) (*HealthResult_, error) { 138 var resp ClusterHealthResult 139 args := ClusterHealthArgs{} 140 success, err := c.client.Call(ctx, c.thriftService, "health", &args, &resp) 141 if err == nil && !success { 142 switch { 143 case resp.Err != nil: 144 err = resp.Err 145 default: 146 err = fmt.Errorf("received no result or unknown exception for health") 147 } 148 } 149 150 return resp.GetSuccess(), err 151 } 152 153 func (c *tchanClusterClient) Query(ctx thrift.Context, req *QueryRequest) (*QueryResult_, error) { 154 var resp ClusterQueryResult 155 args := ClusterQueryArgs{ 156 Req: req, 157 } 158 success, err := c.client.Call(ctx, c.thriftService, "query", &args, &resp) 159 if err == nil && !success { 160 switch { 161 case resp.Err != nil: 162 err = resp.Err 163 default: 164 err = fmt.Errorf("received no result or unknown exception for query") 165 } 166 } 167 168 return resp.GetSuccess(), err 169 } 170 171 func (c *tchanClusterClient) Truncate(ctx thrift.Context, req *TruncateRequest) (*TruncateResult_, error) { 172 var resp ClusterTruncateResult 173 args := ClusterTruncateArgs{ 174 Req: req, 175 } 176 success, err := c.client.Call(ctx, c.thriftService, "truncate", &args, &resp) 177 if err == nil && !success { 178 switch { 179 case resp.Err != nil: 180 err = resp.Err 181 default: 182 err = fmt.Errorf("received no result or unknown exception for truncate") 183 } 184 } 185 186 return resp.GetSuccess(), err 187 } 188 189 func (c *tchanClusterClient) Write(ctx thrift.Context, req *WriteRequest) error { 190 var resp ClusterWriteResult 191 args := ClusterWriteArgs{ 192 Req: req, 193 } 194 success, err := c.client.Call(ctx, c.thriftService, "write", &args, &resp) 195 if err == nil && !success { 196 switch { 197 case resp.Err != nil: 198 err = resp.Err 199 default: 200 err = fmt.Errorf("received no result or unknown exception for write") 201 } 202 } 203 204 return err 205 } 206 207 func (c *tchanClusterClient) WriteTagged(ctx thrift.Context, req *WriteTaggedRequest) error { 208 var resp ClusterWriteTaggedResult 209 args := ClusterWriteTaggedArgs{ 210 Req: req, 211 } 212 success, err := c.client.Call(ctx, c.thriftService, "writeTagged", &args, &resp) 213 if err == nil && !success { 214 switch { 215 case resp.Err != nil: 216 err = resp.Err 217 default: 218 err = fmt.Errorf("received no result or unknown exception for writeTagged") 219 } 220 } 221 222 return err 223 } 224 225 type tchanClusterServer struct { 226 handler TChanCluster 227 } 228 229 // NewTChanClusterServer wraps a handler for TChanCluster so it can be 230 // registered with a thrift.Server. 231 func NewTChanClusterServer(handler TChanCluster) thrift.TChanServer { 232 return &tchanClusterServer{ 233 handler, 234 } 235 } 236 237 func (s *tchanClusterServer) Service() string { 238 return "Cluster" 239 } 240 241 func (s *tchanClusterServer) Methods() []string { 242 return []string{ 243 "aggregate", 244 "fetch", 245 "health", 246 "query", 247 "truncate", 248 "write", 249 "writeTagged", 250 } 251 } 252 253 func (s *tchanClusterServer) Handle(ctx thrift.Context, methodName string, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 254 switch methodName { 255 case "aggregate": 256 return s.handleAggregate(ctx, protocol) 257 case "fetch": 258 return s.handleFetch(ctx, protocol) 259 case "health": 260 return s.handleHealth(ctx, protocol) 261 case "query": 262 return s.handleQuery(ctx, protocol) 263 case "truncate": 264 return s.handleTruncate(ctx, protocol) 265 case "write": 266 return s.handleWrite(ctx, protocol) 267 case "writeTagged": 268 return s.handleWriteTagged(ctx, protocol) 269 270 default: 271 return false, nil, fmt.Errorf("method %v not found in service %v", methodName, s.Service()) 272 } 273 } 274 275 func (s *tchanClusterServer) handleAggregate(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 276 var req ClusterAggregateArgs 277 var res ClusterAggregateResult 278 279 if err := req.Read(protocol); err != nil { 280 return false, nil, err 281 } 282 283 r, err := 284 s.handler.Aggregate(ctx, req.Req) 285 286 if err != nil { 287 switch v := err.(type) { 288 case *Error: 289 if v == nil { 290 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 291 } 292 res.Err = v 293 default: 294 return false, nil, err 295 } 296 } else { 297 res.Success = r 298 } 299 300 return err == nil, &res, nil 301 } 302 303 func (s *tchanClusterServer) handleFetch(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 304 var req ClusterFetchArgs 305 var res ClusterFetchResult 306 307 if err := req.Read(protocol); err != nil { 308 return false, nil, err 309 } 310 311 r, err := 312 s.handler.Fetch(ctx, req.Req) 313 314 if err != nil { 315 switch v := err.(type) { 316 case *Error: 317 if v == nil { 318 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 319 } 320 res.Err = v 321 default: 322 return false, nil, err 323 } 324 } else { 325 res.Success = r 326 } 327 328 return err == nil, &res, nil 329 } 330 331 func (s *tchanClusterServer) handleHealth(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 332 var req ClusterHealthArgs 333 var res ClusterHealthResult 334 335 if err := req.Read(protocol); err != nil { 336 return false, nil, err 337 } 338 339 r, err := 340 s.handler.Health(ctx) 341 342 if err != nil { 343 switch v := err.(type) { 344 case *Error: 345 if v == nil { 346 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 347 } 348 res.Err = v 349 default: 350 return false, nil, err 351 } 352 } else { 353 res.Success = r 354 } 355 356 return err == nil, &res, nil 357 } 358 359 func (s *tchanClusterServer) handleQuery(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 360 var req ClusterQueryArgs 361 var res ClusterQueryResult 362 363 if err := req.Read(protocol); err != nil { 364 return false, nil, err 365 } 366 367 r, err := 368 s.handler.Query(ctx, req.Req) 369 370 if err != nil { 371 switch v := err.(type) { 372 case *Error: 373 if v == nil { 374 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 375 } 376 res.Err = v 377 default: 378 return false, nil, err 379 } 380 } else { 381 res.Success = r 382 } 383 384 return err == nil, &res, nil 385 } 386 387 func (s *tchanClusterServer) handleTruncate(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 388 var req ClusterTruncateArgs 389 var res ClusterTruncateResult 390 391 if err := req.Read(protocol); err != nil { 392 return false, nil, err 393 } 394 395 r, err := 396 s.handler.Truncate(ctx, req.Req) 397 398 if err != nil { 399 switch v := err.(type) { 400 case *Error: 401 if v == nil { 402 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 403 } 404 res.Err = v 405 default: 406 return false, nil, err 407 } 408 } else { 409 res.Success = r 410 } 411 412 return err == nil, &res, nil 413 } 414 415 func (s *tchanClusterServer) handleWrite(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 416 var req ClusterWriteArgs 417 var res ClusterWriteResult 418 419 if err := req.Read(protocol); err != nil { 420 return false, nil, err 421 } 422 423 err := 424 s.handler.Write(ctx, req.Req) 425 426 if err != nil { 427 switch v := err.(type) { 428 case *Error: 429 if v == nil { 430 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 431 } 432 res.Err = v 433 default: 434 return false, nil, err 435 } 436 } else { 437 } 438 439 return err == nil, &res, nil 440 } 441 442 func (s *tchanClusterServer) handleWriteTagged(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 443 var req ClusterWriteTaggedArgs 444 var res ClusterWriteTaggedResult 445 446 if err := req.Read(protocol); err != nil { 447 return false, nil, err 448 } 449 450 err := 451 s.handler.WriteTagged(ctx, req.Req) 452 453 if err != nil { 454 switch v := err.(type) { 455 case *Error: 456 if v == nil { 457 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 458 } 459 res.Err = v 460 default: 461 return false, nil, err 462 } 463 } else { 464 } 465 466 return err == nil, &res, nil 467 } 468 469 type tchanNodeClient struct { 470 thriftService string 471 client thrift.TChanClient 472 } 473 474 func NewTChanNodeInheritedClient(thriftService string, client thrift.TChanClient) *tchanNodeClient { 475 return &tchanNodeClient{ 476 thriftService, 477 client, 478 } 479 } 480 481 // NewTChanNodeClient creates a client that can be used to make remote calls. 482 func NewTChanNodeClient(client thrift.TChanClient) TChanNode { 483 return NewTChanNodeInheritedClient("Node", client) 484 } 485 486 func (c *tchanNodeClient) Aggregate(ctx thrift.Context, req *AggregateQueryRequest) (*AggregateQueryResult_, error) { 487 var resp NodeAggregateResult 488 args := NodeAggregateArgs{ 489 Req: req, 490 } 491 success, err := c.client.Call(ctx, c.thriftService, "aggregate", &args, &resp) 492 if err == nil && !success { 493 switch { 494 case resp.Err != nil: 495 err = resp.Err 496 default: 497 err = fmt.Errorf("received no result or unknown exception for aggregate") 498 } 499 } 500 501 return resp.GetSuccess(), err 502 } 503 504 func (c *tchanNodeClient) AggregateRaw(ctx thrift.Context, req *AggregateQueryRawRequest) (*AggregateQueryRawResult_, error) { 505 var resp NodeAggregateRawResult 506 args := NodeAggregateRawArgs{ 507 Req: req, 508 } 509 success, err := c.client.Call(ctx, c.thriftService, "aggregateRaw", &args, &resp) 510 if err == nil && !success { 511 switch { 512 case resp.Err != nil: 513 err = resp.Err 514 default: 515 err = fmt.Errorf("received no result or unknown exception for aggregateRaw") 516 } 517 } 518 519 return resp.GetSuccess(), err 520 } 521 522 func (c *tchanNodeClient) AggregateTiles(ctx thrift.Context, req *AggregateTilesRequest) (*AggregateTilesResult_, error) { 523 var resp NodeAggregateTilesResult 524 args := NodeAggregateTilesArgs{ 525 Req: req, 526 } 527 success, err := c.client.Call(ctx, c.thriftService, "aggregateTiles", &args, &resp) 528 if err == nil && !success { 529 switch { 530 case resp.Err != nil: 531 err = resp.Err 532 default: 533 err = fmt.Errorf("received no result or unknown exception for aggregateTiles") 534 } 535 } 536 537 return resp.GetSuccess(), err 538 } 539 540 func (c *tchanNodeClient) Bootstrapped(ctx thrift.Context) (*NodeBootstrappedResult_, error) { 541 var resp NodeBootstrappedResult 542 args := NodeBootstrappedArgs{} 543 success, err := c.client.Call(ctx, c.thriftService, "bootstrapped", &args, &resp) 544 if err == nil && !success { 545 switch { 546 case resp.Err != nil: 547 err = resp.Err 548 default: 549 err = fmt.Errorf("received no result or unknown exception for bootstrapped") 550 } 551 } 552 553 return resp.GetSuccess(), err 554 } 555 556 func (c *tchanNodeClient) BootstrappedInPlacementOrNoPlacement(ctx thrift.Context) (*NodeBootstrappedInPlacementOrNoPlacementResult_, error) { 557 var resp NodeBootstrappedInPlacementOrNoPlacementResult 558 args := NodeBootstrappedInPlacementOrNoPlacementArgs{} 559 success, err := c.client.Call(ctx, c.thriftService, "bootstrappedInPlacementOrNoPlacement", &args, &resp) 560 if err == nil && !success { 561 switch { 562 case resp.Err != nil: 563 err = resp.Err 564 default: 565 err = fmt.Errorf("received no result or unknown exception for bootstrappedInPlacementOrNoPlacement") 566 } 567 } 568 569 return resp.GetSuccess(), err 570 } 571 572 func (c *tchanNodeClient) DebugIndexMemorySegments(ctx thrift.Context, req *DebugIndexMemorySegmentsRequest) (*DebugIndexMemorySegmentsResult_, error) { 573 var resp NodeDebugIndexMemorySegmentsResult 574 args := NodeDebugIndexMemorySegmentsArgs{ 575 Req: req, 576 } 577 success, err := c.client.Call(ctx, c.thriftService, "debugIndexMemorySegments", &args, &resp) 578 if err == nil && !success { 579 switch { 580 case resp.Err != nil: 581 err = resp.Err 582 default: 583 err = fmt.Errorf("received no result or unknown exception for debugIndexMemorySegments") 584 } 585 } 586 587 return resp.GetSuccess(), err 588 } 589 590 func (c *tchanNodeClient) DebugProfileStart(ctx thrift.Context, req *DebugProfileStartRequest) (*DebugProfileStartResult_, error) { 591 var resp NodeDebugProfileStartResult 592 args := NodeDebugProfileStartArgs{ 593 Req: req, 594 } 595 success, err := c.client.Call(ctx, c.thriftService, "debugProfileStart", &args, &resp) 596 if err == nil && !success { 597 switch { 598 case resp.Err != nil: 599 err = resp.Err 600 default: 601 err = fmt.Errorf("received no result or unknown exception for debugProfileStart") 602 } 603 } 604 605 return resp.GetSuccess(), err 606 } 607 608 func (c *tchanNodeClient) DebugProfileStop(ctx thrift.Context, req *DebugProfileStopRequest) (*DebugProfileStopResult_, error) { 609 var resp NodeDebugProfileStopResult 610 args := NodeDebugProfileStopArgs{ 611 Req: req, 612 } 613 success, err := c.client.Call(ctx, c.thriftService, "debugProfileStop", &args, &resp) 614 if err == nil && !success { 615 switch { 616 case resp.Err != nil: 617 err = resp.Err 618 default: 619 err = fmt.Errorf("received no result or unknown exception for debugProfileStop") 620 } 621 } 622 623 return resp.GetSuccess(), err 624 } 625 626 func (c *tchanNodeClient) Fetch(ctx thrift.Context, req *FetchRequest) (*FetchResult_, error) { 627 var resp NodeFetchResult 628 args := NodeFetchArgs{ 629 Req: req, 630 } 631 success, err := c.client.Call(ctx, c.thriftService, "fetch", &args, &resp) 632 if err == nil && !success { 633 switch { 634 case resp.Err != nil: 635 err = resp.Err 636 default: 637 err = fmt.Errorf("received no result or unknown exception for fetch") 638 } 639 } 640 641 return resp.GetSuccess(), err 642 } 643 644 func (c *tchanNodeClient) FetchBatchRaw(ctx thrift.Context, req *FetchBatchRawRequest) (*FetchBatchRawResult_, error) { 645 var resp NodeFetchBatchRawResult 646 args := NodeFetchBatchRawArgs{ 647 Req: req, 648 } 649 success, err := c.client.Call(ctx, c.thriftService, "fetchBatchRaw", &args, &resp) 650 if err == nil && !success { 651 switch { 652 case resp.Err != nil: 653 err = resp.Err 654 default: 655 err = fmt.Errorf("received no result or unknown exception for fetchBatchRaw") 656 } 657 } 658 659 return resp.GetSuccess(), err 660 } 661 662 func (c *tchanNodeClient) FetchBatchRawV2(ctx thrift.Context, req *FetchBatchRawV2Request) (*FetchBatchRawResult_, error) { 663 var resp NodeFetchBatchRawV2Result 664 args := NodeFetchBatchRawV2Args{ 665 Req: req, 666 } 667 success, err := c.client.Call(ctx, c.thriftService, "fetchBatchRawV2", &args, &resp) 668 if err == nil && !success { 669 switch { 670 case resp.Err != nil: 671 err = resp.Err 672 default: 673 err = fmt.Errorf("received no result or unknown exception for fetchBatchRawV2") 674 } 675 } 676 677 return resp.GetSuccess(), err 678 } 679 680 func (c *tchanNodeClient) FetchBlocksMetadataRawV2(ctx thrift.Context, req *FetchBlocksMetadataRawV2Request) (*FetchBlocksMetadataRawV2Result_, error) { 681 var resp NodeFetchBlocksMetadataRawV2Result 682 args := NodeFetchBlocksMetadataRawV2Args{ 683 Req: req, 684 } 685 success, err := c.client.Call(ctx, c.thriftService, "fetchBlocksMetadataRawV2", &args, &resp) 686 if err == nil && !success { 687 switch { 688 case resp.Err != nil: 689 err = resp.Err 690 default: 691 err = fmt.Errorf("received no result or unknown exception for fetchBlocksMetadataRawV2") 692 } 693 } 694 695 return resp.GetSuccess(), err 696 } 697 698 func (c *tchanNodeClient) FetchBlocksRaw(ctx thrift.Context, req *FetchBlocksRawRequest) (*FetchBlocksRawResult_, error) { 699 var resp NodeFetchBlocksRawResult 700 args := NodeFetchBlocksRawArgs{ 701 Req: req, 702 } 703 success, err := c.client.Call(ctx, c.thriftService, "fetchBlocksRaw", &args, &resp) 704 if err == nil && !success { 705 switch { 706 case resp.Err != nil: 707 err = resp.Err 708 default: 709 err = fmt.Errorf("received no result or unknown exception for fetchBlocksRaw") 710 } 711 } 712 713 return resp.GetSuccess(), err 714 } 715 716 func (c *tchanNodeClient) FetchTagged(ctx thrift.Context, req *FetchTaggedRequest) (*FetchTaggedResult_, error) { 717 var resp NodeFetchTaggedResult 718 args := NodeFetchTaggedArgs{ 719 Req: req, 720 } 721 success, err := c.client.Call(ctx, c.thriftService, "fetchTagged", &args, &resp) 722 if err == nil && !success { 723 switch { 724 case resp.Err != nil: 725 err = resp.Err 726 default: 727 err = fmt.Errorf("received no result or unknown exception for fetchTagged") 728 } 729 } 730 731 return resp.GetSuccess(), err 732 } 733 734 func (c *tchanNodeClient) GetPersistRateLimit(ctx thrift.Context) (*NodePersistRateLimitResult_, error) { 735 var resp NodeGetPersistRateLimitResult 736 args := NodeGetPersistRateLimitArgs{} 737 success, err := c.client.Call(ctx, c.thriftService, "getPersistRateLimit", &args, &resp) 738 if err == nil && !success { 739 switch { 740 case resp.Err != nil: 741 err = resp.Err 742 default: 743 err = fmt.Errorf("received no result or unknown exception for getPersistRateLimit") 744 } 745 } 746 747 return resp.GetSuccess(), err 748 } 749 750 func (c *tchanNodeClient) GetWriteNewSeriesAsync(ctx thrift.Context) (*NodeWriteNewSeriesAsyncResult_, error) { 751 var resp NodeGetWriteNewSeriesAsyncResult 752 args := NodeGetWriteNewSeriesAsyncArgs{} 753 success, err := c.client.Call(ctx, c.thriftService, "getWriteNewSeriesAsync", &args, &resp) 754 if err == nil && !success { 755 switch { 756 case resp.Err != nil: 757 err = resp.Err 758 default: 759 err = fmt.Errorf("received no result or unknown exception for getWriteNewSeriesAsync") 760 } 761 } 762 763 return resp.GetSuccess(), err 764 } 765 766 func (c *tchanNodeClient) GetWriteNewSeriesBackoffDuration(ctx thrift.Context) (*NodeWriteNewSeriesBackoffDurationResult_, error) { 767 var resp NodeGetWriteNewSeriesBackoffDurationResult 768 args := NodeGetWriteNewSeriesBackoffDurationArgs{} 769 success, err := c.client.Call(ctx, c.thriftService, "getWriteNewSeriesBackoffDuration", &args, &resp) 770 if err == nil && !success { 771 switch { 772 case resp.Err != nil: 773 err = resp.Err 774 default: 775 err = fmt.Errorf("received no result or unknown exception for getWriteNewSeriesBackoffDuration") 776 } 777 } 778 779 return resp.GetSuccess(), err 780 } 781 782 func (c *tchanNodeClient) GetWriteNewSeriesLimitPerShardPerSecond(ctx thrift.Context) (*NodeWriteNewSeriesLimitPerShardPerSecondResult_, error) { 783 var resp NodeGetWriteNewSeriesLimitPerShardPerSecondResult 784 args := NodeGetWriteNewSeriesLimitPerShardPerSecondArgs{} 785 success, err := c.client.Call(ctx, c.thriftService, "getWriteNewSeriesLimitPerShardPerSecond", &args, &resp) 786 if err == nil && !success { 787 switch { 788 case resp.Err != nil: 789 err = resp.Err 790 default: 791 err = fmt.Errorf("received no result or unknown exception for getWriteNewSeriesLimitPerShardPerSecond") 792 } 793 } 794 795 return resp.GetSuccess(), err 796 } 797 798 func (c *tchanNodeClient) Health(ctx thrift.Context) (*NodeHealthResult_, error) { 799 var resp NodeHealthResult 800 args := NodeHealthArgs{} 801 success, err := c.client.Call(ctx, c.thriftService, "health", &args, &resp) 802 if err == nil && !success { 803 switch { 804 case resp.Err != nil: 805 err = resp.Err 806 default: 807 err = fmt.Errorf("received no result or unknown exception for health") 808 } 809 } 810 811 return resp.GetSuccess(), err 812 } 813 814 func (c *tchanNodeClient) Query(ctx thrift.Context, req *QueryRequest) (*QueryResult_, error) { 815 var resp NodeQueryResult 816 args := NodeQueryArgs{ 817 Req: req, 818 } 819 success, err := c.client.Call(ctx, c.thriftService, "query", &args, &resp) 820 if err == nil && !success { 821 switch { 822 case resp.Err != nil: 823 err = resp.Err 824 default: 825 err = fmt.Errorf("received no result or unknown exception for query") 826 } 827 } 828 829 return resp.GetSuccess(), err 830 } 831 832 func (c *tchanNodeClient) Repair(ctx thrift.Context) error { 833 var resp NodeRepairResult 834 args := NodeRepairArgs{} 835 success, err := c.client.Call(ctx, c.thriftService, "repair", &args, &resp) 836 if err == nil && !success { 837 switch { 838 case resp.Err != nil: 839 err = resp.Err 840 default: 841 err = fmt.Errorf("received no result or unknown exception for repair") 842 } 843 } 844 845 return err 846 } 847 848 func (c *tchanNodeClient) SetPersistRateLimit(ctx thrift.Context, req *NodeSetPersistRateLimitRequest) (*NodePersistRateLimitResult_, error) { 849 var resp NodeSetPersistRateLimitResult 850 args := NodeSetPersistRateLimitArgs{ 851 Req: req, 852 } 853 success, err := c.client.Call(ctx, c.thriftService, "setPersistRateLimit", &args, &resp) 854 if err == nil && !success { 855 switch { 856 case resp.Err != nil: 857 err = resp.Err 858 default: 859 err = fmt.Errorf("received no result or unknown exception for setPersistRateLimit") 860 } 861 } 862 863 return resp.GetSuccess(), err 864 } 865 866 func (c *tchanNodeClient) SetWriteNewSeriesAsync(ctx thrift.Context, req *NodeSetWriteNewSeriesAsyncRequest) (*NodeWriteNewSeriesAsyncResult_, error) { 867 var resp NodeSetWriteNewSeriesAsyncResult 868 args := NodeSetWriteNewSeriesAsyncArgs{ 869 Req: req, 870 } 871 success, err := c.client.Call(ctx, c.thriftService, "setWriteNewSeriesAsync", &args, &resp) 872 if err == nil && !success { 873 switch { 874 case resp.Err != nil: 875 err = resp.Err 876 default: 877 err = fmt.Errorf("received no result or unknown exception for setWriteNewSeriesAsync") 878 } 879 } 880 881 return resp.GetSuccess(), err 882 } 883 884 func (c *tchanNodeClient) SetWriteNewSeriesBackoffDuration(ctx thrift.Context, req *NodeSetWriteNewSeriesBackoffDurationRequest) (*NodeWriteNewSeriesBackoffDurationResult_, error) { 885 var resp NodeSetWriteNewSeriesBackoffDurationResult 886 args := NodeSetWriteNewSeriesBackoffDurationArgs{ 887 Req: req, 888 } 889 success, err := c.client.Call(ctx, c.thriftService, "setWriteNewSeriesBackoffDuration", &args, &resp) 890 if err == nil && !success { 891 switch { 892 case resp.Err != nil: 893 err = resp.Err 894 default: 895 err = fmt.Errorf("received no result or unknown exception for setWriteNewSeriesBackoffDuration") 896 } 897 } 898 899 return resp.GetSuccess(), err 900 } 901 902 func (c *tchanNodeClient) SetWriteNewSeriesLimitPerShardPerSecond(ctx thrift.Context, req *NodeSetWriteNewSeriesLimitPerShardPerSecondRequest) (*NodeWriteNewSeriesLimitPerShardPerSecondResult_, error) { 903 var resp NodeSetWriteNewSeriesLimitPerShardPerSecondResult 904 args := NodeSetWriteNewSeriesLimitPerShardPerSecondArgs{ 905 Req: req, 906 } 907 success, err := c.client.Call(ctx, c.thriftService, "setWriteNewSeriesLimitPerShardPerSecond", &args, &resp) 908 if err == nil && !success { 909 switch { 910 case resp.Err != nil: 911 err = resp.Err 912 default: 913 err = fmt.Errorf("received no result or unknown exception for setWriteNewSeriesLimitPerShardPerSecond") 914 } 915 } 916 917 return resp.GetSuccess(), err 918 } 919 920 func (c *tchanNodeClient) Truncate(ctx thrift.Context, req *TruncateRequest) (*TruncateResult_, error) { 921 var resp NodeTruncateResult 922 args := NodeTruncateArgs{ 923 Req: req, 924 } 925 success, err := c.client.Call(ctx, c.thriftService, "truncate", &args, &resp) 926 if err == nil && !success { 927 switch { 928 case resp.Err != nil: 929 err = resp.Err 930 default: 931 err = fmt.Errorf("received no result or unknown exception for truncate") 932 } 933 } 934 935 return resp.GetSuccess(), err 936 } 937 938 func (c *tchanNodeClient) Write(ctx thrift.Context, req *WriteRequest) error { 939 var resp NodeWriteResult 940 args := NodeWriteArgs{ 941 Req: req, 942 } 943 success, err := c.client.Call(ctx, c.thriftService, "write", &args, &resp) 944 if err == nil && !success { 945 switch { 946 case resp.Err != nil: 947 err = resp.Err 948 default: 949 err = fmt.Errorf("received no result or unknown exception for write") 950 } 951 } 952 953 return err 954 } 955 956 func (c *tchanNodeClient) WriteBatchRaw(ctx thrift.Context, req *WriteBatchRawRequest) error { 957 var resp NodeWriteBatchRawResult 958 args := NodeWriteBatchRawArgs{ 959 Req: req, 960 } 961 success, err := c.client.Call(ctx, c.thriftService, "writeBatchRaw", &args, &resp) 962 if err == nil && !success { 963 switch { 964 case resp.Err != nil: 965 err = resp.Err 966 default: 967 err = fmt.Errorf("received no result or unknown exception for writeBatchRaw") 968 } 969 } 970 971 return err 972 } 973 974 func (c *tchanNodeClient) WriteBatchRawV2(ctx thrift.Context, req *WriteBatchRawV2Request) error { 975 var resp NodeWriteBatchRawV2Result 976 args := NodeWriteBatchRawV2Args{ 977 Req: req, 978 } 979 success, err := c.client.Call(ctx, c.thriftService, "writeBatchRawV2", &args, &resp) 980 if err == nil && !success { 981 switch { 982 case resp.Err != nil: 983 err = resp.Err 984 default: 985 err = fmt.Errorf("received no result or unknown exception for writeBatchRawV2") 986 } 987 } 988 989 return err 990 } 991 992 func (c *tchanNodeClient) WriteTagged(ctx thrift.Context, req *WriteTaggedRequest) error { 993 var resp NodeWriteTaggedResult 994 args := NodeWriteTaggedArgs{ 995 Req: req, 996 } 997 success, err := c.client.Call(ctx, c.thriftService, "writeTagged", &args, &resp) 998 if err == nil && !success { 999 switch { 1000 case resp.Err != nil: 1001 err = resp.Err 1002 default: 1003 err = fmt.Errorf("received no result or unknown exception for writeTagged") 1004 } 1005 } 1006 1007 return err 1008 } 1009 1010 func (c *tchanNodeClient) WriteTaggedBatchRaw(ctx thrift.Context, req *WriteTaggedBatchRawRequest) error { 1011 var resp NodeWriteTaggedBatchRawResult 1012 args := NodeWriteTaggedBatchRawArgs{ 1013 Req: req, 1014 } 1015 success, err := c.client.Call(ctx, c.thriftService, "writeTaggedBatchRaw", &args, &resp) 1016 if err == nil && !success { 1017 switch { 1018 case resp.Err != nil: 1019 err = resp.Err 1020 default: 1021 err = fmt.Errorf("received no result or unknown exception for writeTaggedBatchRaw") 1022 } 1023 } 1024 1025 return err 1026 } 1027 1028 func (c *tchanNodeClient) WriteTaggedBatchRawV2(ctx thrift.Context, req *WriteTaggedBatchRawV2Request) error { 1029 var resp NodeWriteTaggedBatchRawV2Result 1030 args := NodeWriteTaggedBatchRawV2Args{ 1031 Req: req, 1032 } 1033 success, err := c.client.Call(ctx, c.thriftService, "writeTaggedBatchRawV2", &args, &resp) 1034 if err == nil && !success { 1035 switch { 1036 case resp.Err != nil: 1037 err = resp.Err 1038 default: 1039 err = fmt.Errorf("received no result or unknown exception for writeTaggedBatchRawV2") 1040 } 1041 } 1042 1043 return err 1044 } 1045 1046 type tchanNodeServer struct { 1047 handler TChanNode 1048 } 1049 1050 // NewTChanNodeServer wraps a handler for TChanNode so it can be 1051 // registered with a thrift.Server. 1052 func NewTChanNodeServer(handler TChanNode) thrift.TChanServer { 1053 return &tchanNodeServer{ 1054 handler, 1055 } 1056 } 1057 1058 func (s *tchanNodeServer) Service() string { 1059 return "Node" 1060 } 1061 1062 func (s *tchanNodeServer) Methods() []string { 1063 return []string{ 1064 "aggregate", 1065 "aggregateRaw", 1066 "aggregateTiles", 1067 "bootstrapped", 1068 "bootstrappedInPlacementOrNoPlacement", 1069 "debugIndexMemorySegments", 1070 "debugProfileStart", 1071 "debugProfileStop", 1072 "fetch", 1073 "fetchBatchRaw", 1074 "fetchBatchRawV2", 1075 "fetchBlocksMetadataRawV2", 1076 "fetchBlocksRaw", 1077 "fetchTagged", 1078 "getPersistRateLimit", 1079 "getWriteNewSeriesAsync", 1080 "getWriteNewSeriesBackoffDuration", 1081 "getWriteNewSeriesLimitPerShardPerSecond", 1082 "health", 1083 "query", 1084 "repair", 1085 "setPersistRateLimit", 1086 "setWriteNewSeriesAsync", 1087 "setWriteNewSeriesBackoffDuration", 1088 "setWriteNewSeriesLimitPerShardPerSecond", 1089 "truncate", 1090 "write", 1091 "writeBatchRaw", 1092 "writeBatchRawV2", 1093 "writeTagged", 1094 "writeTaggedBatchRaw", 1095 "writeTaggedBatchRawV2", 1096 } 1097 } 1098 1099 func (s *tchanNodeServer) Handle(ctx thrift.Context, methodName string, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1100 switch methodName { 1101 case "aggregate": 1102 return s.handleAggregate(ctx, protocol) 1103 case "aggregateRaw": 1104 return s.handleAggregateRaw(ctx, protocol) 1105 case "aggregateTiles": 1106 return s.handleAggregateTiles(ctx, protocol) 1107 case "bootstrapped": 1108 return s.handleBootstrapped(ctx, protocol) 1109 case "bootstrappedInPlacementOrNoPlacement": 1110 return s.handleBootstrappedInPlacementOrNoPlacement(ctx, protocol) 1111 case "debugIndexMemorySegments": 1112 return s.handleDebugIndexMemorySegments(ctx, protocol) 1113 case "debugProfileStart": 1114 return s.handleDebugProfileStart(ctx, protocol) 1115 case "debugProfileStop": 1116 return s.handleDebugProfileStop(ctx, protocol) 1117 case "fetch": 1118 return s.handleFetch(ctx, protocol) 1119 case "fetchBatchRaw": 1120 return s.handleFetchBatchRaw(ctx, protocol) 1121 case "fetchBatchRawV2": 1122 return s.handleFetchBatchRawV2(ctx, protocol) 1123 case "fetchBlocksMetadataRawV2": 1124 return s.handleFetchBlocksMetadataRawV2(ctx, protocol) 1125 case "fetchBlocksRaw": 1126 return s.handleFetchBlocksRaw(ctx, protocol) 1127 case "fetchTagged": 1128 return s.handleFetchTagged(ctx, protocol) 1129 case "getPersistRateLimit": 1130 return s.handleGetPersistRateLimit(ctx, protocol) 1131 case "getWriteNewSeriesAsync": 1132 return s.handleGetWriteNewSeriesAsync(ctx, protocol) 1133 case "getWriteNewSeriesBackoffDuration": 1134 return s.handleGetWriteNewSeriesBackoffDuration(ctx, protocol) 1135 case "getWriteNewSeriesLimitPerShardPerSecond": 1136 return s.handleGetWriteNewSeriesLimitPerShardPerSecond(ctx, protocol) 1137 case "health": 1138 return s.handleHealth(ctx, protocol) 1139 case "query": 1140 return s.handleQuery(ctx, protocol) 1141 case "repair": 1142 return s.handleRepair(ctx, protocol) 1143 case "setPersistRateLimit": 1144 return s.handleSetPersistRateLimit(ctx, protocol) 1145 case "setWriteNewSeriesAsync": 1146 return s.handleSetWriteNewSeriesAsync(ctx, protocol) 1147 case "setWriteNewSeriesBackoffDuration": 1148 return s.handleSetWriteNewSeriesBackoffDuration(ctx, protocol) 1149 case "setWriteNewSeriesLimitPerShardPerSecond": 1150 return s.handleSetWriteNewSeriesLimitPerShardPerSecond(ctx, protocol) 1151 case "truncate": 1152 return s.handleTruncate(ctx, protocol) 1153 case "write": 1154 return s.handleWrite(ctx, protocol) 1155 case "writeBatchRaw": 1156 return s.handleWriteBatchRaw(ctx, protocol) 1157 case "writeBatchRawV2": 1158 return s.handleWriteBatchRawV2(ctx, protocol) 1159 case "writeTagged": 1160 return s.handleWriteTagged(ctx, protocol) 1161 case "writeTaggedBatchRaw": 1162 return s.handleWriteTaggedBatchRaw(ctx, protocol) 1163 case "writeTaggedBatchRawV2": 1164 return s.handleWriteTaggedBatchRawV2(ctx, protocol) 1165 1166 default: 1167 return false, nil, fmt.Errorf("method %v not found in service %v", methodName, s.Service()) 1168 } 1169 } 1170 1171 func (s *tchanNodeServer) handleAggregate(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1172 var req NodeAggregateArgs 1173 var res NodeAggregateResult 1174 1175 if err := req.Read(protocol); err != nil { 1176 return false, nil, err 1177 } 1178 1179 r, err := 1180 s.handler.Aggregate(ctx, req.Req) 1181 1182 if err != nil { 1183 switch v := err.(type) { 1184 case *Error: 1185 if v == nil { 1186 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1187 } 1188 res.Err = v 1189 default: 1190 return false, nil, err 1191 } 1192 } else { 1193 res.Success = r 1194 } 1195 1196 return err == nil, &res, nil 1197 } 1198 1199 func (s *tchanNodeServer) handleAggregateRaw(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1200 var req NodeAggregateRawArgs 1201 var res NodeAggregateRawResult 1202 1203 if err := req.Read(protocol); err != nil { 1204 return false, nil, err 1205 } 1206 1207 r, err := 1208 s.handler.AggregateRaw(ctx, req.Req) 1209 1210 if err != nil { 1211 switch v := err.(type) { 1212 case *Error: 1213 if v == nil { 1214 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1215 } 1216 res.Err = v 1217 default: 1218 return false, nil, err 1219 } 1220 } else { 1221 res.Success = r 1222 } 1223 1224 return err == nil, &res, nil 1225 } 1226 1227 func (s *tchanNodeServer) handleAggregateTiles(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1228 var req NodeAggregateTilesArgs 1229 var res NodeAggregateTilesResult 1230 1231 if err := req.Read(protocol); err != nil { 1232 return false, nil, err 1233 } 1234 1235 r, err := 1236 s.handler.AggregateTiles(ctx, req.Req) 1237 1238 if err != nil { 1239 switch v := err.(type) { 1240 case *Error: 1241 if v == nil { 1242 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1243 } 1244 res.Err = v 1245 default: 1246 return false, nil, err 1247 } 1248 } else { 1249 res.Success = r 1250 } 1251 1252 return err == nil, &res, nil 1253 } 1254 1255 func (s *tchanNodeServer) handleBootstrapped(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1256 var req NodeBootstrappedArgs 1257 var res NodeBootstrappedResult 1258 1259 if err := req.Read(protocol); err != nil { 1260 return false, nil, err 1261 } 1262 1263 r, err := 1264 s.handler.Bootstrapped(ctx) 1265 1266 if err != nil { 1267 switch v := err.(type) { 1268 case *Error: 1269 if v == nil { 1270 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1271 } 1272 res.Err = v 1273 default: 1274 return false, nil, err 1275 } 1276 } else { 1277 res.Success = r 1278 } 1279 1280 return err == nil, &res, nil 1281 } 1282 1283 func (s *tchanNodeServer) handleBootstrappedInPlacementOrNoPlacement(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1284 var req NodeBootstrappedInPlacementOrNoPlacementArgs 1285 var res NodeBootstrappedInPlacementOrNoPlacementResult 1286 1287 if err := req.Read(protocol); err != nil { 1288 return false, nil, err 1289 } 1290 1291 r, err := 1292 s.handler.BootstrappedInPlacementOrNoPlacement(ctx) 1293 1294 if err != nil { 1295 switch v := err.(type) { 1296 case *Error: 1297 if v == nil { 1298 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1299 } 1300 res.Err = v 1301 default: 1302 return false, nil, err 1303 } 1304 } else { 1305 res.Success = r 1306 } 1307 1308 return err == nil, &res, nil 1309 } 1310 1311 func (s *tchanNodeServer) handleDebugIndexMemorySegments(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1312 var req NodeDebugIndexMemorySegmentsArgs 1313 var res NodeDebugIndexMemorySegmentsResult 1314 1315 if err := req.Read(protocol); err != nil { 1316 return false, nil, err 1317 } 1318 1319 r, err := 1320 s.handler.DebugIndexMemorySegments(ctx, req.Req) 1321 1322 if err != nil { 1323 switch v := err.(type) { 1324 case *Error: 1325 if v == nil { 1326 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1327 } 1328 res.Err = v 1329 default: 1330 return false, nil, err 1331 } 1332 } else { 1333 res.Success = r 1334 } 1335 1336 return err == nil, &res, nil 1337 } 1338 1339 func (s *tchanNodeServer) handleDebugProfileStart(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1340 var req NodeDebugProfileStartArgs 1341 var res NodeDebugProfileStartResult 1342 1343 if err := req.Read(protocol); err != nil { 1344 return false, nil, err 1345 } 1346 1347 r, err := 1348 s.handler.DebugProfileStart(ctx, req.Req) 1349 1350 if err != nil { 1351 switch v := err.(type) { 1352 case *Error: 1353 if v == nil { 1354 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1355 } 1356 res.Err = v 1357 default: 1358 return false, nil, err 1359 } 1360 } else { 1361 res.Success = r 1362 } 1363 1364 return err == nil, &res, nil 1365 } 1366 1367 func (s *tchanNodeServer) handleDebugProfileStop(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1368 var req NodeDebugProfileStopArgs 1369 var res NodeDebugProfileStopResult 1370 1371 if err := req.Read(protocol); err != nil { 1372 return false, nil, err 1373 } 1374 1375 r, err := 1376 s.handler.DebugProfileStop(ctx, req.Req) 1377 1378 if err != nil { 1379 switch v := err.(type) { 1380 case *Error: 1381 if v == nil { 1382 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1383 } 1384 res.Err = v 1385 default: 1386 return false, nil, err 1387 } 1388 } else { 1389 res.Success = r 1390 } 1391 1392 return err == nil, &res, nil 1393 } 1394 1395 func (s *tchanNodeServer) handleFetch(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1396 var req NodeFetchArgs 1397 var res NodeFetchResult 1398 1399 if err := req.Read(protocol); err != nil { 1400 return false, nil, err 1401 } 1402 1403 r, err := 1404 s.handler.Fetch(ctx, req.Req) 1405 1406 if err != nil { 1407 switch v := err.(type) { 1408 case *Error: 1409 if v == nil { 1410 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1411 } 1412 res.Err = v 1413 default: 1414 return false, nil, err 1415 } 1416 } else { 1417 res.Success = r 1418 } 1419 1420 return err == nil, &res, nil 1421 } 1422 1423 func (s *tchanNodeServer) handleFetchBatchRaw(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1424 var req NodeFetchBatchRawArgs 1425 var res NodeFetchBatchRawResult 1426 1427 if err := req.Read(protocol); err != nil { 1428 return false, nil, err 1429 } 1430 1431 r, err := 1432 s.handler.FetchBatchRaw(ctx, req.Req) 1433 1434 if err != nil { 1435 switch v := err.(type) { 1436 case *Error: 1437 if v == nil { 1438 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1439 } 1440 res.Err = v 1441 default: 1442 return false, nil, err 1443 } 1444 } else { 1445 res.Success = r 1446 } 1447 1448 return err == nil, &res, nil 1449 } 1450 1451 func (s *tchanNodeServer) handleFetchBatchRawV2(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1452 var req NodeFetchBatchRawV2Args 1453 var res NodeFetchBatchRawV2Result 1454 1455 if err := req.Read(protocol); err != nil { 1456 return false, nil, err 1457 } 1458 1459 r, err := 1460 s.handler.FetchBatchRawV2(ctx, req.Req) 1461 1462 if err != nil { 1463 switch v := err.(type) { 1464 case *Error: 1465 if v == nil { 1466 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1467 } 1468 res.Err = v 1469 default: 1470 return false, nil, err 1471 } 1472 } else { 1473 res.Success = r 1474 } 1475 1476 return err == nil, &res, nil 1477 } 1478 1479 func (s *tchanNodeServer) handleFetchBlocksMetadataRawV2(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1480 var req NodeFetchBlocksMetadataRawV2Args 1481 var res NodeFetchBlocksMetadataRawV2Result 1482 1483 if err := req.Read(protocol); err != nil { 1484 return false, nil, err 1485 } 1486 1487 r, err := 1488 s.handler.FetchBlocksMetadataRawV2(ctx, req.Req) 1489 1490 if err != nil { 1491 switch v := err.(type) { 1492 case *Error: 1493 if v == nil { 1494 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1495 } 1496 res.Err = v 1497 default: 1498 return false, nil, err 1499 } 1500 } else { 1501 res.Success = r 1502 } 1503 1504 return err == nil, &res, nil 1505 } 1506 1507 func (s *tchanNodeServer) handleFetchBlocksRaw(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1508 var req NodeFetchBlocksRawArgs 1509 var res NodeFetchBlocksRawResult 1510 1511 if err := req.Read(protocol); err != nil { 1512 return false, nil, err 1513 } 1514 1515 r, err := 1516 s.handler.FetchBlocksRaw(ctx, req.Req) 1517 1518 if err != nil { 1519 switch v := err.(type) { 1520 case *Error: 1521 if v == nil { 1522 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1523 } 1524 res.Err = v 1525 default: 1526 return false, nil, err 1527 } 1528 } else { 1529 res.Success = r 1530 } 1531 1532 return err == nil, &res, nil 1533 } 1534 1535 func (s *tchanNodeServer) handleFetchTagged(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1536 var req NodeFetchTaggedArgs 1537 var res NodeFetchTaggedResult 1538 1539 if err := req.Read(protocol); err != nil { 1540 return false, nil, err 1541 } 1542 1543 r, err := 1544 s.handler.FetchTagged(ctx, req.Req) 1545 1546 if err != nil { 1547 switch v := err.(type) { 1548 case *Error: 1549 if v == nil { 1550 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1551 } 1552 res.Err = v 1553 default: 1554 return false, nil, err 1555 } 1556 } else { 1557 res.Success = r 1558 } 1559 1560 return err == nil, &res, nil 1561 } 1562 1563 func (s *tchanNodeServer) handleGetPersistRateLimit(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1564 var req NodeGetPersistRateLimitArgs 1565 var res NodeGetPersistRateLimitResult 1566 1567 if err := req.Read(protocol); err != nil { 1568 return false, nil, err 1569 } 1570 1571 r, err := 1572 s.handler.GetPersistRateLimit(ctx) 1573 1574 if err != nil { 1575 switch v := err.(type) { 1576 case *Error: 1577 if v == nil { 1578 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1579 } 1580 res.Err = v 1581 default: 1582 return false, nil, err 1583 } 1584 } else { 1585 res.Success = r 1586 } 1587 1588 return err == nil, &res, nil 1589 } 1590 1591 func (s *tchanNodeServer) handleGetWriteNewSeriesAsync(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1592 var req NodeGetWriteNewSeriesAsyncArgs 1593 var res NodeGetWriteNewSeriesAsyncResult 1594 1595 if err := req.Read(protocol); err != nil { 1596 return false, nil, err 1597 } 1598 1599 r, err := 1600 s.handler.GetWriteNewSeriesAsync(ctx) 1601 1602 if err != nil { 1603 switch v := err.(type) { 1604 case *Error: 1605 if v == nil { 1606 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1607 } 1608 res.Err = v 1609 default: 1610 return false, nil, err 1611 } 1612 } else { 1613 res.Success = r 1614 } 1615 1616 return err == nil, &res, nil 1617 } 1618 1619 func (s *tchanNodeServer) handleGetWriteNewSeriesBackoffDuration(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1620 var req NodeGetWriteNewSeriesBackoffDurationArgs 1621 var res NodeGetWriteNewSeriesBackoffDurationResult 1622 1623 if err := req.Read(protocol); err != nil { 1624 return false, nil, err 1625 } 1626 1627 r, err := 1628 s.handler.GetWriteNewSeriesBackoffDuration(ctx) 1629 1630 if err != nil { 1631 switch v := err.(type) { 1632 case *Error: 1633 if v == nil { 1634 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1635 } 1636 res.Err = v 1637 default: 1638 return false, nil, err 1639 } 1640 } else { 1641 res.Success = r 1642 } 1643 1644 return err == nil, &res, nil 1645 } 1646 1647 func (s *tchanNodeServer) handleGetWriteNewSeriesLimitPerShardPerSecond(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1648 var req NodeGetWriteNewSeriesLimitPerShardPerSecondArgs 1649 var res NodeGetWriteNewSeriesLimitPerShardPerSecondResult 1650 1651 if err := req.Read(protocol); err != nil { 1652 return false, nil, err 1653 } 1654 1655 r, err := 1656 s.handler.GetWriteNewSeriesLimitPerShardPerSecond(ctx) 1657 1658 if err != nil { 1659 switch v := err.(type) { 1660 case *Error: 1661 if v == nil { 1662 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1663 } 1664 res.Err = v 1665 default: 1666 return false, nil, err 1667 } 1668 } else { 1669 res.Success = r 1670 } 1671 1672 return err == nil, &res, nil 1673 } 1674 1675 func (s *tchanNodeServer) handleHealth(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1676 var req NodeHealthArgs 1677 var res NodeHealthResult 1678 1679 if err := req.Read(protocol); err != nil { 1680 return false, nil, err 1681 } 1682 1683 r, err := 1684 s.handler.Health(ctx) 1685 1686 if err != nil { 1687 switch v := err.(type) { 1688 case *Error: 1689 if v == nil { 1690 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1691 } 1692 res.Err = v 1693 default: 1694 return false, nil, err 1695 } 1696 } else { 1697 res.Success = r 1698 } 1699 1700 return err == nil, &res, nil 1701 } 1702 1703 func (s *tchanNodeServer) handleQuery(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1704 var req NodeQueryArgs 1705 var res NodeQueryResult 1706 1707 if err := req.Read(protocol); err != nil { 1708 return false, nil, err 1709 } 1710 1711 r, err := 1712 s.handler.Query(ctx, req.Req) 1713 1714 if err != nil { 1715 switch v := err.(type) { 1716 case *Error: 1717 if v == nil { 1718 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1719 } 1720 res.Err = v 1721 default: 1722 return false, nil, err 1723 } 1724 } else { 1725 res.Success = r 1726 } 1727 1728 return err == nil, &res, nil 1729 } 1730 1731 func (s *tchanNodeServer) handleRepair(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1732 var req NodeRepairArgs 1733 var res NodeRepairResult 1734 1735 if err := req.Read(protocol); err != nil { 1736 return false, nil, err 1737 } 1738 1739 err := 1740 s.handler.Repair(ctx) 1741 1742 if err != nil { 1743 switch v := err.(type) { 1744 case *Error: 1745 if v == nil { 1746 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1747 } 1748 res.Err = v 1749 default: 1750 return false, nil, err 1751 } 1752 } else { 1753 } 1754 1755 return err == nil, &res, nil 1756 } 1757 1758 func (s *tchanNodeServer) handleSetPersistRateLimit(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1759 var req NodeSetPersistRateLimitArgs 1760 var res NodeSetPersistRateLimitResult 1761 1762 if err := req.Read(protocol); err != nil { 1763 return false, nil, err 1764 } 1765 1766 r, err := 1767 s.handler.SetPersistRateLimit(ctx, req.Req) 1768 1769 if err != nil { 1770 switch v := err.(type) { 1771 case *Error: 1772 if v == nil { 1773 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1774 } 1775 res.Err = v 1776 default: 1777 return false, nil, err 1778 } 1779 } else { 1780 res.Success = r 1781 } 1782 1783 return err == nil, &res, nil 1784 } 1785 1786 func (s *tchanNodeServer) handleSetWriteNewSeriesAsync(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1787 var req NodeSetWriteNewSeriesAsyncArgs 1788 var res NodeSetWriteNewSeriesAsyncResult 1789 1790 if err := req.Read(protocol); err != nil { 1791 return false, nil, err 1792 } 1793 1794 r, err := 1795 s.handler.SetWriteNewSeriesAsync(ctx, req.Req) 1796 1797 if err != nil { 1798 switch v := err.(type) { 1799 case *Error: 1800 if v == nil { 1801 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1802 } 1803 res.Err = v 1804 default: 1805 return false, nil, err 1806 } 1807 } else { 1808 res.Success = r 1809 } 1810 1811 return err == nil, &res, nil 1812 } 1813 1814 func (s *tchanNodeServer) handleSetWriteNewSeriesBackoffDuration(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1815 var req NodeSetWriteNewSeriesBackoffDurationArgs 1816 var res NodeSetWriteNewSeriesBackoffDurationResult 1817 1818 if err := req.Read(protocol); err != nil { 1819 return false, nil, err 1820 } 1821 1822 r, err := 1823 s.handler.SetWriteNewSeriesBackoffDuration(ctx, req.Req) 1824 1825 if err != nil { 1826 switch v := err.(type) { 1827 case *Error: 1828 if v == nil { 1829 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1830 } 1831 res.Err = v 1832 default: 1833 return false, nil, err 1834 } 1835 } else { 1836 res.Success = r 1837 } 1838 1839 return err == nil, &res, nil 1840 } 1841 1842 func (s *tchanNodeServer) handleSetWriteNewSeriesLimitPerShardPerSecond(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1843 var req NodeSetWriteNewSeriesLimitPerShardPerSecondArgs 1844 var res NodeSetWriteNewSeriesLimitPerShardPerSecondResult 1845 1846 if err := req.Read(protocol); err != nil { 1847 return false, nil, err 1848 } 1849 1850 r, err := 1851 s.handler.SetWriteNewSeriesLimitPerShardPerSecond(ctx, req.Req) 1852 1853 if err != nil { 1854 switch v := err.(type) { 1855 case *Error: 1856 if v == nil { 1857 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1858 } 1859 res.Err = v 1860 default: 1861 return false, nil, err 1862 } 1863 } else { 1864 res.Success = r 1865 } 1866 1867 return err == nil, &res, nil 1868 } 1869 1870 func (s *tchanNodeServer) handleTruncate(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1871 var req NodeTruncateArgs 1872 var res NodeTruncateResult 1873 1874 if err := req.Read(protocol); err != nil { 1875 return false, nil, err 1876 } 1877 1878 r, err := 1879 s.handler.Truncate(ctx, req.Req) 1880 1881 if err != nil { 1882 switch v := err.(type) { 1883 case *Error: 1884 if v == nil { 1885 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1886 } 1887 res.Err = v 1888 default: 1889 return false, nil, err 1890 } 1891 } else { 1892 res.Success = r 1893 } 1894 1895 return err == nil, &res, nil 1896 } 1897 1898 func (s *tchanNodeServer) handleWrite(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1899 var req NodeWriteArgs 1900 var res NodeWriteResult 1901 1902 if err := req.Read(protocol); err != nil { 1903 return false, nil, err 1904 } 1905 1906 err := 1907 s.handler.Write(ctx, req.Req) 1908 1909 if err != nil { 1910 switch v := err.(type) { 1911 case *Error: 1912 if v == nil { 1913 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1914 } 1915 res.Err = v 1916 default: 1917 return false, nil, err 1918 } 1919 } else { 1920 } 1921 1922 return err == nil, &res, nil 1923 } 1924 1925 func (s *tchanNodeServer) handleWriteBatchRaw(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1926 var req NodeWriteBatchRawArgs 1927 var res NodeWriteBatchRawResult 1928 1929 if err := req.Read(protocol); err != nil { 1930 return false, nil, err 1931 } 1932 1933 err := 1934 s.handler.WriteBatchRaw(ctx, req.Req) 1935 1936 if err != nil { 1937 switch v := err.(type) { 1938 case *WriteBatchRawErrors: 1939 if v == nil { 1940 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *WriteBatchRawErrors but nil value") 1941 } 1942 res.Err = v 1943 default: 1944 return false, nil, err 1945 } 1946 } else { 1947 } 1948 1949 return err == nil, &res, nil 1950 } 1951 1952 func (s *tchanNodeServer) handleWriteBatchRawV2(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1953 var req NodeWriteBatchRawV2Args 1954 var res NodeWriteBatchRawV2Result 1955 1956 if err := req.Read(protocol); err != nil { 1957 return false, nil, err 1958 } 1959 1960 err := 1961 s.handler.WriteBatchRawV2(ctx, req.Req) 1962 1963 if err != nil { 1964 switch v := err.(type) { 1965 case *WriteBatchRawErrors: 1966 if v == nil { 1967 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *WriteBatchRawErrors but nil value") 1968 } 1969 res.Err = v 1970 default: 1971 return false, nil, err 1972 } 1973 } else { 1974 } 1975 1976 return err == nil, &res, nil 1977 } 1978 1979 func (s *tchanNodeServer) handleWriteTagged(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 1980 var req NodeWriteTaggedArgs 1981 var res NodeWriteTaggedResult 1982 1983 if err := req.Read(protocol); err != nil { 1984 return false, nil, err 1985 } 1986 1987 err := 1988 s.handler.WriteTagged(ctx, req.Req) 1989 1990 if err != nil { 1991 switch v := err.(type) { 1992 case *Error: 1993 if v == nil { 1994 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *Error but nil value") 1995 } 1996 res.Err = v 1997 default: 1998 return false, nil, err 1999 } 2000 } else { 2001 } 2002 2003 return err == nil, &res, nil 2004 } 2005 2006 func (s *tchanNodeServer) handleWriteTaggedBatchRaw(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 2007 var req NodeWriteTaggedBatchRawArgs 2008 var res NodeWriteTaggedBatchRawResult 2009 2010 if err := req.Read(protocol); err != nil { 2011 return false, nil, err 2012 } 2013 2014 err := 2015 s.handler.WriteTaggedBatchRaw(ctx, req.Req) 2016 2017 if err != nil { 2018 switch v := err.(type) { 2019 case *WriteBatchRawErrors: 2020 if v == nil { 2021 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *WriteBatchRawErrors but nil value") 2022 } 2023 res.Err = v 2024 default: 2025 return false, nil, err 2026 } 2027 } else { 2028 } 2029 2030 return err == nil, &res, nil 2031 } 2032 2033 func (s *tchanNodeServer) handleWriteTaggedBatchRawV2(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) { 2034 var req NodeWriteTaggedBatchRawV2Args 2035 var res NodeWriteTaggedBatchRawV2Result 2036 2037 if err := req.Read(protocol); err != nil { 2038 return false, nil, err 2039 } 2040 2041 err := 2042 s.handler.WriteTaggedBatchRawV2(ctx, req.Req) 2043 2044 if err != nil { 2045 switch v := err.(type) { 2046 case *WriteBatchRawErrors: 2047 if v == nil { 2048 return false, nil, fmt.Errorf("Handler for err returned non-nil error type *WriteBatchRawErrors but nil value") 2049 } 2050 res.Err = v 2051 default: 2052 return false, nil, err 2053 } 2054 } else { 2055 } 2056 2057 return err == nil, &res, nil 2058 }