-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathschemas.yaml
More file actions
3658 lines (3528 loc) · 147 KB
/
schemas.yaml
File metadata and controls
3658 lines (3528 loc) · 147 KB
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
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 2022-Present Couchbase, Inc.
#
# Use of this software is governed by the Business Source License included
# in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
# in that file, in accordance with the Business Source License, use of this
# software will be governed by the Apache License, Version 2.0, included in
# the file licenses/APL2.txt.
ExpVars:
type: object
properties:
cmdline:
description: 'Built-in variables from the Go runtime, lists the command-line arguments'
type: object
memstats:
description: Dumps a large amount of information about the memory heap and garbage collector
type: object
cb:
description: Variables reported by the Couchbase SDK (go_couchbase package)
type: object
mc:
description: Variables reported by the low-level memcached API (gomemcached package)
type: object
syncGateway_changeCache:
type: object
properties:
maxPending:
description: Max number of sequences waiting on a missing earlier sequence number
type: object
lag-tap-0000ms:
description: Histogram of delay from doc save till it shows up in Tap feed
type: object
lag-queue-0000ms:
description: Histogram of delay from Tap feed till doc is posted to changes feed
type: object
lag-total-0000ms:
description: Histogram of total delay from doc save till posted to changes feed
type: object
outOfOrder:
description: Number of out-of-order sequences posted
type: object
view_queries:
description: Number of queries to channels view
type: object
syncGateway_db:
type: object
properties:
channelChangesFeeds:
description: 'Number of calls to db.changesFeed, i.e. generating a changes feed for a single channel.'
type: object
channelLogAdds:
description: Number of entries added to channel logs
type: object
channelLogAppends:
description: Number of times entries were written to channel logs using an APPEND operation
type: object
channelLogCacheHits:
description: Number of requests for channel-logs that were fulfilled from the in-memory cache
type: object
channelLogRewrites:
description: Number of times entries were written to channel logs using a SET operation (rewriting the entire log)
type: object
channelLogRewriteCollisions:
description: Number of collisions while attempting to rewrite channel logs using SET
type: object
document_gets:
description: Number of times a document was read from the database
type: object
revisionCache_adds:
description: Number of revisions added to the revision cache
type: object
revisionCache_hits:
description: Number of times a revision-cache lookup succeeded
type: object
revisionCache_misses:
description: Number of times a revision-cache lookup failed
type: object
revs_added:
description: Number of revisions added to the database (including deletions)
type: object
sequence_gets:
description: Number of times the database's lastSequence was read
type: object
sequence_reserves:
description: Number of times the database's lastSequence was incremented
type: object
syncgateway:
description: Monitoring stats
type: object
properties:
global:
description: Global Sync Gateway stats
type: object
properties:
resource_utilization:
description: Resource utilization stats
type: object
properties:
admin_net_bytes_recv:
type: integer
description: "The total number of bytes received (since node start-up) on the network interface to which the Sync Gateway api.admin_interface is bound."
admin_net_bytes_sent:
type: integer
description: "The total number of bytes sent (since node start-up) on the network interface to which the Sync Gateway api.admin_interface is bound."
error_count:
type: integer
description: "The total number of errors logged."
go_memstats_heapalloc:
type: integer
description: "HeapAlloc is bytes of allocated heap objects. Allocated heap objects include all reachable objects, as well as unreachable objects that the garbage collector has not yet freed. Specifically, HeapAlloc increases as heap objects are allocated and decreases as the heap is swept and unreachable objects are freed. Sweeping occurs incrementally between GC cycles, so these two processes occur simultaneously, and as a result HeapAlloc tends to change smoothly (in contrast with the sawtooth that is typical of stop-the-world garbage collectors)."
go_memstats_heapidle:
type: integer
description: "HeapIdle is bytes in idle (unused) spans. Idle spans have no objects in them. These spans could be (and may already have been) returned to the OS, or they can be reused for heap allocations, or they can be reused as stack memory. HeapIdle minus HeapReleased estimates the amount of memory that could be returned to the OS, but is being retained by the runtime so it can grow the heap without requesting more memory from the OS. If this difference is significantly larger than the heap size, it indicates there was a recent transient spike in live heap size."
go_memstats_heapinuse:
type: integer
description: "HeapInuse is bytes in in-use spans. In-use spans have at least one object in them. These spans an only be used for other objects of roughly the same size. HeapInuse minus HeapAlloc estimates the amount of memory that has been dedicated to particular size classes, but is not currently being used. This is an upper bound on fragmentation, but in general this memory can be reused efficiently."
go_memstats_heapreleased:
type: integer
description: "HeapReleased is bytes of physical memory returned to the OS. This counts heap memory from idle spans that was returned to the OS and has not yet been reacquired for the heap."
go_memstats_pausetotalns:
type: integer
description: "PauseTotalNs is the cumulative nanoseconds in GC stop-the-world pauses since the program started. During a stop-the-world pause, all goroutines are paused and only the garbage collector can run."
go_memstats_stackinuse:
type: integer
description: "StackInuse is bytes in stack spans. In-use stack spans have at least one stack in them. These spans can only be used for other stacks of the same size. There is no StackIdle because unused stack spans are returned to the heap (and hence counted toward HeapIdle)."
go_memstats_stacksys:
type: integer
description: "StackSys is bytes of stack memory obtained from the OS. StackSys is StackInuse, plus any memory obtained directly from the OS for OS thread stacks (which should be minimal)."
go_memstats_sys:
type: integer
description: "Sys is the total bytes of memory obtained from the OS. Sys is the sum of the XSys fields below. Sys measures the virtual address space reserved by the Go runtime for the heap, stacks, and other internal data structures. It's likely that not all of the virtual address space is backed by physical memory at any given moment, though in general it all was at some point."
goroutines_high_watermark:
type: integer
description: "Peak number of go routines since process start."
num_goroutines:
type: integer
description: "The total number of goroutines."
num_idle_kv_ops:
type: integer
description: "The total number of idle kv operations."
num_idle_query_ops:
type: integer
description: "The total number of idle query operations."
process_cpu_percent_utilization:
type: number
format: float
description: "The CPU utilization as percentage value * 10. The extra 10 multiplier is a mistake left for backwards compatibility. Please consider using node_cpu_percent_utilization as of version 3.2. The CPU usage calculation is performed based on user and system CPU time, but it does not include components such as iowait. The derivation means that the values of process_cpu_percent_utilization and %Cpu, returned when running the top command, will differ."
node_cpu_percent_utilization:
type: number
format: float
description: "The node CPU utilization as percentage value, since the last time this stat was called. The CPU usage calculation is performed based on user and system CPU time, but it does not include components such as iowait."
process_memory_resident:
type: integer
description: "The memory utilization (Resident Set Size) for the process, in bytes."
pub_net_bytes_recv:
type: integer
description: "The total number of bytes received (since node start-up) on the network interface to which the Sync Gateway api.public_interface is bound. By default, that is the number of bytes received on 127.0.0.1:4984 since node start-up"
pub_net_bytes_sent:
type: integer
description: "The total number of bytes sent (since node start-up) on the network interface to which Sync Gateway api.public_interface is bound. By default, that is the number of bytes sent on 127.0.0.1:4984 since node start-up."
system_memory_total:
type: integer
description: "The total memory available on the system in bytes."
warn_count:
type: integer
description: "The total number of warnings logged."
uptime:
type: integer
description: "The total uptime."
per_db:
description: |-
This array contains stats for all databases declared in the config file — see [View Statistics and Metrics](stats-monitoring.html) for more details on the metrics collected and reported by Sync Gateway.
The statistics for each database are grouped into:
- cache related statistics
- collections statistics
- cbl_replication_push
- cbl_replication_pull
- database_related_statistics
- delta_sync
- gsi_views
- security_related_statistics
- shared_bucket_import
- per_replication statistics for each `replication_id`
type: array
items:
type: object
properties:
cache:
type: object
database:
type: object
per_replication:
type: object
collections:
type: object
security:
type: object
per_replication:
description: |-
An array of stats for each replication declared in the config file
**Deprecated @ 2.8**: used only by inter-sync-gateway replications version 1.
type: array
items:
type: object
description: Stats for a given replication_id
properties:
$replication_id:
type: object
properties:
sgr_active:
description: |-
Whether the replication is active at this time.
**Deprecated @ 2.8**: used only by inter-sync-gateway replications version 1.
type: boolean
sgr_docs_checked_sent:
description: |-
The total number of documents checked for changes since replication started.
This represents the number of potential change notifications pushed by Sync Gateway.
**Constraints**
This is not necessarily the number of documents pushed, as a given target might already have the change.
Used by versions 1 and 2.
type: integer
sgr_num_attachments_transferred:
description: |-
The total number of attachments transferred since replication started.
**Deprecated @ 2.8**: used only by inter-sync-gateway replications version 1.
type: integer
sgr_num_attachment_bytes_transferred:
description: |-
The total number of attachment bytes transferred since replication started.
**Deprecated @ 2.8**: used only by inter-sync-gateway replications version 1.
type: integer
sgr_num_docs_failed_to_push:
description: |-
The total number of documents that failed to be pushed since replication started.
Used by versions 1 and 2.
type: integer
sgr_num_docs_pushed:
description: |-
The total number of documents that were pushed since replication started.
Used by versions 1 and 2.
type: integer
deprecated: true
User:
description: Properties associated with a user
type: object
properties:
name:
description: |-
The name of the user.
User names can only have alphanumeric ASCII characters and underscores.
type: string
password:
description: |-
The password of the user.
Mandatory. unless `allow_empty_password` is `true` in the database configs.
type: string
admin_channels:
description: |-
A list of channels to explicitly grant to the user for the default collection.
See `collection_access` for channels in named collections.
type: array
items:
type: string
all_channels:
description: |-
All the channels that the user has been granted access to for the default collection.
See `collection_access` for channels in named collections.
Access could have been granted through the sync function, roles, or explicitly on the user under the `admin_channels` property.
type: array
items:
type: string
readOnly: true
$ref: '#/CollectionAccessConfig'
email:
description: The email address of the user.
type: string
disabled:
description: 'If true, the user will not be able to login to the account as it is disabled.'
type: boolean
default: false
admin_roles:
description: A list of roles to explicitly grant to the user.
type: array
items:
type: string
roles:
description: |-
All the roles that the user has been granted access to.
Access could have been granted through the sync function, roles_claim, or explicitly on the user under the `admin_roles` property.
type: array
items:
type: string
readOnly: true
jwt_roles:
description: The roles that the user has been added to through roles_claim.
type: array
items:
type: string
readOnly: true
jwt_channels:
description: The channels that the user has been granted access to through channels_claim for the default collection.
type: array
items:
type: string
readOnly: true
jwt_issuer:
description: The issuer of the last JSON Web Token that the user last used to sign in.
type: string
readOnly: true
jwt_last_updated:
description: The last time that the user's JWT roles/channels were updated.
type: string
format: date-time
readOnly: true
title: User
CollectionAccessConfig:
collection_access:
description: A set of access grants by scope and collection for a specific collection.
type: object
additionalProperties:
maxProperties: 1
description: An object keyed by scope, containing a set of collections.
type: object
x-additionalPropertiesName: scopename
additionalProperties:
description: An object keyed by collection name, defines access collections in this scope.
type: object
x-additionalPropertiesName: collectionname
properties:
admin_channels:
description: A list of channels to explicitly grant to the user in this collection.
type: array
items:
type: string
all_channels:
description: |-
All the channels that the user has been granted access to in this collection.
Access could have been granted through the sync function, roles, or explicitly on the user under the `admin_channels` property.
type: array
items:
type: string
readOnly: true
jwt_channels:
description: The channels that the user has been granted access to through channels_claim for this collection.
type: array
items:
type: string
readOnly: true
jwt_last_updated:
description: The last time that the user's JWT channels were updated for this collection.
type: string
format: date-time
readOnly: true
Role:
description: Properties associated with a role
type: object
properties:
name:
description: |-
The name of the role.
Role names can only have alphanumeric ASCII characters and underscores.
type: string
admin_channels:
description: |-
A list of channels to explicitly grant to the role for the default collection.
See `collection_access` for channels in named collections.
type: array
items:
type: string
all_channels:
description: |-
All the channels that the role has been granted access to for the default collection.
These channels could have been assigned by the Sync function or using the `admin_channels` property.
type: array
items:
type: string
readOnly: true
$ref: '#/CollectionAccessConfig'
title: Role
User-session-information:
type: object
properties:
authentication_handlers:
description: The ways authentication can be established to authenticate as a user. Used for CouchDB compatibility. Always contains "default" and "cookie".
type: array
enum:
- ["default", "cookie"]
default: ["default", "cookie"]
ok:
description: Used for CouchDB compatibility. Always true.
type: boolean
enum:
- true
userCtx:
type: object
properties:
channels:
description: A map of the channels in the default collection that the user is in along with the sequence number the user was granted access. This does not include inherited channels through roles.
type: object
additionalProperties:
x-additionalPropertiesName: channelName
type: number
minimum: 1
description: The sequence number the user was granted access.
title: sequence number
example:
"!": 1
"channelA": 2
name:
description: The name of the user.
type: string
minLength: 1
required:
- channels
- name
required:
- authentication_handlers
- ok
- userCtx
title: User Session Information
OIDC-callback:
type: object
properties:
id_token:
description: The OpenID Connect ID token
type: string
refresh_token:
description: The OpenID Connect ID refresh token
type: string
session_id:
description: The Sync Gateway session token
type: string
name:
description: The Sync Gateway user
type: string
access_token:
description: The OpenID Connect access token
type: string
token_type:
description: The OpenID Connect ID token type
type: string
expires_in:
description: The time until the id_token expires (TTL).
type: number
title: OpenID Connect callback properties
OIDC-token:
description: Properties expected back from an OpenID Connect provider after successful authentication
type: object
properties:
access_token:
type: string
token_type:
type: string
refresh_token:
type: string
expires_in:
type: string
id_token:
type: string
title: OIDC-token
OIDC-login-page-handler:
description: Properties passed from the OpenID Connect mock login page to the handler
type: object
properties:
username:
type: string
tokenttl:
type: string
identity-token-formats:
type: string
authenticated:
type: string
required:
- username
- tokenttl
- identity-token-formats
- authenticated
Document:
description: |-
A Sync Gateway document. The document body is a JSON object whose top-level fields are the application's own data; Sync Gateway metadata is inlined into the same object using reserved `_`-prefixed field names (`_id`, `_rev`, `_exp`, etc.) listed below. Any top-level field that does not start with `_` is treated as user data and stored verbatim, and field values can be any valid JSON (including nested objects and arrays).
type: object
additionalProperties:
x-additionalPropertiesName: propertyname
description: A user-defined field belonging to the document body. Any JSON value is permitted. Field names beginning with `_` are reserved for Sync Gateway metadata.
properties:
_id:
description: The ID of the document.
type: string
_rev:
description: |-
The ancestor Revision Tree ID of the document, used by Sync Gateway as an optimistic concurrency control (OCC) value to detect conflicts when updating an existing document; omit this field when creating a new document. The value is typically taken from the `_rev` returned by a prior `GET` of the document, or from the `ETag` response header.
For single-document upserts ([PUT /{keyspace}/{docid}](#operation/put_keyspace-docid)), the `rev` query parameter and the `If-Match` request header are alternative OCC sources for the same document; for bulk upserts ([POST /{keyspace}/_bulk_docs](#operation/post_keyspace-_bulk_docs)), per-document OCC must be supplied in the doc body via this field or `_cv`. Clients may supply more than one OCC source as long as same-type values match exactly; mismatched values return HTTP 400. Precedence when multiple are present: `rev` query parameter, then `If-Match` header, then body `_cv`, then body `_rev`.
type: string
_cv:
description: |-
The ancestor Current Version (CV) ID of the document, used by Sync Gateway as an optimistic concurrency control (OCC) value to detect conflicts when updating an existing document; omit this field when creating a new document. The value is typically taken from the `_cv` returned by a prior `GET` of the document, or from the `ETag` response header.
Unlike the `rev` query parameter and `If-Match` header (which autodetect Revision Tree IDs vs Current Version IDs), this field must hold a CV. As with `_rev`, this can be supplied alongside other OCC sources as long as same-type values match exactly. See `_rev` for the full precedence order.
type: string
_exp:
description: |-
Expiry time after which the document will be purged. The expiration time is set and managed on the Couchbase Server document. The value can be specified in two ways; in ISO-8601 format, for example the 6th of July 2022 at 17:00 in the BST timezone would be `2016-07-06T17:00:00+01:00`; it can also be specified as a numeric Couchbase Server expiry value. Couchbase Server expiry values are specified as Unix time, and if the desired TTL is below 30 days then it can also represent an interval in seconds from the current time (for example, a value of 5 will remove the document 5 seconds after it is written to Couchbase Server). The document expiration time is returned in the response of `GET /{db}/{doc} ` when `show_exp=true` is included in the query.
As with the existing explicit purge mechanism, this applies only to the local database; it has nothing to do with replication. This expiration time is not propagated when the document is replicated. The purge of the document does not cause it to be deleted on any other database.
type: string
_deleted:
description: 'Whether the document is a tombstone or not. If true, it is a tombstone.'
type: boolean
_revisions:
description: |-
Encoded revision history for the document. This field is used by legacy 1.x REST replication protocol clients and CouchDB-style API callers to transmit ancestry alongside a revision. Most upsert/create requests should omit this field and rely on `_rev` alone.
type: object
properties:
start:
description: Prefix number for the latest revision.
type: number
ids:
description: 'Array of valid Revision Tree IDs, in reverse order (latest first).'
type: array
items:
type: string
_attachments:
description: |-
Binary attachments associated with the document, keyed by attachment name. Each entry describes a single attachment and its inline base64 data. Attachments are stored separately from the document body but travel with the document during replication.
type: object
additionalProperties:
x-additionalPropertiesName: attachmentname
description: The name of the attachment.
type: object
properties:
content_type:
description: Content type of the attachment.
type: string
data:
description: The data in the attachment in base64.
type: string
New-revision:
description: Properties returned when a new document revision is created
type: object
properties:
id:
description: The ID of the document.
type: string
ok:
description: Whether the request completed successfully.
type: boolean
rev:
description: The Revision Tree ID of the document.
type: string
cv:
description: The CV of the document.
type: string
required:
- id
- ok
- rev
title: New-revision
Changes-feed:
description: Properties of a changes feed
type: object
properties:
results:
type: array
items:
type: object
properties:
seq:
description: The change sequence number.
type: number
id:
description: The document ID the change happened on.
type: string
changes:
description: List of document leafs with each leaf containing only a `rev` or `cv` field.
type: array
items:
oneOf:
- type: object
properties:
rev:
description: The Revision Tree ID associated with the change. This may be returned even when the `version_type` preference is set to `cv` if this document was an old revision written prior to upgrading to SG 4.0+
type: string
title: Revision Tree ID
- type: object
properties:
cv:
description: The Current Version associated with the change. This value requires the `version_type` preference set to `cv` and this document revision being written through SG 4.0+
type: string
title: Current Version
uniqueItems: true
uniqueItems: true
last_seq:
description: The last change sequence number.
type: string
Design-doc:
description: Properties of a design document
type: object
properties:
language:
type: string
views:
type: object
additionalProperties:
x-additionalPropertiesName: viewname
description: The name of the view.
type: object
properties:
map:
type: string
reduce:
type: string
options:
type: object
properties:
local_seq:
type: string
include_design:
type: string
raw:
type: string
index_xattr_on_deleted_docs:
type: string
HTTP-Error:
type: object
properties:
error:
description: The error name.
type: string
reason:
description: The error description.
type: string
required:
- error
- reason
title: HTTP-Error
ISGRReplicationState:
description: This is the state that the replicator is in or that trying to transition in to.
type: string
enum:
- running
- stopped
- resetting
- error
- starting
- reconnecting
x-enumDescriptions:
running: Currently running replication.
stopped: Not running replication.
resetting: The replication is resetting its state.
error: The replication is stopped due to an error.
starting: The replication is starting up.
reconnecting: The replication is reconnecting to the remote database.
title: Replication Status
Retrieved-replication:
description: Properties of a replication
allOf:
- type: object
properties:
replication_id:
description: |-
This is the ID of the replication.
type: string
- $ref: '#/Replication'
- type: object
properties:
assigned_node:
description: The unique ID of the node assigned to the replication.
type: string
target_state:
$ref: '#/ISGRReplicationState'
cluster_uuid:
description: The cluster unique identifier.
type: string
title: Replication
Replication:
description: Properties of a replication
type: object
x-requirePropertiesSorted: true
properties:
adhoc:
description: |-
Set to true to run the replication as an adhoc replication instead of a persistent one.
This means that the replication will only last the period of the replication until the status is changed to `stopped` and then it will be removed automatically. It will also be removed if Sync Gateway restarts or if removed due to user action.
type: boolean
default: false
batch_size:
description: The amount of changes to be sent in one batch of replications. Changing this is an Enterprise Edition only feature.
type: integer
default: 200
collections_enabled:
description: |-
If true, the replicator will run with collections, and will replicate all collections, unless otherwise limited by `collections_local`.
If false, the replicator will only replicate the default collection.
type: boolean
default: false
collections_local:
description: |-
Limits the set of collections replicated to those listed in this array.
The replication will use all collections defined on the database if this list is empty.
type: array
items:
type: string
example: ["scope1.collection1", "scope1.collection3", "scope1.collection6"]
default: []
collections_remote:
description: |-
Remaps the local collection name to the one specified in this array when replicating with the remote.
If only a subset of collections need remapping, elements in this array can be specified as `null` to preserve the local collection name.
The same index is used for both `collections_remote` and `collections_local`, and both arrays must be the same length.
type: array
items:
type: string
nullable: true
example: ["scope1.collectionA", null, "scope1.collectionF"]
default: []
conflict_resolution_type:
description: |-
This defines what conflict resolution policy Sync Gateway should use to apply when resolving conflicting revisions.
Changing this is an Enterprise Edition only feature.
type: string
default: default
enum:
- default
- remoteWins
- localWins
- custom
x-enumDescriptions:
default: |-
This will use:
- Timestamp based conflict resolution (often referred to as "last write wins", or LWW). Which uses a document timestamp from most recent document revisions to compare.
- The revision with the most recent timestamp wins.
- If replicating a document that was last updated/written pre upgrade to SG 4.x, the default policy for versions < 4.x will be used.
localWins: This will result in local revisions always being the winner in any conflict.
remoteWins: This will result in remote revisions always being the winner in any conflict.
custom: This will result in conflicts going through your own custom conflict resolver. You must provide this logic as a Javascript function in the `custom_conflict_resolver` parameter.
continuous:
description: |-
If true, changes will be immediately synced when they happen. This is known as a continuous replication.
If false, all changes will be synced until they have been processed. The replication will then cease and not process any future changes (unless started again by the user). This is known as a one-shot replication.
type: boolean
default: false
custom_conflict_resolver:
description: |-
This specifies the Javascript function to use to resolve conflicts between conflicting revisions.
This **must** be used when `conflict_resolution_type=custom`. This property will be ignored when `conflict_resolution_type` is not `custom`.
The Javascript function to provide this property should be in backticks (like the sync function). The function takes 1 parameter which is a struct that represents the conflict. This struct has 2 properties:
* `LocalDocument` - The local document. This contains the document ID under the `_id` key.
* `RemoteDocument` - The remote document
The function should return the new document's body. This can be the winning revision (for example, `return conflict.LocalDocument`), a new body, or `nil` to resolve as a delete.
Example:
```javascript
function(conflict) {
console.log("Doc ID: "+conflict.LocalDocument._id);
console.log("Full remote doc: "+JSON.stringify(conflict.RemoteDocument));
return conflict.RemoteDocument;
}
```
Using complex `custom_conflict_resolver` functions can noticeably degrade performance. Use a built-in resolver whenever possible.
If a document merge is being done, the `_rev` and `_cv` properties should not be included in the returned document body as Sync Gateway will generate new values for these.
This is an Enterprise Edition only feature.
type: string
default: ""
direction:
description: |-
This specifies which direction the replication will be replicating with the `remote` replicator.
type: string
enum:
- push
- pull
- pushAndPull
x-enumDescriptions:
pull: changes are pulled from the remote database
push: changes are pushed to the remote database
pushAndPull: changes are both push-to and pulled-from the remote database
enable_delta_sync:
description: |-
This will turn on delta-sync for the replication. In order to enable delta-sync for a replication, the database level setting `delta_sync.enabled` must also be set to true.
Using delta-sync is an Enterprise Edition only feature.
type: boolean
default: false
filter:
description: |-
This defines whether to filter documents.
type: string
enum:
- sync_gateway/bychannel
- ""
x-enumDescriptions:
"": Do not filter any documents.
sync_gateway/bychannel: |-
If set, a pull replication will be limited to a specific set of channels specified by the `query_param.channels` property.
initial_state:
description: |-
This is what state to start the replication in when creating a new replication.
This allows you to control if the replication starts in a `stopped` start or `running` state.
Replications prior to Sync Gateway 2.8 will run in the default state `running`.
type: string
default: running
enum:
- running
- stopped
x-enumDescriptions:
running: The replication will immediately start running.
stopped: The replication configuration will be created but the replication will not start running until the user explicitly starts it.
max_backoff_time:
description: |-
Specifies the maximum time-period (in minutes) that Sync Gateway will attempt to reconnect to a lost or unreachable remote.
When a disconnection happens, Sync Gateway will do an exponential backoff up to this specified value. When this value is met, it will attempt to reconnect indefinitely every `max_backoff_time` minutes.
If this is set to 0, Sync Gateway will do the normal exponential backoff after the disconnect happens but then attempting 10 minutes and stop the replication.
Note: this defaults to 5 minutes for replications created prior to Sync Gateway 2.8.
type: integer
default: 5
purge_on_removal:
description: |-
Specifies whether to purge a document if the remote user loses access to all of the channels on the document when attempting to pull it from the remote.
If false, documents will not be replicated and not be purged when the user loses access.
type: boolean
default: false
query_params:
description: |-
This is a set of key/value pairs used in the query string of the replication.
If `filters=sync_gateway/bychannel` then this can be used to set the channels to filter by in a pull replication. To do this, set the `channels` key to a string array of the channels to filter by. For example:
```json
"filter":"sync_gateway/bychannel",
"query_params": {
"channels":["chanUser1"]
},
```
type: array
items:
type: string
remote:
description: |-
This is the endpoint of the database for the remote Sync Gateway that is the subject of this replication's `push`, `pull`, or `pushAndPull` action.
Typically this would include the URI, port, and database name. For example, `https://localhost:4985/db`.
type: string
remote_password:
description: |-
The password to use to authenticate with the remote. This password will be redacted in the replication config.
type: string
remote_username:
description: |-
The username to use to authenticate with the remote.
type: string
replication_id:
description: |-
This is the ID of the replication.
When creating a new replication using a POST request, this will be set to a random UUID if not explicitly set.
When the replication ID is specified in the URL, this must be set to the same replication ID if specifying it at all.
type: string
maximum: 160
run_as:
description: This is used if you want to specify a user to run the replication as. This means that the replication will only be able to replicate what the user access to what the user has access to.
type: string
password:
description: |-
**This has been deprecated in favour of `remote_password`.**
This is the password to use to authenticate with the remote. This password will be redacted in the replication config.
type: string
deprecated: true
username:
description: |-
**This has been deprecated in favour of `remote_username`.**
This is the username to use to authenticate with the remote.
type: string
deprecated: true
required:
- direction
title: User configurable replication properties
All-replications:
description: Contains all the replication IDs with their corresponding replication configurations
type: object
properties:
replication_id:
$ref: '#/Retrieved-replication'
title: All replications
Replication-status:
type: object
properties:
replication_id:
description: The ID of the replication.
type: string
config:
$ref: '#/Replication'
status:
$ref: '#/ISGRReplicationState'
error_message:
description: The error message of the replication if an error has occurred.
type: string
docs_read:
description: The number of documents that have been read (fetched) from the source database.
type: integer
docs_checked_pull:
type: integer
docs_purged:
description: The number of documents that have been purged.
type: integer
rejected_by_local:
description: The number of documents that were received by the local but did not get replicated due to getting rejected by the sync function on the local.
type: integer
last_seq_pull:
description: The last changes sequence number that was pulled from the remote.
type: string
deltas_recv:
description: The number of deltas that have been received from the remote.
type: integer
deltas_requested:
type: integer
docs_written:
description: The number of documents that have been wrote (pushed) to the target database.
type: integer
docs_checked_push:
type: integer
doc_write_failures:
description: The number of documents that have failed to be wrote (pushed) to the target database. There will be no attempt to try to push these docs again.
type: integer
doc_write_conflicts:
description: The number of documents that had a conflict.
type: integer
rejected_by_remote:
description: The number of documents that were received by the remote but did not get replicated due to getting rejected by the sync function on the remote.
type: integer
last_seq_push:
description: The last changes sequence number that was pushed to the remote.
type: string
deltas_sent:
description: 'The number of deltas that have been sent to the remote. '
type: integer
required:
- replication_id
title: Replication-status
Scopes:
description: Scope-specific configuration.
type: object
properties:
collections:
description: An object keyed by collection name containing config for the specific collection.
type: object
additionalProperties:
x-additionalPropertiesName: collectionname
$ref: '#/CollectionConfig'
title: Scopes
CollectionConfig:
description: Collection-specific configuration.
type: object
properties:
sync:
description: The Javascript function that newly created documents in this collection are ran through.
type: string
example: 'function(doc){channel("collection name");}'
import_filter:
description: |-
This is the function that all imported documents in this collection are ran through in order to filter out what to import and what not to import. This allows you to control what is made available to Couchbase Mobile clients. If it is not set, then no documents are filtered when imported.
`import_docs` in the database config must be true to make this field applicable.
type: string
example: 'function(doc) { if (doc.type != ''mobile'') { return false; } return true; }'
title: Collection config
CredentialsConfig:
description: The configuration for the credentials set.
type: object
properties:
username:
description: Username for authenticating to the bucket