github.com/rohankumardubey/aresdb@v0.0.2-0.20190517170215-e54e3ca06b9c/api/debug_request.go (about)

     1  //  Copyright (c) 2017-2018 Uber Technologies, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package api
    16  
    17  // ShardRequest is the common request struct for all shard related operations.
    18  type ShardRequest struct {
    19  	TableName string `path:"table" json:"table"`
    20  	ShardID   int    `path:"shard" json:"shard"`
    21  }
    22  
    23  // ShowBatchRequest represents request to show a batch.
    24  type ShowBatchRequest struct {
    25  	ShardRequest
    26  	BatchID  int `path:"batch" json:"batch"`
    27  	StartRow int `query:"startRow,optional" json:"startRow"`
    28  	NumRows  int `query:"numRows,optional" json:"numRows"`
    29  }
    30  
    31  // LookupPrimaryKeyRequest represents primary key lookup request
    32  type LookupPrimaryKeyRequest struct {
    33  	ShardRequest
    34  	// comma delimited string
    35  	Key string `query:"key" json:"key"`
    36  }
    37  
    38  // ShowShardMetaRequest represents request to show metadata for a shard.
    39  type ShowShardMetaRequest struct {
    40  	ShardRequest
    41  }
    42  
    43  // ArchiveRequest represents request to start an on demand archiving.
    44  type ArchiveRequest struct {
    45  	ShardRequest
    46  	Body struct {
    47  		Cutoff uint32 `json:"cutoff"`
    48  	} `body:""`
    49  }
    50  
    51  // BackfillRequest represents request to start an on demand backfill.
    52  type BackfillRequest struct {
    53  	ShardRequest
    54  }
    55  
    56  // SnapshotRequest represents request to start an on demand snapshot.
    57  type SnapshotRequest struct {
    58  	ShardRequest
    59  }
    60  
    61  // PurgeRequest represents request to purge a batch.
    62  type PurgeRequest struct {
    63  	ShardRequest
    64  	Body struct {
    65  		BatchIDStart int  `json:"batchIDStart"`
    66  		BatchIDEnd   int  `json:"batchIDEnd"`
    67  		SafePurge    bool `json:"safePurge"`
    68  	} `body:""`
    69  }
    70  
    71  // LoadVectorPartyRequest represents a load request for vector party
    72  type LoadVectorPartyRequest struct {
    73  	ShardRequest
    74  	BatchID    int    `path:"batch" json:"batch"`
    75  	ColumnName string `path:"column" json:"column"`
    76  }
    77  
    78  // EvictVectorPartyRequest represents a evict request for vector party
    79  type EvictVectorPartyRequest struct {
    80  	LoadVectorPartyRequest
    81  }
    82  
    83  // ListRedoLogsRequest represents the request to list all redo log files for a given shard.
    84  type ListRedoLogsRequest struct {
    85  	ShardRequest
    86  }
    87  
    88  // ListUpsertBatchesRequest represents the request to list offsets of upsert batches in a redo
    89  // log file.
    90  type ListUpsertBatchesRequest struct {
    91  	ShardRequest
    92  	// CreationTime of the redolog file.
    93  	CreationTime int64 `path:"creationTime"`
    94  }
    95  
    96  // ReadUpsertBatchRequest represents the request to show one page of current upsert batch
    97  type ReadUpsertBatchRequest struct {
    98  	// Offset of upsert batch.
    99  	Offset int64 `path:"offset"`
   100  	// Start of records in upsert batch in this page.
   101  	Start int `query:"start,optional"`
   102  	// Number of records to show in this page. If length is 0, it means caller only want to
   103  	// get another metadata of this upsert batch.
   104  	Length int `query:"length,optional"`
   105  	// Draw is the  counter that this object is a response to.
   106  	Draw int `query:"draw,optional"`
   107  }
   108  
   109  // ReadRedologUpsertBatchRequest represents the request to show one page of current upsert batch
   110  // of a given redolog file.
   111  type ReadRedologUpsertBatchRequest struct {
   112  	ListUpsertBatchesRequest
   113  	ReadUpsertBatchRequest
   114  }
   115  
   116  // ReadBackfillQueueUpsertBatchRequest represents the request to show one page of current upsert batch
   117  // of backfill queue
   118  type ReadBackfillQueueUpsertBatchRequest struct {
   119  	ShardRequest
   120  	ReadUpsertBatchRequest
   121  }
   122  
   123  // ShowJobStatusRequest represents the request to show job statuses for a given job type.
   124  type ShowJobStatusRequest struct {
   125  	JobType string `path:"jobType" json:"jobType"`
   126  }
   127  
   128  // HealthSwitchRequest represents the request to  turn on/off the health check.
   129  type HealthSwitchRequest struct {
   130  	OnOrOff string `path:"onOrOff" json:"onOrOff"`
   131  }