forked from nemequ/vala-extra-vapis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libcouchbase.vapi
1477 lines (1363 loc) · 43.8 KB
/
libcouchbase.vapi
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 (C) 2013, Nicholas Melnick
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
[CCode (lower_case_cprefix = "lcb_", cheader_filename = "libcouchbase/couchbase.h")]
namespace LibCouchbase {
/**
* Define the error codes in use by the library
*/
[SimpleType]
[CCode (cname = "lcb_error_t", cprefix = "LCB_", has_type_id = false)]
public enum StatusResponse {
/**
* Indication of success
*/
SUCCESS,
/**
* This error code is only used internally within libcouchbase
* to represent a state in the network protocol
*/
AUTH_CONTINUE,
/**
* Authentication failed.
* You provided an invalid username/password combination.
*/
AUTH_ERROR,
/**
* The server detected that operation cannot be executed with
* requested arguments. For example, when incrementing not a number.
*/
DELTA_BADVAL,
/**
* The server reported that this object is too big
*/
E2BIG,
/**
* The server is too busy to handle your request right now.
* please back off and try again at a later time.
*/
EBUSY,
/**
* Internal error inside the library. You would have
* to destroy the instance and create a new one to recover.
*/
EINTERNAL,
/**
* Invalid arguments specified.
*/
EINVAL,
/**
* The server is out of memory
*/
ENOMEM,
/**
* An invalid range specified
*/
ERANGE,
/**
* A generic error code.
*/
ERROR,
/**
* The server tried to perform the requested operation, but failed
* due to a temporary constraint. Retrying the operation may work.
*/
ETMPFAIL,
/**
* The key already exists (with another CAS value)
*/
KEY_EEXISTS,
/**
* The key does not exists
*/
KEY_ENOENT,
/**
* Failed to open shared object
*/
DLOPEN_FAILED,
/**
* Failed to locate the requested symbol in the shared object
*/
DLSYM_FAILED,
/**
* A network related problem occured (name lookup, read/write/connect
* etc)
*/
NETWORK_ERROR,
/**
* The server who received the request is not responsible for the
* object anymore. (This happens during changes in the cluster
* topology)
*/
NOT_MY_VBUCKET,
/**
* The object was not stored on the server
*/
NOT_STORED,
/**
* The server doesn't support the requested command. This
* error code differs from LCB_UNKNOWN_COMMAND by that the server
* knows about the command, but for some reason decided to not
* support it.
*/
NOT_SUPPORTED,
/**
* The server doesn't know what that command is.
*/
UNKNOWN_COMMAND,
/**
* The server failed to resolve the requested hostname
*/
UNKNOWN_HOST,
/**
* There is something wrong with the datastream received from
* the server
*/
PROTOCOL_ERROR,
/**
* The operation timed out
*/
ETIMEDOUT,
/**
* Failed to connect to the requested server
*/
CONNECT_ERROR,
/**
* The requested bucket does not exist
*/
BUCKET_ENOENT,
/**
* The client ran out of memory
*/
CLIENT_ENOMEM,
/**
* The client encountered a temporary error (retry might resolve
* the problem)
*/
CLIENT_ETMPFAIL,
/**
* The instance of libcouchbase can't be used in this context
*/
EBADHANDLE,
/**
* Unexpected usage of the server protocol, like unexpected response.
* If you've received this error code, please record your steps and file
* the issue at: [[http://www.couchbase.com/issues/browse/MB]]
*/
SERVER_BUG,
/**
* Libcouchbase cannot load the plugin because of version mismatch
*/
PLUGIN_VERSION_MISMATCH,
/**
* The bootstrap hosts list use an invalid/unsupported format
*/
INVALID_HOST_FORMAT,
/**
* Invalid character used in the path component of an URL
*/
INVALID_CHAR,
/**
* Too many nodes were requested for the observe criteria
*/
DURABILITY_ETOOMANY,
/**
* The same key was passed multiple times in a command list
*/
DUPLICATE_COMMANDS,
/**
* The config says that there is no server yet at that
* position (-1 in the vbucket map)
*/
NO_MATCHING_SERVER,
/**
* An environment variable recognized by libcouchbase was detected,
* but it contains an invalid value format
*/
BAD_ENVIRONMENT,
/**
* An operation has not yet completed.
*/
BUSY,
/**
* Administrator account must not be used to access the data in the
* bucket.
*/
INVALID_USERNAME,
/**
* The contents of the configuration cache file are invalid.
*/
CONFIG_CACHE_INVALID,
/**
* The requested SASL mechanism (forced via lcb_cntl) was not
* available for use
*/
SASLMECH_UNAVAILABLE,
/**
* Maximum allowed number redirects reached. See lcb_cntl(3)
* manpage for LCB_MAX_REDIRECTS options to get/set this limit.
*/
TOO_MANY_REDIRECTS,
}
[CCode (cname = "lcb_io_ops_type_t", cprefix = "LCB_IO_OPS_", has_type_id = false)]
public enum IOType {
INVALID,
DEFAULT,
LIBEVENT,
WINSOCK,
LIBEV,
SELECT,
WINIOCP,
LIBUV
}
[SimpleType]
[CCode (cname = "lcb_io_opt_st")]
public struct IO {
public int version;
public void* dlhandle;
public void* iops;
}
[Compact]
[CCode (cname = "struct lcb_create_io_ops_st", destroy_function = "")]
public struct IOOptions {
public int version;
[CCode (cname = "v.v0.type")]
public IOType v0_type;
[CCode (cname = "v.v0.cookie")]
public void* v0_cookie;
[CCode (cname = "v.v1.sofile")]
public string v1_sofile;
[CCode (cname = "v.v1.symbol")]
public string v1_symbol;
[CCode (cname = "v.v1.cookie")]
public void* v1_cookie;
}
[SimpleType]
[CCode (cname = "lcb_type_t", cprefix="LCB_TYPE_")]
public enum ConnectionType {
BUCKET,
CLUSTER
}
[SimpleType]
[CCode (cname = "lcb_syncmode_t", cprefix="LCB_")]
public enum SyncMode {
ASYNCHRONOUS,
SYNCHRONOUS
}
[SimpleType]
[CCode (cname = "lcb_storage_t", cprefix="LCB_")]
public enum Storage {
/**
* Add the item to the cache, but fail if the object exists already
*/
ADD,
/**
* Replace the existing object in the cache
*/
REPLACE,
/**
* Unconditionally set the object in the cache
*/
SET,
/**
* Append this object to the existing object
*/
APPEND,
/**
* Prepend this object to the existing object
*/
PREPEND
}
[SimpleType]
[CCode (cname = "lcb_replica_t", cprefix="LCB_REPLICA_")]
public enum Replica {
FIRST,
ALL,
SELECT
}
/**
* Possible statuses for keys in OBSERVE response
*/
[SimpleType]
[CCode (cname = "lcb_observe_t", cprefix="LCB_REPLICA_")]
public enum Observe {
/**
* The item found in the memory, but not yet on the disk
*/
FOUND,
/**
* The item hit the disk
*/
PERSISTED,
/**
* The item missing on the disk and the memory
*/
NOT_FOUND,
/**
* No knowledge of the key
*/
LOGICALLY_DELETED
}
[SimpleType]
[CCode (cname = "lcb_verbosity_level_t", cprefix="LCB_VERBOSITY_")]
public enum Verbosity {
DETAIL,
DEBUG,
INFO,
WARNING
}
[SimpleType]
[CCode (cname = "lcb_http_type_t", cprefix="LCB_HTTP_TYPE_")]
public enum HttpType {
VIEW,
MANAGEMENT,
RAW,
MAX
}
[SimpleType]
[CCode (cname = "lcb_http_method_t", cprefix="LCB_HTTP_METHOD_")]
public enum HttpMethod {
GET,
POST,
PUT,
DELETE,
MAX
}
[Compact]
[CCode (cname = "struct lcb_create_st", destroy_function = "")]
public struct ConnectionOptions {
public int version;
[CCode (cname = "v.v0.host")]
public string v0_host;
[CCode (cname = "v.v0.user")]
public string v0_user;
[CCode (cname = "v.v0.passwd")]
public string v0_passwd;
[CCode (cname = "v.v0.bucket")]
public string v0_bucket;
[CCode (cname = "v.v0.io")]
public unowned IO v0_io;
/**
* A list of hosts:port separated by ';' to the administration port of
* the couchbase cluster. (ex: "host1;host2:9000;host3" would try to
* connect to host1 on port 8091, if that fails it'll connect to host2
* on port 9000 etc).
* The hostname may also be specified as a URI looking
* like: [[http://localhost:8091/pools]]
*/
[CCode (cname = "v.v1.host")]
public string host;
/**
* The username to use.
*/
[CCode (cname = "v.v1.user")]
public string user;
/**
* The password to use.
*/
[CCode (cname = "v.v1.passwd")]
public string passwd;
/**
* The bucket to connect to.
*/
[CCode (cname = "v.v1.bucket")]
public string bucket;
/**
* The io handle to use.
*/
[CCode (cname = "v.v1.io")]
public unowned IO io;
/**
* The type of the connection:
* * ConnectionType.BUCKET - NULL for bucket means "default" bucket
* * ConnectionType.CLUSTER - the bucket argument ignored and all data
* commands will return LCB_NOT_SUPPORTED
*/
[CCode (cname = "v.v1.type")]
public unowned ConnectionType type;
}
[Compact]
[CCode (cname = "lcb_get_resp_t", destroy_function = "")]
public struct GetResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.bytes", array_length_cname = "v.v0.nbytes", array_length_type = "size_t")]
public uint8[] bytes;
[CCode (cname = "v.v0.flags")]
public uint32 flags;
[CCode (cname = "v.v0.cas")]
public uint64 cas;
[CCode (cname = "v.v0.data_type")]
public uint8 data_type;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
/**
* Retrieve bytes as string.
*/
public string bytes_string() {
return uint8_to_terminated_string( bytes[0:bytes.length] );
}
}
[Compact]
[CCode (cname = "lcb_observe_resp_t", destroy_function = "")]
public struct ObserveResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.cas")]
public uint64 cas;
[CCode (cname = "v.v0.status")]
public Observe status;
[CCode (cname = "v.v0.from_master")]
public int from_master;
[CCode (cname = "v.v0.ttp")]
public time_t time_to_persist;
[CCode (cname = "v.v0.ttr")]
public time_t time_to_replicate;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
}
[Compact]
[CCode (cname = "lcb_store_resp_t", destroy_function = "")]
public struct StoreResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.cas")]
public uint64 cas;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
}
[Compact]
[CCode (cname = "lcb_remove_resp_t", destroy_function = "")]
public struct RemoveResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.cas")]
public uint64 cas;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
}
[Compact]
[CCode (cname = "lcb_touch_resp_t", destroy_function = "")]
public struct TouchResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.cas")]
public uint64 cas;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
}
[Compact]
[CCode (cname = "lcb_unlock_resp_t", destroy_function = "")]
public struct UnlockResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
}
[Compact]
[CCode (cname = "lcb_arithmetic_resp_t", destroy_function = "")]
public struct ArithmeticResponseInfo {
public int version;
[CCode (cname = "v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.value")]
public uint64 value;
[CCode (cname = "v.v0.cas")]
public uint64 cas;
/**
* Retrieve key as string.
*/
public string key_string() {
return uint8_to_terminated_string( key[0:key.length] );
}
}
[Compact]
[CCode (cname = "lcb_flush_resp_t", destroy_function = "")]
public struct FlushResponseInfo {
public int version;
[CCode (cname = "v.v0.server_endpoint")]
public string server_endpoint;
}
/**
* Create a new instance of one of the library-supplied io ops types.
* @param op Where to store the io ops structure
* @param options How to create the io ops structure
* @return StatusResponse.SUCCESS on success
*/
[CCode (cname = "lcb_create_io_ops", destroy_method = "lcb_destroy_io_ops")]
public static StatusResponse create_io_options ( ref IO op, ref IOOptions options );
[Compact]
[CCode (cname = "lcb_get_cmd_t", destroy_function = "", has_copy_function = false)]
public struct GetCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname="v.v0.exptime")]
public time_t exptime;
[CCode (cname="v.v0.lock")]
public int lock;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_store_cmd_t", destroy_function = "", has_copy_function = false)]
public struct StoreCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname = "v.v0.bytes", array_length_cname = "v.v0.nbytes", array_length_type = "size_t")]
public uint8[] bytes;
[CCode (cname="v.v0.flags")]
public uint32 flags;
[CCode (cname="v.v0.cas")]
public uint64 cas;
[CCode (cname="v.v0.datatype")]
public uint8 datatype;
[CCode (cname="v.v0.exptime")]
public time_t exptime;
[CCode (cname="v.v0.operation")]
public Storage operation;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_unlock_cmd_t", destroy_function = "", has_copy_function = false)]
public struct UnlockCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname="v.v0.cas")]
public uint64 cas;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_get_replica_cmd_t", destroy_function = "", has_copy_function = false)]
public struct GetReplicaCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] v0_key;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] v0_hashkey;
[CCode (cname="v.v1.key", array_length_cname = "v.v1.nkey", array_length_type = "size_t")]
public uint8[] v1_key;
[CCode (cname="v.v1.hashkey", array_length_cname = "v.v1.nhashkey", array_length_type = "size_t")]
public uint8[] v1_hashkey;
[CCode (cname="v.v1.strategy")]
public Replica v1_strategy;
[CCode (cname="v.v1.index")]
public size_t v1_index;
}
[Compact]
[CCode (cname = "lcb_touch_cmd_t", destroy_function = "", has_copy_function = false)]
public struct TouchCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname="v.v0.exptime")]
public time_t exptime;
[CCode (cname="v.v0.lock")]
public int lock;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_arithmetic_cmd_t", destroy_function = "", has_copy_function = false)]
public struct ArithmeticCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname="v.v0.exptime")]
public time_t exptime;
[CCode (cname="v.v0.create")]
public int create;
[CCode (cname="v.v0.delta")]
public int64 delta;
[CCode (cname="v.v0.initial")]
public uint64 initial;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_observe_cmd_t", destroy_function = "", has_copy_function = false)]
public struct ObserveCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_remove_cmd_t", destroy_function = "", has_copy_function = false)]
public struct RemoveCommand {
public int version;
[CCode (cname="v.v0.key", array_length_cname = "v.v0.nkey", array_length_type = "size_t")]
public uint8[] key;
[CCode (cname="v.v0.cas")]
public uint64 cas;
[CCode (cname="v.v0.hashkey", array_length_cname = "v.v0.nhashkey", array_length_type = "size_t")]
public uint8[] hashkey;
}
[Compact]
[CCode (cname = "lcb_server_stats_cmd_t", destroy_function = "", has_copy_function = false)]
public struct ServerStatsCommand {
public int version;
[CCode (cname="v.v0.name", array_length_cname = "v.v0.nname", array_length_type = "size_t")]
public uint8[] name;
}
[Compact]
[CCode (cname = "lcb_server_version_cmd_t", destroy_function = "", has_copy_function = false)]
public struct ServerVersionCommand {
public int version;
}
[Compact]
[CCode (cname = "lcb_verbosity_cmd_t", destroy_function = "", has_copy_function = false)]
public struct VerbosityCommand {
public int version;
[CCode (cname="v.v0.server")]
public string server;
[CCode (cname="v.v0.level")]
public Verbosity level;
}
[Compact]
[CCode (cname = "lcb_flush_cmd_t", destroy_function = "", has_copy_function = false)]
public struct FlushCommand {
public int version;
}
[Compact]
[CCode (cname = "lcb_http_cmd_t", destroy_function = "", has_copy_function = false)]
public struct HttpCommand {
public int version;
/**
* A view path string with optional query params (e.g. skip, limit etc.)
*/
[CCode (cname="v.v0.path", array_length_cname = "v.v0.npath", array_length_type = "size_t")]
public uint8[] path;
/**
* The POST body for HTTP request
*/
[CCode (cname="v.v0.body", array_length_cname = "v.v0.nbody", array_length_type = "size_t")]
public uint8[] body;
/**
* HTTP message type to be sent to server
*/
[CCode (cname="v.v0.method")]
public HttpMethod method;
/**
* If true the client will use HttpDataCallback to notify about response
* and will call HttpComplete with empty data eventually.
*/
[CCode (cname="v.v0.chunked")]
public int chunked;
/**
* The 'Content-Type' header for request. For view requests it is
* usually "application/json", for management --
* "application/x-www-form-urlencoded".
*/
[CCode (cname="v.v0.content_type")]
public string content_type;
}
[Compact]
[CCode (cname = "lcb_http_request_t", destroy_function = "")]
public struct HttpRequest {
}
[Compact]
[CCode (cname = "lcb_http_resp_t", destroy_function = "")]
public struct HttpResponse {
[CCode (cname="v.v0.status")]
public int status;
[CCode (cname="v.v0.path", array_length_cname = "v.v0.npath", array_length_type = "size_t")]
public uint8[] path;
[CCode (cname="v.v0.headers", array_length = false)]
public string[] headers;
[CCode (cname="v.v0.bytes", array_length_cname = "v.v0.nbytes", array_length_type = "size_t")]
public uint8[] bytes;
/**
* Retrieve path as string.
*/
public string path_string() {
return uint8_to_terminated_string( path[0:path.length] );
}
/**
* Retrieve bytes as string.
*/
public string bytes_string() {
return uint8_to_terminated_string( bytes[0:bytes.length] );
}
}
/**
* The callback function for a "get-style" request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info More information about the actual item (only key
* and nkey is valid if error != LCB_SUCCESS)
*/
[CCode (cname = "lcb_get_callback", has_target = false, has_type_id = false)]
public delegate void GetCallback ( Client instance, void* cookie,
StatusResponse status, GetResponseInfo response_info );
/**
* The callback function for a storage request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param operation Storage type
* @param status The status of the operation
* @param response_info additional response info
*/
[CCode (cname = "lcb_store_callback", has_target = false, has_type_id = false)]
public delegate void StoreCallback ( Client instance, void* cookie,
Storage operation, StatusResponse status, StoreResponseInfo response_info );
/**
* The callback function for a remove request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info additional response info
*/
[CCode (cname = "lcb_remove_callback", has_target = false, has_type_id = false)]
public delegate void RemoveCallback ( Client instance, void* cookie,
StatusResponse status, RemoveResponseInfo response_info );
/**
* The callback function for a touch request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info additional response info
*/
[CCode (cname = "lcb_touch_callback", has_target = false, has_type_id = false)]
public delegate void TouchCallback ( Client instance, void* cookie,
StatusResponse status, TouchResponseInfo response_info );
/**
* The callback function for an unlock request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info additional response info
*/
[CCode (cname = "lcb_unlock_callback", has_target = false, has_type_id = false)]
public delegate void UnlockCallback ( Client instance, void* cookie,
StatusResponse status, UnlockResponseInfo response_info );
/**
* The callback function for an arithmetic request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info additional response info
*/
[CCode (cname = "lcb_arithmetic_callback", has_target = false, has_type_id = false)]
public delegate void ArithmeticCallback ( Client instance, void* cookie,
StatusResponse status, ArithmeticResponseInfo response_info );
/**
* The callback function for an observe request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info More information about the operation (only key
* is valid if response != LCB_SUCCESS)
*/
[CCode (cname = "lcb_observe_callback", has_target = false, has_type_id = false)]
public delegate void ObserveCallback ( Client instance, void* cookie,
StatusResponse status, ObserveResponseInfo response_info );
/**
* The error callback called when we don't have a request context.
* This callback may be called when we encounter memory/network
* error(s), and we can't map it directly to an operation.
*
* @param instance the instance performing the operation
* @param status The StatusResponse we encountered
* @param error An optional string with more information about
* the error (if available)
*/
[CCode (cname = "lcb_error_callback", has_target = false, has_type_id = false)]
public delegate void ErrorCallback ( Client instance, StatusResponse status,
string? error );
/**
* The callback function for a flush request.
*
* @param instance the instance performing the operation
* @param cookie the cookie associated with with the command
* @param status The status of the operation
* @param response_info More information about the operation (only key
* is valid if response != LCB_SUCCESS)
*/
[CCode (cname = "lcb_flush_callback", has_target = false, has_type_id = false)]
public delegate void FlushCallback ( Client instance, void* cookie,
StatusResponse status, FlushResponseInfo response_info );
/**
* HttpCompleteCallback will notify that view execution was completed and
* lcb will pass response body to this callback unless HttpDataCallback is
* set up.
* @param request Source HttpRequest
* @param instance the instance performing the operation
* @param cookie Cookie from caller
* @param status The status of the operation
* @param response HttpResponse object
*/
[CCode (cname = "lcb_http_complete_callback", has_target = false, has_type_id = false)]
public delegate void HttpCompleteCallback ( HttpRequest request, Client instance,
void* cookie, StatusResponse status, HttpResponse* response );
/**
* The libcouchbase client instance.
*/
[SimpleType]
[CCode (cname = "lcb_t", free_function = "lcb_destroy", unref_function = "", lower_case_cprefix = "lcb_")]
public struct Client {
/**
* Alter whether get/store commands are synchronous or asynchronous.
*/
public SyncMode sync_mode {
[CCode (cname = "lcb_behavior_get_syncmode")] get;
[CCode (cname = "lcb_behavior_set_syncmode")] set;
}
/**
* Set the number of usec the library should allow an operation to
* be valid.
*
* Please note that the timeouts are <b>not</b> that accurate,
* because they may be delayed by the application code before it
* drives the event loop.
*
* Please note that timeouts is not stored on a per operation
* base, but on the instance. That means you <b>can't</b> pipeline
* two requests after eachother with different timeout values.
*/
public uint32 timeout {
[CCode (cname = "lcb_get_timeout")] get;
[CCode (cname = "lcb_set_timeout")] set;
}
public uint32 view_timeout {
[CCode (cname = "lcb_get_view_timeout")] get;
[CCode (cname = "lcb_set_view_timeout")] set;
}
/**
* Get the current host
*/
public string host {
[CCode (cname = "lcb_get_host")] get;
}
/**
* Get the current port
*/
public string port {
[CCode (cname = "lcb_get_port")] get;
}
/**
* Returns the last error that was seen within libcouchbase.
*/
public StatusResponse last_error {
[CCode (cname = "lcb_get_last_error")] get;
}
/**
* Alter or retrieve cookie associated with this instance.
*/
public void* cookie {
[CCode (cname = "lcb_get_cookie")] get;
[CCode (cname = "lcb_set_cookie")] set;
}
/**
* Returns non-zero if the event loop is running now.
*/
public int is_waiting {
[CCode (cname = "lcb_is_waiting")] get;
}
/**
* Get the number of the replicas in the cluster
*/
public int num_replicas {
[CCode (cname = "lcb_get_num_replicas")] get;