github.com/m3db/m3@v1.5.1-0.20231129193456-75a402aa583b/src/dbnode/generated/thrift/rpc.thrift (about)

     1  // Copyright (c) 2018 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  namespace java com.github.m3db
    22  
    23  enum TimeType {
    24  	UNIX_SECONDS,
    25  	UNIX_MICROSECONDS,
    26  	UNIX_MILLISECONDS,
    27  	UNIX_NANOSECONDS
    28  }
    29  
    30  enum ErrorType {
    31  	INTERNAL_ERROR,
    32  	BAD_REQUEST
    33  }
    34  
    35  enum ErrorFlags {
    36      NONE               = 0x00,
    37      RESOURCE_EXHAUSTED = 0x01,
    38      SERVER_TIMEOUT     = 0x02
    39  }
    40  
    41  exception Error {
    42  	1: required ErrorType type = ErrorType.INTERNAL_ERROR
    43  	2: required string message
    44  	3: optional i64 flags = 0
    45  }
    46  
    47  exception WriteBatchRawErrors {
    48  	1: required list<WriteBatchRawError> errors
    49  }
    50  
    51  service Node {
    52  	// Friendly not highly performant read/write endpoints
    53  	QueryResult          query(1: QueryRequest req) throws (1: Error err)
    54  	AggregateQueryResult aggregate(1: AggregateQueryRequest req) throws (1: Error err)
    55  	FetchResult          fetch(1: FetchRequest req) throws (1: Error err)
    56  	void                 write(1: WriteRequest req) throws (1: Error err)
    57  	void                 writeTagged(1: WriteTaggedRequest req) throws (1: Error err)
    58  
    59  	// Performant read/write endpoints
    60  	AggregateQueryRawResult        aggregateRaw(1: AggregateQueryRawRequest req) throws (1: Error err)
    61  	FetchBatchRawResult            fetchBatchRaw(1: FetchBatchRawRequest req) throws (1: Error err)
    62  	FetchBatchRawResult            fetchBatchRawV2(1: FetchBatchRawV2Request req) throws (1: Error err)
    63  	FetchBlocksRawResult           fetchBlocksRaw(1: FetchBlocksRawRequest req) throws (1: Error err)
    64  	FetchTaggedResult              fetchTagged(1: FetchTaggedRequest req) throws (1: Error err)
    65  	FetchBlocksMetadataRawV2Result fetchBlocksMetadataRawV2(1: FetchBlocksMetadataRawV2Request req) throws (1: Error err)
    66  	void                           writeBatchRaw(1: WriteBatchRawRequest req) throws (1: WriteBatchRawErrors err)
    67  	void                           writeBatchRawV2(1: WriteBatchRawV2Request req) throws (1: WriteBatchRawErrors err)
    68  	void                           writeTaggedBatchRaw(1: WriteTaggedBatchRawRequest req) throws (1: WriteBatchRawErrors err)
    69  	void                           writeTaggedBatchRawV2(1: WriteTaggedBatchRawV2Request req) throws (1: WriteBatchRawErrors err)
    70  	void                           repair() throws (1: Error err)
    71  	TruncateResult                 truncate(1: TruncateRequest req) throws (1: Error err)
    72  
    73  	AggregateTilesResult aggregateTiles(1: AggregateTilesRequest req) throws (1: Error err)
    74  
    75  	// Management endpoints
    76  	NodeHealthResult                               health() throws (1: Error err)
    77  	// NB: bootstrapped is for use with cluster management tools like k8s.
    78  	NodeBootstrappedResult                         bootstrapped() throws (1: Error err)
    79  	// NB: bootstrappedInPlacementOrNoPlacement is for use with cluster management tools like k8s.
    80  	NodeBootstrappedInPlacementOrNoPlacementResult bootstrappedInPlacementOrNoPlacement() throws (1: Error err)
    81  	NodePersistRateLimitResult                     getPersistRateLimit() throws (1: Error err)
    82  	NodePersistRateLimitResult                     setPersistRateLimit(1: NodeSetPersistRateLimitRequest req) throws (1: Error err)
    83  	NodeWriteNewSeriesAsyncResult                  getWriteNewSeriesAsync() throws (1: Error err)
    84  	NodeWriteNewSeriesAsyncResult                  setWriteNewSeriesAsync(1: NodeSetWriteNewSeriesAsyncRequest req) throws (1: Error err)
    85  	NodeWriteNewSeriesBackoffDurationResult        getWriteNewSeriesBackoffDuration() throws (1: Error err)
    86  	NodeWriteNewSeriesBackoffDurationResult        setWriteNewSeriesBackoffDuration(1: NodeSetWriteNewSeriesBackoffDurationRequest req) throws (1: Error err)
    87  	NodeWriteNewSeriesLimitPerShardPerSecondResult getWriteNewSeriesLimitPerShardPerSecond() throws (1: Error err)
    88  	NodeWriteNewSeriesLimitPerShardPerSecondResult setWriteNewSeriesLimitPerShardPerSecond(1: NodeSetWriteNewSeriesLimitPerShardPerSecondRequest req) throws (1: Error err)
    89  
    90  	// Debug endpoints
    91  	DebugProfileStartResult        debugProfileStart(1: DebugProfileStartRequest req) throws (1: Error err)
    92  	DebugProfileStopResult         debugProfileStop(1: DebugProfileStopRequest req) throws (1: Error err)
    93  	DebugIndexMemorySegmentsResult debugIndexMemorySegments(1: DebugIndexMemorySegmentsRequest req) throws (1: Error err)
    94  }
    95  
    96  struct FetchRequest {
    97  	1: required i64 rangeStart
    98  	2: required i64 rangeEnd
    99  	3: required string nameSpace
   100  	4: required string id
   101  	5: optional TimeType rangeType = TimeType.UNIX_SECONDS
   102  	6: optional TimeType resultTimeType = TimeType.UNIX_SECONDS
   103  	7: optional binary source
   104  }
   105  
   106  struct FetchResult {
   107  	1: required list<Datapoint> datapoints
   108  }
   109  
   110  struct Datapoint {
   111  	1: required i64 timestamp
   112  	2: required double value
   113  	3: optional binary annotation
   114  	4: optional TimeType timestampTimeType = TimeType.UNIX_SECONDS
   115  }
   116  
   117  struct WriteRequest {
   118  	1: required string nameSpace
   119  	2: required string id
   120  	3: required Datapoint datapoint
   121  }
   122  
   123  struct WriteTaggedRequest {
   124  	1: required string nameSpace
   125  	2: required string id
   126  	3: required list<Tag> tags
   127  	4: required Datapoint datapoint
   128  }
   129  
   130  struct FetchBatchRawRequest {
   131  	1: required i64 rangeStart
   132  	2: required i64 rangeEnd
   133  	3: required binary nameSpace
   134  	4: required list<binary> ids
   135  	5: optional TimeType rangeTimeType = TimeType.UNIX_SECONDS
   136  	6: optional binary source
   137  }
   138  
   139  
   140  struct FetchBatchRawV2Request {
   141  	1: required list<binary> nameSpaces
   142  	2: required list<FetchBatchRawV2RequestElement> elements
   143  	3: optional binary source
   144  }
   145  
   146  struct FetchBatchRawV2RequestElement {
   147  	1: required i64 nameSpace
   148  	2: required i64 rangeStart
   149  	3: required i64 rangeEnd
   150  	4: required binary id
   151  	5: optional TimeType rangeTimeType = TimeType.UNIX_SECONDS
   152  }
   153  
   154  struct FetchBatchRawResult {
   155  	1: required list<FetchRawResult> elements
   156  }
   157  
   158  struct FetchRawResult {
   159  	1: required list<Segments> segments
   160  	2: optional Error err
   161  }
   162  
   163  struct Segments {
   164  	1: optional Segment merged
   165  	2: optional list<Segment> unmerged
   166  }
   167  
   168  struct Segment {
   169  	1: required binary head
   170  	2: required binary tail
   171  	3: optional i64 startTime
   172  	4: optional i64 blockSize
   173  	5: optional i64 checksum
   174  }
   175  
   176  struct FetchTaggedRequest {
   177  	1: required binary nameSpace
   178  	2: required binary query
   179  	3: required i64 rangeStart
   180  	4: required i64 rangeEnd
   181  	5: required bool fetchData
   182  	6: optional i64 seriesLimit
   183  	7: optional TimeType rangeTimeType = TimeType.UNIX_SECONDS
   184  	8: optional bool requireExhaustive = true
   185  	9: optional i64 docsLimit
   186  	10: optional binary source
   187  	11: optional bool requireNoWait = false
   188  }
   189  
   190  struct FetchTaggedResult {
   191  	1: required list<FetchTaggedIDResult> elements
   192  	2: required bool exhaustive
   193  	3: optional i64 waitedIndex
   194  	4: optional i64 waitedSeriesRead
   195  }
   196  
   197  struct FetchTaggedIDResult {
   198  	1: required binary id
   199  	2: required binary nameSpace
   200  	3: required binary encodedTags
   201  	4: optional list<Segments> segments
   202  
   203  	// Deprecated -- do not use.
   204  	5: optional Error err
   205  }
   206  
   207  struct FetchBlocksRawRequest {
   208  	1: required binary nameSpace
   209  	2: required i32 shard
   210  	3: required list<FetchBlocksRawRequestElement> elements
   211  	4: optional binary source
   212  }
   213  
   214  struct FetchBlocksRawRequestElement {
   215  	1: required binary id
   216  	2: required list<i64> starts
   217  }
   218  
   219  struct FetchBlocksRawResult {
   220  	1: required list<Blocks> elements
   221  }
   222  
   223  struct Blocks {
   224  	1: required binary id
   225  	2: required list<Block> blocks
   226  }
   227  
   228  struct Block {
   229  	1: required i64 start
   230  	2: optional Segments segments
   231  	3: optional Error err
   232  	4: optional i64 checksum
   233  }
   234  
   235  struct Tag {
   236  	1: required string name
   237  	2: required string value
   238  }
   239  
   240  struct FetchBlocksMetadataRawV2Request {
   241  	1: required binary nameSpace
   242  	2: required i32 shard
   243  	3: required i64 rangeStart
   244  	4: required i64 rangeEnd
   245  	5: required i64 limit
   246  	6: optional binary pageToken
   247  	7: optional bool includeSizes
   248  	8: optional bool includeChecksums
   249  	9: optional bool includeLastRead
   250  }
   251  
   252  struct FetchBlocksMetadataRawV2Result {
   253  	1: required list<BlockMetadataV2> elements
   254  	2: optional binary nextPageToken
   255  }
   256  
   257  struct BlockMetadataV2 {
   258  	1: required binary id
   259  	2: required i64 start
   260  	3: optional Error err
   261  	4: optional i64 size
   262  	5: optional i64 checksum
   263  	6: optional i64 lastRead
   264  	7: optional TimeType lastReadTimeType = TimeType.UNIX_SECONDS
   265  	8: optional binary encodedTags
   266  }
   267  
   268  struct WriteBatchRawRequest {
   269  	1: required binary nameSpace
   270  	2: required list<WriteBatchRawRequestElement> elements
   271  }
   272  
   273  struct WriteBatchRawV2Request {
   274  	1: required list<binary> nameSpaces
   275  	2: required list<WriteBatchRawV2RequestElement> elements
   276  }
   277  
   278  struct WriteBatchRawRequestElement {
   279  	1: required binary id
   280  	2: required Datapoint datapoint
   281  }
   282  
   283  struct WriteBatchRawV2RequestElement {
   284  	1: required binary id
   285  	2: required Datapoint datapoint
   286  	3: required i64 nameSpace
   287  }
   288  
   289  struct WriteTaggedBatchRawRequest {
   290  	1: required binary nameSpace
   291  	2: required list<WriteTaggedBatchRawRequestElement> elements
   292  }
   293  
   294  struct WriteTaggedBatchRawV2Request {
   295  	1: required list<binary> nameSpaces
   296  	2: required list<WriteTaggedBatchRawV2RequestElement> elements
   297  }
   298  
   299  struct WriteTaggedBatchRawRequestElement {
   300  	1: required binary id
   301  	2: required binary encodedTags
   302  	3: required Datapoint datapoint
   303  }
   304  
   305  struct WriteTaggedBatchRawV2RequestElement {
   306  	1: required binary id
   307  	2: required binary encodedTags
   308  	3: required Datapoint datapoint
   309  	4: required i64 nameSpace
   310  }
   311  
   312  struct WriteBatchRawError {
   313  	1: required i64 index
   314  	2: required Error err
   315  }
   316  
   317  struct TruncateRequest {
   318  	1: required binary nameSpace
   319  }
   320  
   321  struct TruncateResult {
   322  	1: required i64 numSeries
   323  }
   324  
   325  struct NodeHealthResult {
   326  	1: required bool ok
   327  	2: required string status
   328  	3: required bool bootstrapped
   329  	4: optional map<string,string> metadata
   330  }
   331  
   332  struct NodeBootstrappedResult {}
   333  
   334  struct NodeBootstrappedInPlacementOrNoPlacementResult {}
   335  
   336  struct NodePersistRateLimitResult {
   337  	1: required bool limitEnabled
   338  	2: required double limitMbps
   339  	3: required i64 limitCheckEvery
   340  }
   341  
   342  struct NodeSetPersistRateLimitRequest {
   343  	1: optional bool limitEnabled
   344  	2: optional double limitMbps
   345  	3: optional i64 limitCheckEvery
   346  }
   347  
   348  struct NodeWriteNewSeriesAsyncResult {
   349  	1: required bool writeNewSeriesAsync
   350  }
   351  
   352  struct NodeSetWriteNewSeriesAsyncRequest {
   353  	1: required bool writeNewSeriesAsync
   354  }
   355  
   356  struct NodeWriteNewSeriesBackoffDurationResult {
   357  	1: required i64 writeNewSeriesBackoffDuration
   358  	2: required TimeType durationType
   359  }
   360  
   361  struct NodeSetWriteNewSeriesBackoffDurationRequest {
   362  	1: required i64 writeNewSeriesBackoffDuration
   363  	2: optional TimeType durationType = TimeType.UNIX_MILLISECONDS
   364  }
   365  
   366  struct NodeWriteNewSeriesLimitPerShardPerSecondResult {
   367  	1: required i64 writeNewSeriesLimitPerShardPerSecond
   368  }
   369  
   370  struct NodeSetWriteNewSeriesLimitPerShardPerSecondRequest {
   371  	1: required i64 writeNewSeriesLimitPerShardPerSecond
   372  }
   373  
   374  service Cluster {
   375  	HealthResult health() throws (1: Error err)
   376  	void write(1: WriteRequest req) throws (1: Error err)
   377  	void writeTagged(1: WriteTaggedRequest req) throws (1: Error err)
   378  	QueryResult query(1: QueryRequest req) throws (1: Error err)
   379  	AggregateQueryResult aggregate(1: AggregateQueryRequest req) throws (1: Error err)
   380  	FetchResult fetch(1: FetchRequest req) throws (1: Error err)
   381  	TruncateResult truncate(1: TruncateRequest req) throws (1: Error err)
   382  }
   383  
   384  struct HealthResult {
   385  	1: required bool ok
   386  	2: required string status
   387  }
   388  
   389  enum AggregateQueryType {
   390  	AGGREGATE_BY_TAG_NAME,
   391  	AGGREGATE_BY_TAG_NAME_VALUE,
   392  }
   393  
   394  // AggregateQueryRawRequest comes from our desire to aggregate on incoming data.
   395  // We currently only support retrieval of facets, but could extend this based on
   396  // requirements in the future. Currently, the predominant use-cases are:
   397  // (1) Given a filter query (optionally), return all known tag keys matching this restriction
   398  // (2) Given a filter query (optionally), return all know tag key+values matching this restriction
   399  // (3) For (1), (2) - filter results to a given set of keys
   400  struct AggregateQueryRawRequest {
   401  	1: required binary query
   402  	2: required i64 rangeStart
   403  	3: required i64 rangeEnd
   404  	4: required binary nameSpace
   405  	5: optional i64 seriesLimit
   406  	6: optional list<binary> tagNameFilter
   407  	7: optional AggregateQueryType aggregateQueryType = AggregateQueryType.AGGREGATE_BY_TAG_NAME_VALUE
   408  	8: optional TimeType rangeType = TimeType.UNIX_SECONDS
   409  	9: optional binary source
   410  	10: optional i64 docsLimit
   411  	11: optional bool requireExhaustive
   412  	12: optional bool requireNoWait
   413  }
   414  
   415  struct AggregateQueryRawResult {
   416  	1: required list<AggregateQueryRawResultTagNameElement> results
   417  	2: required bool exhaustive
   418  	3: optional i64 waitedIndex
   419  }
   420  
   421  struct AggregateQueryRawResultTagNameElement {
   422  	1: required binary tagName
   423  	2: optional list<AggregateQueryRawResultTagValueElement> tagValues
   424  }
   425  
   426  struct AggregateQueryRawResultTagValueElement {
   427  	1: required binary tagValue
   428  }
   429  
   430  // AggregateQueryRequest is identical to AggregateQueryRawRequest save for using string instead of binary for types.
   431  struct AggregateQueryRequest {
   432  	1: optional Query query
   433  	2: required i64 rangeStart
   434  	3: required i64 rangeEnd
   435  	4: required string nameSpace
   436  	5: optional i64 seriesLimit
   437  	6: optional list<string> tagNameFilter
   438  	7: optional AggregateQueryType aggregateQueryType = AggregateQueryType.AGGREGATE_BY_TAG_NAME_VALUE
   439  	8: optional TimeType rangeType = TimeType.UNIX_SECONDS
   440  	9: optional binary source
   441  	10: optional i64 docsLimit
   442  	11: optional bool requireExhaustive
   443  	12: optional bool requireNoWait
   444  }
   445  
   446  struct AggregateQueryResult {
   447  	1: required list<AggregateQueryResultTagNameElement> results
   448  	2: required bool exhaustive
   449  }
   450  
   451  struct AggregateQueryResultTagNameElement {
   452  	1: required string tagName
   453  	2: optional list<AggregateQueryResultTagValueElement> tagValues
   454  }
   455  
   456  struct AggregateQueryResultTagValueElement {
   457  	1: required string tagValue
   458  }
   459  
   460  // Query wrapper types for simple non-optimized query use
   461  struct QueryRequest {
   462  	1: required Query query
   463  	2: required i64 rangeStart
   464  	3: required i64 rangeEnd
   465  	4: required string nameSpace
   466  	5: optional i64 limit
   467  	6: optional bool noData
   468  	7: optional TimeType rangeType = TimeType.UNIX_SECONDS
   469  	8: optional TimeType resultTimeType = TimeType.UNIX_SECONDS
   470  	9: optional binary source
   471  	// Additional options for the Cluster service.
   472  	10: optional ClusterQueryOptions clusterOptions
   473  }
   474  
   475  // ClusterQueryOptions are additional options for a QueryRequest to the Cluster service.
   476  struct ClusterQueryOptions {
   477          // The read consistency level to use for the query.
   478          1: optional ReadConsistency readConsistency
   479          // The strategy to resolve conflicts for different values for the same timestamp.
   480          2: optional EqualTimestampStrategy conflictResolutionStrategy
   481  }
   482  
   483  // Enumeration of read consistency values. Matches ReadConsistencyLevel type in golang.
   484  enum ReadConsistency {
   485  	ONE,
   486  	UNSTRICT_MAJORITY,
   487  	MAJORITY,
   488  	UNSTRICT_ALL,
   489  	ALL
   490  }
   491  
   492  // Enumeration of strategies to resolve read conflicts for equal timestamps. Matches IterateEqualTimestampStrategy in
   493  // golang.
   494  enum EqualTimestampStrategy {
   495          LAST_PUSHED,
   496          HIGHEST_VALUE,
   497          LOWEST_VALUE,
   498          HIGHEST_FREQUENCY,
   499  }
   500  
   501  struct QueryResult {
   502  	1: required list<QueryResultElement> results
   503  	2: required bool exhaustive
   504  }
   505  
   506  struct QueryResultElement {
   507  	1: required string id
   508  	2: required list<Tag> tags
   509  	3: required list<Datapoint> datapoints
   510  }
   511  
   512  struct TermQuery {
   513  	1: required string field
   514  	2: required string term
   515  }
   516  
   517  struct RegexpQuery {
   518  	1: required string field
   519  	2: required string regexp
   520  }
   521  
   522  struct NegationQuery {
   523  	1: required Query query
   524  }
   525  
   526  struct ConjunctionQuery {
   527  	1: required list<Query> queries
   528  }
   529  
   530  struct DisjunctionQuery {
   531  	1: required list<Query> queries
   532  }
   533  
   534  struct AllQuery {}
   535  
   536  struct FieldQuery {
   537  	1: required string field
   538  }
   539  
   540  struct Query {
   541  	1: optional TermQuery        term
   542  	2: optional RegexpQuery      regexp
   543  	3: optional NegationQuery    negation
   544  	4: optional ConjunctionQuery conjunction
   545  	5: optional DisjunctionQuery disjunction
   546  	6: optional AllQuery         all
   547  	7: optional FieldQuery       field
   548  }
   549  
   550  struct AggregateTilesRequest {
   551  	1: required string sourceNamespace
   552  	2: required string targetNamespace
   553  	3: required i64 rangeStart
   554  	4: required i64 rangeEnd
   555  	5: required string step
   556  	6: optional TimeType rangeType = TimeType.UNIX_SECONDS
   557  }
   558  
   559  struct AggregateTilesResult {
   560  	1: required i64 processedTileCount
   561  }
   562  
   563  struct DebugProfileStartRequest {
   564  	1: required string name
   565  	2: required string filePathTemplate
   566  	3: optional string interval
   567  	4: optional string duration
   568  	5: optional i64 debug
   569  	6: optional i64 conditionalNumGoroutinesGreaterThan
   570  	7: optional i64 conditionalNumGoroutinesLessThan
   571  	8: optional bool conditionalIsOverloaded
   572  }
   573  
   574  struct DebugProfileStartResult {
   575  }
   576  
   577  struct DebugProfileStopRequest {
   578  	1: required string name
   579  }
   580  
   581  struct DebugProfileStopResult {
   582  }
   583  
   584  struct DebugIndexMemorySegmentsRequest {
   585  	1: required string directory
   586  }
   587  
   588  struct DebugIndexMemorySegmentsResult {
   589  }