-
Notifications
You must be signed in to change notification settings - Fork 22
/
definitions.json
784 lines (784 loc) · 23.8 KB
/
definitions.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://nats.io/schemas/jetstream/api/v1/definitions.json",
"title": "io.nats.jetstream.api.v1.definitions",
"description": "Shared definitions for the JetStream API",
"type": "object",
"definitions": {
"stream_source": {
"type": "object",
"description": "Defines a source where streams should be replicated from",
"required": ["name"],
"properties": {
"name": {
"description": "Stream name",
"$ref": "#/definitions/basic_name"
},
"opt_start_seq": {
"description": "Sequence to start replicating from",
"type": "integer",
"minimum": 0
},
"opt_start_time": {
"description": "Time stamp to start replicating from",
"type": "string"
},
"filter_subject": {
"description": "Replicate only a subset of messages based on filter",
"type": "string"
},
"external": {
"$ref": "#/definitions/external_stream_source"
}
}
},
"external_stream_source": {
"required": ["api"],
"type": "object",
"description": "Configuration referencing a stream source in another account or JetStream domain",
"properties": {
"api": {
"type": "string",
"description": "The subject prefix that imports the other account/domain $JS.API.CONSUMER.> subjects"
},
"deliver": {
"type": "string",
"description": "The delivery subject to use for the push consumer"
}
}
},
"stream_source_info": {
"required": ["name","lag","active"],
"type": "object",
"description": "Information about an upstream stream source in a mirror",
"properties": {
"name": {
"type": "string",
"description": "The name of the Stream being replicated"
},
"lag": {
"type": "number",
"description": "How many messages behind the mirror operation is",
"minimum": 0
},
"active": {
"type": "number",
"description": "When last the mirror had activity, in nanoseconds",
"minimum": 0
},
"external": {
"$ref": "#/definitions/external_stream_source"
},
"error": {
"$ref": "#/definitions/api_error"
}
}
},
"lost_stream_data": {
"type": "object",
"description": "Records messages that were damaged and unrecoverable",
"properties": {
"msgs": {
"type": ["array","null"],
"description": "The messages that were lost",
"items": {
"type": "integer",
"minimum": 0
}
},
"bytes": {
"description": "The number of bytes that were lost",
"type": "integer"
}
}
},
"placement": {
"type": "object",
"description": "Placement requirements for a stream",
"required": ["cluster"],
"properties": {
"cluster": {
"type": "string",
"description": "The desired cluster name to place the stream",
"minLength": 1
},
"tags": {
"description": "Tags required on servers hosting this stream",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"peer_info": {
"type": "object",
"required": ["name", "current", "active"],
"properties": {
"name": {
"description": "The server name of the peer",
"type": "string",
"minimum": 1
},
"current": {
"description": "Indicates if the server is up to date and synchronised",
"type": "boolean",
"default": false
},
"active": {
"description": "Nanoseconds since this peer was last seen",
"type": "number"
},
"offline": {
"description": "Indicates the node is considered offline by the group",
"type": "boolean",
"default": false
},
"lag": {
"description": "How many uncommitted operations this peer is behind the leader",
"type": "integer",
"minimum": 0
}
}
},
"cluster_info": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The cluster name"
},
"leader": {
"type": "string",
"description": "The server name of the RAFT leader"
},
"replicas": {
"type": "array",
"description": "The members of the RAFT cluster",
"items": {
"$ref": "#/definitions/peer_info"
}
}
}
},
"api_stats": {
"type": "object",
"required": ["total", "errors"],
"properties": {
"total": {
"description": "Total number of API requests received for this account",
"minimum": 0,
"type": "integer"
},
"errors": {
"description": "API requests that resulted in an error response",
"minimum": 0,
"type": "integer"
}
}
},
"account_stats": {
"type": "object",
"required": ["memory", "storage", "streams", "limits", "api", "consumers"],
"properties": {
"memory": {
"description": "Memory Storage being used for Stream Message storage",
"type": "integer",
"minimum": 0
},
"storage": {
"description": "File Storage being used for Stream Message storage",
"type": "integer",
"minimum": 0
},
"streams": {
"description": "Number of active Streams",
"type": "integer",
"minimum": 0
},
"consumers": {
"description": "Number of active Consumers",
"type": "integer",
"minimum": 0
},
"limits": {
"$ref": "#/definitions/account_limits"
},
"api": {
"$ref": "#/definitions/api_stats"
}
}
},
"account_limits": {
"type": "object",
"additionalProperties": false,
"required": ["max_consumers", "max_memory", "max_storage", "max_streams"],
"properties": {
"max_memory": {
"type": "integer",
"description": "The maximum amount of Memory storage Stream Messages may consume",
"minimum": -1
},
"max_storage": {
"type": "integer",
"description": "The maximum amount of File storage Stream Messages may consume",
"minimum": -1
},
"max_streams": {
"type": "integer",
"description": "The maximum number of Streams an account can create",
"minimum": -1
},
"max_consumers": {
"type": "integer",
"description": "The maximum number of Consumer an account can create",
"minimum": -1
}
}
},
"stored_message": {
"type": "object",
"additionalProperties": false,
"required": ["subject", "seq", "data", "time"],
"properties": {
"subject": {
"type": "string",
"description": "The subject the message was originally received on",
"minLength": 1
},
"seq": {
"type": "integer",
"description": "The sequence number of the message in the Stream",
"minimum": 0
},
"data": {
"type": "string",
"description": "The base64 encoded payload of the message body",
"minLength": 0
},
"time": {
"type": "string",
"description": "The time the message was received"
},
"hdrs": {
"type": "string",
"description": "Base64 encoded headers for the message"
}
}
},
"iterable_request": {
"type": "object",
"additionalProperties": false,
"required": ["offset"],
"properties": {
"offset": {
"type": "integer",
"minimum": 0
}
}
},
"iterable_response": {
"type": "object",
"required": ["total", "offset", "limit"],
"properties": {
"total": {
"type": "integer",
"minimum": 0
},
"offset": {
"type": "integer",
"minimum": 0
},
"limit": {
"type": "integer",
"minimum": 0
}
}
},
"error_response": {
"type": "object",
"required": ["error"],
"properties": {
"error": {
"$ref": "#/definitions/api_error"
}
}
},
"api_error": {
"type": "object",
"required": ["code"],
"properties": {
"code": {
"type": "integer",
"description": "HTTP like error code in the 300 to 500 range",
"minimum": 300,
"maximum": 699
},
"description": {
"type": "string",
"description": "A human friendly description of the error"
},
"err_code": {
"type": "integer",
"description": "The NATS error code unique to each kind of error",
"minimum": 0,
"maximum": 65535
}
}
},
"basic_name": {
"type": "string",
"pattern": "^[^.*>]+$",
"minLength": 1
},
"deliver_policy": {
"oneOf": [
{"$ref": "#/definitions/all_deliver_policy"},
{"$ref": "#/definitions/last_deliver_policy"},
{"$ref": "#/definitions/new_deliver_policy"},
{"$ref": "#/definitions/start_sequence_deliver_policy"},
{"$ref": "#/definitions/start_time_deliver_policy"}
]
},
"all_deliver_policy": {
"required": ["deliver_policy"],
"properties": {
"deliver_policy": {
"type": "string",
"enum": ["all"]
}
}
},
"last_deliver_policy": {
"required": ["deliver_policy"],
"properties": {
"deliver_policy": {
"type": "string",
"enum": ["last"]
}
}
},
"new_deliver_policy": {
"required": ["deliver_policy"],
"properties": {
"deliver_policy": {
"type": "string",
"enum": ["new"]
}
}
},
"start_sequence_deliver_policy": {
"required": ["deliver_policy", "opt_start_seq"],
"properties": {
"deliver_policy": {
"type": "string",
"enum": ["by_start_sequence"]
},
"opt_start_seq": {
"type": "integer",
"minimum": 0
}
}
},
"start_time_deliver_policy": {
"required": ["deliver_policy", "opt_start_time"],
"properties": {
"deliver_policy": {
"type": "string",
"enum": ["by_start_time"]
},
"opt_start_time": {
"type": "string"
}
}
},
"sequence_pair": {
"type": "object",
"additionalProperties": false,
"required": ["consumer_seq", "stream_seq"],
"properties": {
"consumer_seq": {
"type": "integer",
"description": "The sequence number of the Consumer",
"minimum": 0
},
"stream_seq": {
"type": "integer",
"description": "The sequence number of the Stream",
"minimum": 0
}
}
},
"consumer_info": {
"required": ["stream_name", "name", "config", "created", "delivered", "ack_floor", "num_ack_pending", "num_redelivered", "num_waiting", "num_pending"],
"type": "object",
"properties": {
"stream_name": {
"type": "string",
"description": "The Stream the consumer belongs to"
},
"name": {
"type": "string",
"description": "A unique name for the consumer, either machine generated or the durable name"
},
"config": {
"$ref": "#/definitions/consumer_configuration"
},
"created": {
"type": "string"
},
"delivered": {
"description": "The last message delivered from this Consumer",
"$ref": "#/definitions/sequence_pair"
},
"ack_floor": {
"description": "The highest contiguous acknowledged message",
"$ref": "#/definitions/sequence_pair"
},
"num_ack_pending": {
"description": "The number of messages pending acknowledgement",
"type": "integer",
"minimum": 0
},
"num_redelivered": {
"description": "The number of redeliveries that have been performed",
"type": "integer",
"minimum": 0
},
"num_waiting": {
"description": "The number of pull consumers waiting for messages",
"type": "integer",
"minimum": 0
},
"num_pending": {
"description": "The number of messages left unconsumed in this Consumer",
"type": "integer",
"minimum": 0
},
"cluster": {
"$ref": "#/definitions/cluster_info"
}
}
},
"consumer_configuration": {
"required":[
"deliver_policy",
"ack_policy",
"replay_policy"
],
"allOf": [{"$ref": "#/definitions/deliver_policy"}],
"properties": {
"durable_name": {
"description": "A unique name for a durable consumer",
"$ref": "#/definitions/basic_name"
},
"deliver_subject": {
"type": "string",
"minLength": 1
},
"ack_policy": {
"type": "string",
"enum": ["none", "all", "explicit"]
},
"ack_wait": {
"description": "How long (in nanoseconds) to allow messages to remain un-acknowledged before attempting redelivery",
"type": "integer",
"minimum": 1
},
"max_deliver": {
"type": "integer",
"description": "The number of times a message will be redelivered to consumers if not acknowledged in time"
},
"filter_subject": {
"type": "string"
},
"replay_policy": {
"type": "string",
"enum": ["instant", "original"]
},
"sample_freq": {
"type": "string"
},
"rate_limit_bps": {
"type": "integer",
"description": "The rate at which messages will be delivered to clients, expressed in bit per second",
"minimum": 0
},
"max_ack_pending": {
"type": "integer",
"description": "The maximum number of messages without acknowledgement that can be outstanding, once this limit is reached message delivery will be suspended"
},
"idle_heartbeat": {
"type": "integer",
"minimum": 0,
"description": "If the Consumer is idle for more than this many nano seconds a empty message with Status header 100 will be sent indicating the consumer is still alive"
},
"flow_control": {
"type": "boolean",
"description": "For push consumers this will regularly send an empty mess with Status header 100 and a reply subject, consumers must reply to these messages to control the rate of message delivery"
},
"max_waiting": {
"type": "integer",
"description": "The number of pulls that can be outstanding on a pull consumer, pulls received after this is reached are ignored",
"minimum": 0,
"default": 512
},
"direct": {
"type": "boolean",
"description": "Creates a special consumer that does not touch the Raft layers, not for general use by clients, internal use only",
"default": false
}
}
},
"stream_info": {
"type": "object",
"required": ["config", "state", "created"],
"properties": {
"config": {
"type": "object",
"description": "The active configuration for the Stream",
"allOf": [
{"$ref": "#/definitions/stream_configuration"}
]
},
"state": {
"type": "object",
"description": "Detail about the current State of the Stream",
"allOf": [
{"$ref": "#/definitions/stream_state"}
]
},
"created": {
"description": "Timestamp when the stream was created",
"type": "string"
},
"cluster": {
"$ref": "#/definitions/cluster_info"
},
"mirror": {
"$ref": "#/definitions/stream_source_info"
},
"sources": {
"type": "array",
"description": "Streams being sourced into this Stream",
"items": {
"$ref": "#/definitions/stream_source_info"
}
}
}
},
"stream_state": {
"type": "object",
"additionalProperties": false,
"required": ["messages", "bytes", "first_seq", "last_seq", "consumer_count"],
"properties": {
"messages": {
"type": "integer",
"description": "Number of messages stored in the Stream",
"minimum": 0
},
"bytes": {
"type": "integer",
"description": "Combined size of all messages in the Stream",
"minimum": 0
},
"first_seq": {
"type": "integer",
"description": "Sequence number of the first message in the Stream",
"minimum": 0
},
"first_ts": {
"type": "string",
"description": "The timestamp of the first message in the Stream"
},
"last_seq": {
"type": "integer",
"description": "Sequence number of the last message in the Stream",
"minimum": 0
},
"last_ts": {
"type": "string",
"description": "The timestamp of the last message in the Stream"
},
"deleted": {
"description": "IDs of messages that were deleted using the Message Delete API or Interest based streams removing messages out of order",
"type": "array",
"minLength": 0,
"items": {
"type": "integer",
"minimum": 0
}
},
"num_deleted": {
"description": "The number of deleted messages",
"type": "integer",
"minimum": 0
},
"lost": {
"$ref": "#/definitions/lost_stream_data"
},
"consumer_count": {
"type": "integer",
"description": "Number of Consumers attached to the Stream",
"minimum": 0
}
}
},
"stream_configuration": {
"type": "object",
"required":[
"retention",
"max_consumers",
"max_msgs",
"max_bytes",
"max_age",
"storage",
"num_replicas"
],
"additionalProperties": false,
"properties": {
"name": {
"description": "A unique name for the Stream, empty for Stream Templates.",
"type": "string",
"pattern": "^[^.*>]*$",
"minLength": 0
},
"subjects": {
"description": "A list of subjects to consume, supports wildcards. Must be empty when a mirror is configured. May be empty when sources are configured.",
"type": "array",
"minLength": 0,
"items": {
"type": "string"
}
},
"retention": {
"description": "How messages are retained in the Stream, once this is exceeded old messages are removed.",
"type": "string",
"enum": ["limits", "interest", "workqueue"],
"default": "limits"
},
"max_consumers": {
"description": "How many Consumers can be defined for a given Stream. -1 for unlimited.",
"type": "integer",
"minimum": -1,
"default": -1
},
"max_msgs": {
"description": "How many messages may be in a Stream, oldest messages will be removed if the Stream exceeds this size. -1 for unlimited.",
"type": "integer",
"minimum": -1,
"default": -1
},
"max_msgs_per_subject": {
"description": "For wildcard streams ensure that for every unique subject this many messages are kept - a per subject retention limit",
"type": "integer",
"minimum": -1,
"default": -1,
},
"max_bytes": {
"description": "How big the Stream may be, when the combined stream size exceeds this old messages are removed. -1 for unlimited.",
"type": "integer",
"minimum": -1,
"default": -1
},
"max_age": {
"description": "Maximum age of any message in the stream, expressed in nanoseconds. 0 for unlimited.",
"type": "integer",
"minimum": 0,
"default": 0
},
"max_msg_size": {
"description": "The largest message that will be accepted by the Stream. -1 for unlimited.",
"type": "integer",
"minimum": -1,
"default": -1
},
"storage": {
"description": "The storage backend to use for the Stream.",
"type": "string",
"enum": ["file", "memory"],
"default": "file"
},
"num_replicas": {
"description": "How many replicas to keep for each message.",
"type": "integer",
"minimum": 1,
"default": 1,
"maximum": 5
},
"no_ack": {
"description": "Disables acknowledging messages that are received by the Stream.",
"type": "boolean",
"default": false
},
"template_owner": {
"description": "When the Stream is managed by a Stream Template this identifies the template that manages the Stream.",
"type": "string"
},
"discard": {
"description": "When a Stream reach it's limits either old messages are deleted or new ones are denied",
"type": "string",
"enum": ["old", "new"],
"default": "old"
},
"duplicate_window": {
"description": "The time window to track duplicate messages for, expressed in nanoseconds. 0 for default",
"type": "integer",
"minimum": 0,
"default": 0
},
"placement": {
"description": "Placement directives to consider when placing replicas of this stream, random placement when unset",
"$ref": "#/definitions/placement"
},
"mirror": {
"description": "Maintains a 1:1 mirror of another stream with name matching this property. When a mirror is configured subjects and sources must be empty.",
"$ref": "#/definitions/stream_source"
},
"sources": {
"type": "array",
"description": "List of Stream names to replicate into this Stream",
"items": {
"$ref": "#/definitions/stream_source"
}
}
}
},
"stream_template_info": {
"type": "object",
"required": ["config", "streams"],
"properties": {
"config": {
"$ref": "#/definitions/stream_template_configuration"
},
"streams": {
"description": "List of Streams managed by this Template",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"stream_template_configuration": {
"type": "object",
"additionalProperties": false,
"required": ["name", "config", "max_streams"],
"properties": {
"name": {
"type": "string",
"description": "A unique name for the Template"
},
"config": {
"description": "The template configuration to create Streams with",
"$ref": "#/definitions/stream_configuration"
},
"max_streams": {
"type": "integer",
"description": "The maximum number of streams to allow using this Template",
"minimum": -1
}
}
}
}
}