This repository has been archived by the owner on May 25, 2021. It is now read-only.
/
Cassandra.cs
16391 lines (15016 loc) · 460 KB
/
Cassandra.cs
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
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using FluentCassandra.Thrift;
using FluentCassandra.Thrift.Collections;
using System.Runtime.Serialization;
using FluentCassandra.Thrift.Protocol;
using FluentCassandra.Thrift.Transport;
namespace FluentCassandra.Apache.Cassandra
{
public partial class Cassandra {
public interface Iface {
void login(AuthenticationRequest auth_request);
#if SILVERLIGHT
IAsyncResult Begin_login(AsyncCallback callback, object state, AuthenticationRequest auth_request);
void End_login(IAsyncResult asyncResult);
#endif
void set_keyspace(string keyspace);
#if SILVERLIGHT
IAsyncResult Begin_set_keyspace(AsyncCallback callback, object state, string keyspace);
void End_set_keyspace(IAsyncResult asyncResult);
#endif
/// <summary>
/// Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This is
/// the only method that can throw an exception under non-failure conditions.)
/// </summary>
/// <param name="key"></param>
/// <param name="column_path"></param>
/// <param name="consistency_level"></param>
ColumnOrSuperColumn get(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_get(AsyncCallback callback, object state, byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level);
ColumnOrSuperColumn End_get(IAsyncResult asyncResult);
#endif
/// <summary>
/// Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name
/// pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned.
/// </summary>
/// <param name="key"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
List<ColumnOrSuperColumn> get_slice(byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_get_slice(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
List<ColumnOrSuperColumn> End_get_slice(IAsyncResult asyncResult);
#endif
/// <summary>
/// returns the number of columns matching <code>predicate</code> for a particular <code>key</code>,
/// <code>ColumnFamily</code> and optionally <code>SuperColumn</code>.
/// </summary>
/// <param name="key"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
int get_count(byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_get_count(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
int End_get_count(IAsyncResult asyncResult);
#endif
/// <summary>
/// Performs a get_slice for column_parent and predicate for the given keys in parallel.
/// </summary>
/// <param name="keys"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
Dictionary<byte[], List<ColumnOrSuperColumn>> multiget_slice(List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_multiget_slice(AsyncCallback callback, object state, List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
Dictionary<byte[], List<ColumnOrSuperColumn>> End_multiget_slice(IAsyncResult asyncResult);
#endif
/// <summary>
/// Perform a get_count in parallel on the given list<binary> keys. The return value maps keys to the count found.
/// </summary>
/// <param name="keys"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
Dictionary<byte[], int> multiget_count(List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_multiget_count(AsyncCallback callback, object state, List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level);
Dictionary<byte[], int> End_multiget_count(IAsyncResult asyncResult);
#endif
/// <summary>
/// returns a subset of columns for a contiguous range of keys.
/// </summary>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="range"></param>
/// <param name="consistency_level"></param>
List<KeySlice> get_range_slices(ColumnParent column_parent, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_get_range_slices(AsyncCallback callback, object state, ColumnParent column_parent, SlicePredicate predicate, KeyRange range, ConsistencyLevel consistency_level);
List<KeySlice> End_get_range_slices(IAsyncResult asyncResult);
#endif
/// <summary>
/// returns a range of columns, wrapping to the next rows if necessary to collect max_results.
/// </summary>
/// <param name="column_family"></param>
/// <param name="range"></param>
/// <param name="start_column"></param>
/// <param name="consistency_level"></param>
List<KeySlice> get_paged_slice(string column_family, KeyRange range, byte[] start_column, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_get_paged_slice(AsyncCallback callback, object state, string column_family, KeyRange range, byte[] start_column, ConsistencyLevel consistency_level);
List<KeySlice> End_get_paged_slice(IAsyncResult asyncResult);
#endif
/// <summary>
/// Returns the subset of columns specified in SlicePredicate for the rows matching the IndexClause
/// @deprecated use get_range_slices instead with range.row_filter specified
/// </summary>
/// <param name="column_parent"></param>
/// <param name="index_clause"></param>
/// <param name="column_predicate"></param>
/// <param name="consistency_level"></param>
[Obsolete("use get_range_slices instead with range.row_filter specified", error:true)]
List<KeySlice> get_indexed_slices(ColumnParent column_parent, IndexClause index_clause, SlicePredicate column_predicate, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_get_indexed_slices(AsyncCallback callback, object state, ColumnParent column_parent, IndexClause index_clause, SlicePredicate column_predicate, ConsistencyLevel consistency_level);
List<KeySlice> End_get_indexed_slices(IAsyncResult asyncResult);
#endif
/// <summary>
/// Insert a Column at the given column_parent.column_family and optional column_parent.super_column.
/// </summary>
/// <param name="key"></param>
/// <param name="column_parent"></param>
/// <param name="column"></param>
/// <param name="consistency_level"></param>
void insert(byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_insert(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, Column column, ConsistencyLevel consistency_level);
void End_insert(IAsyncResult asyncResult);
#endif
/// <summary>
/// Increment or decrement a counter.
/// </summary>
/// <param name="key"></param>
/// <param name="column_parent"></param>
/// <param name="column"></param>
/// <param name="consistency_level"></param>
void add(byte[] key, ColumnParent column_parent, CounterColumn column, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_add(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, CounterColumn column, ConsistencyLevel consistency_level);
void End_add(IAsyncResult asyncResult);
#endif
/// <summary>
/// Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
/// that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
/// row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those levels too.
/// </summary>
/// <param name="key"></param>
/// <param name="column_path"></param>
/// <param name="timestamp"></param>
/// <param name="consistency_level"></param>
void remove(byte[] key, ColumnPath column_path, long timestamp, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_remove(AsyncCallback callback, object state, byte[] key, ColumnPath column_path, long timestamp, ConsistencyLevel consistency_level);
void End_remove(IAsyncResult asyncResult);
#endif
/// <summary>
/// Remove a counter at the specified location.
/// Note that counters have limited support for deletes: if you remove a counter, you must wait to issue any following update
/// until the delete has reached all the nodes and all of them have been fully compacted.
/// </summary>
/// <param name="key"></param>
/// <param name="path"></param>
/// <param name="consistency_level"></param>
void remove_counter(byte[] key, ColumnPath path, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_remove_counter(AsyncCallback callback, object state, byte[] key, ColumnPath path, ConsistencyLevel consistency_level);
void End_remove_counter(IAsyncResult asyncResult);
#endif
/// <summary>
/// Mutate many columns or super columns for many row keys. See also: Mutation.
///
/// mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
/// *
/// </summary>
/// <param name="mutation_map"></param>
/// <param name="consistency_level"></param>
void batch_mutate(Dictionary<byte[], Dictionary<string, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_batch_mutate(AsyncCallback callback, object state, Dictionary<byte[], Dictionary<string, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level);
void End_batch_mutate(IAsyncResult asyncResult);
#endif
/// <summary>
/// Atomically mutate many columns or super columns for many row keys. See also: Mutation.
///
/// mutation_map maps key to column family to a list of Mutation objects to take place at that scope.
/// *
/// </summary>
/// <param name="mutation_map"></param>
/// <param name="consistency_level"></param>
void atomic_batch_mutate(Dictionary<byte[], Dictionary<string, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level);
#if SILVERLIGHT
IAsyncResult Begin_atomic_batch_mutate(AsyncCallback callback, object state, Dictionary<byte[], Dictionary<string, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level);
void End_atomic_batch_mutate(IAsyncResult asyncResult);
#endif
/// <summary>
/// Truncate will mark and entire column family as deleted.
/// From the user's perspective a successful call to truncate will result complete data deletion from cfname.
/// Internally, however, disk space will not be immediatily released, as with all deletes in cassandra, this one
/// only marks the data as deleted.
/// The operation succeeds only if all hosts in the cluster at available and will throw an UnavailableException if
/// some hosts are down.
/// </summary>
/// <param name="cfname"></param>
void truncate(string cfname);
#if SILVERLIGHT
IAsyncResult Begin_truncate(AsyncCallback callback, object state, string cfname);
void End_truncate(IAsyncResult asyncResult);
#endif
/// <summary>
/// for each schema version present in the cluster, returns a list of nodes at that version.
/// hosts that do not respond will be under the key DatabaseDescriptor.INITIAL_VERSION.
/// the cluster is all on the same version if the size of the map is 1.
/// </summary>
Dictionary<string, List<string>> describe_schema_versions();
#if SILVERLIGHT
IAsyncResult Begin_describe_schema_versions(AsyncCallback callback, object state, );
Dictionary<string, List<string>> End_describe_schema_versions(IAsyncResult asyncResult);
#endif
/// <summary>
/// list the defined keyspaces in this cluster
/// </summary>
List<KsDef> describe_keyspaces();
#if SILVERLIGHT
IAsyncResult Begin_describe_keyspaces(AsyncCallback callback, object state, );
List<KsDef> End_describe_keyspaces(IAsyncResult asyncResult);
#endif
/// <summary>
/// get the cluster name
/// </summary>
string describe_cluster_name();
#if SILVERLIGHT
IAsyncResult Begin_describe_cluster_name(AsyncCallback callback, object state, );
string End_describe_cluster_name(IAsyncResult asyncResult);
#endif
/// <summary>
/// get the thrift api version
/// </summary>
string describe_version();
#if SILVERLIGHT
IAsyncResult Begin_describe_version(AsyncCallback callback, object state, );
string End_describe_version(IAsyncResult asyncResult);
#endif
/// <summary>
/// get the token ring: a map of ranges to host addresses,
/// represented as a set of TokenRange instead of a map from range
/// to list of endpoints, because you can't use Thrift structs as
/// map keys:
/// https://issues.apache.org/jira/browse/THRIFT-162
///
/// for the same reason, we can't return a set here, even though
/// order is neither important nor predictable.
/// </summary>
/// <param name="keyspace"></param>
List<TokenRange> describe_ring(string keyspace);
#if SILVERLIGHT
IAsyncResult Begin_describe_ring(AsyncCallback callback, object state, string keyspace);
List<TokenRange> End_describe_ring(IAsyncResult asyncResult);
#endif
/// <summary>
/// get the mapping between token->node ip
/// without taking replication into consideration
/// https://issues.apache.org/jira/browse/CASSANDRA-4092
/// </summary>
Dictionary<string, string> describe_token_map();
#if SILVERLIGHT
IAsyncResult Begin_describe_token_map(AsyncCallback callback, object state, );
Dictionary<string, string> End_describe_token_map(IAsyncResult asyncResult);
#endif
/// <summary>
/// returns the partitioner used by this cluster
/// </summary>
string describe_partitioner();
#if SILVERLIGHT
IAsyncResult Begin_describe_partitioner(AsyncCallback callback, object state, );
string End_describe_partitioner(IAsyncResult asyncResult);
#endif
/// <summary>
/// returns the snitch used by this cluster
/// </summary>
string describe_snitch();
#if SILVERLIGHT
IAsyncResult Begin_describe_snitch(AsyncCallback callback, object state, );
string End_describe_snitch(IAsyncResult asyncResult);
#endif
/// <summary>
/// describe specified keyspace
/// </summary>
/// <param name="keyspace"></param>
KsDef describe_keyspace(string keyspace);
#if SILVERLIGHT
IAsyncResult Begin_describe_keyspace(AsyncCallback callback, object state, string keyspace);
KsDef End_describe_keyspace(IAsyncResult asyncResult);
#endif
/// <summary>
/// experimental API for hadoop/parallel query support.
/// may change violently and without warning.
///
/// returns list of token strings such that first subrange is (list[0], list[1]],
/// next is (list[1], list[2]], etc.
/// </summary>
/// <param name="cfName"></param>
/// <param name="start_token"></param>
/// <param name="end_token"></param>
/// <param name="keys_per_split"></param>
List<string> describe_splits(string cfName, string start_token, string end_token, int keys_per_split);
#if SILVERLIGHT
IAsyncResult Begin_describe_splits(AsyncCallback callback, object state, string cfName, string start_token, string end_token, int keys_per_split);
List<string> End_describe_splits(IAsyncResult asyncResult);
#endif
/// <summary>
/// Enables tracing for the next query in this connection and returns the UUID for that trace session
/// The next query will be traced idependently of trace probability and the returned UUID can be used to query the trace keyspace
/// </summary>
byte[] trace_next_query();
#if SILVERLIGHT
IAsyncResult Begin_trace_next_query(AsyncCallback callback, object state, );
byte[] End_trace_next_query(IAsyncResult asyncResult);
#endif
List<CfSplit> describe_splits_ex(string cfName, string start_token, string end_token, int keys_per_split);
#if SILVERLIGHT
IAsyncResult Begin_describe_splits_ex(AsyncCallback callback, object state, string cfName, string start_token, string end_token, int keys_per_split);
List<CfSplit> End_describe_splits_ex(IAsyncResult asyncResult);
#endif
/// <summary>
/// adds a column family. returns the new schema id.
/// </summary>
/// <param name="cf_def"></param>
string system_add_column_family(CfDef cf_def);
#if SILVERLIGHT
IAsyncResult Begin_system_add_column_family(AsyncCallback callback, object state, CfDef cf_def);
string End_system_add_column_family(IAsyncResult asyncResult);
#endif
/// <summary>
/// drops a column family. returns the new schema id.
/// </summary>
/// <param name="column_family"></param>
string system_drop_column_family(string column_family);
#if SILVERLIGHT
IAsyncResult Begin_system_drop_column_family(AsyncCallback callback, object state, string column_family);
string End_system_drop_column_family(IAsyncResult asyncResult);
#endif
/// <summary>
/// adds a keyspace and any column families that are part of it. returns the new schema id.
/// </summary>
/// <param name="ks_def"></param>
string system_add_keyspace(KsDef ks_def);
#if SILVERLIGHT
IAsyncResult Begin_system_add_keyspace(AsyncCallback callback, object state, KsDef ks_def);
string End_system_add_keyspace(IAsyncResult asyncResult);
#endif
/// <summary>
/// drops a keyspace and any column families that are part of it. returns the new schema id.
/// </summary>
/// <param name="keyspace"></param>
string system_drop_keyspace(string keyspace);
#if SILVERLIGHT
IAsyncResult Begin_system_drop_keyspace(AsyncCallback callback, object state, string keyspace);
string End_system_drop_keyspace(IAsyncResult asyncResult);
#endif
/// <summary>
/// updates properties of a keyspace. returns the new schema id.
/// </summary>
/// <param name="ks_def"></param>
string system_update_keyspace(KsDef ks_def);
#if SILVERLIGHT
IAsyncResult Begin_system_update_keyspace(AsyncCallback callback, object state, KsDef ks_def);
string End_system_update_keyspace(IAsyncResult asyncResult);
#endif
/// <summary>
/// updates properties of a column family. returns the new schema id.
/// </summary>
/// <param name="cf_def"></param>
string system_update_column_family(CfDef cf_def);
#if SILVERLIGHT
IAsyncResult Begin_system_update_column_family(AsyncCallback callback, object state, CfDef cf_def);
string End_system_update_column_family(IAsyncResult asyncResult);
#endif
/// <summary>
/// Executes a CQL (Cassandra Query Language) statement and returns a
/// CqlResult containing the results.
/// </summary>
/// <param name="query"></param>
/// <param name="compression"></param>
CqlResult execute_cql_query(byte[] query, Compression compression);
#if SILVERLIGHT
IAsyncResult Begin_execute_cql_query(AsyncCallback callback, object state, byte[] query, Compression compression);
CqlResult End_execute_cql_query(IAsyncResult asyncResult);
#endif
CqlResult execute_cql3_query(byte[] query, Compression compression, ConsistencyLevel consistency);
#if SILVERLIGHT
IAsyncResult Begin_execute_cql3_query(AsyncCallback callback, object state, byte[] query, Compression compression, ConsistencyLevel consistency);
CqlResult End_execute_cql3_query(IAsyncResult asyncResult);
#endif
/// <summary>
/// Prepare a CQL (Cassandra Query Language) statement by compiling and returning
/// - the type of CQL statement
/// - an id token of the compiled CQL stored on the server side.
/// - a count of the discovered bound markers in the statement
/// </summary>
/// <param name="query"></param>
/// <param name="compression"></param>
CqlPreparedResult prepare_cql_query(byte[] query, Compression compression);
#if SILVERLIGHT
IAsyncResult Begin_prepare_cql_query(AsyncCallback callback, object state, byte[] query, Compression compression);
CqlPreparedResult End_prepare_cql_query(IAsyncResult asyncResult);
#endif
CqlPreparedResult prepare_cql3_query(byte[] query, Compression compression);
#if SILVERLIGHT
IAsyncResult Begin_prepare_cql3_query(AsyncCallback callback, object state, byte[] query, Compression compression);
CqlPreparedResult End_prepare_cql3_query(IAsyncResult asyncResult);
#endif
/// <summary>
/// Executes a prepared CQL (Cassandra Query Language) statement by passing an id token and a list of variables
/// to bind and returns a CqlResult containing the results.
/// </summary>
/// <param name="itemId"></param>
/// <param name="values"></param>
CqlResult execute_prepared_cql_query(int itemId, List<byte[]> values);
#if SILVERLIGHT
IAsyncResult Begin_execute_prepared_cql_query(AsyncCallback callback, object state, int itemId, List<byte[]> values);
CqlResult End_execute_prepared_cql_query(IAsyncResult asyncResult);
#endif
CqlResult execute_prepared_cql3_query(int itemId, List<byte[]> values, ConsistencyLevel consistency);
#if SILVERLIGHT
IAsyncResult Begin_execute_prepared_cql3_query(AsyncCallback callback, object state, int itemId, List<byte[]> values, ConsistencyLevel consistency);
CqlResult End_execute_prepared_cql3_query(IAsyncResult asyncResult);
#endif
/// <summary>
/// @deprecated This is now a no-op. Please use the CQL3 specific methods instead.
/// </summary>
/// <param name="version"></param>
void set_cql_version(string version);
#if SILVERLIGHT
IAsyncResult Begin_set_cql_version(AsyncCallback callback, object state, string version);
void End_set_cql_version(IAsyncResult asyncResult);
#endif
}
public class Client : Iface {
public Client(TProtocol prot) : this(prot, prot)
{
}
public Client(TProtocol iprot, TProtocol oprot)
{
iprot_ = iprot;
oprot_ = oprot;
}
protected TProtocol iprot_;
protected TProtocol oprot_;
protected int seqid_;
public TProtocol InputProtocol
{
get { return iprot_; }
}
public TProtocol OutputProtocol
{
get { return oprot_; }
}
#if SILVERLIGHT
public IAsyncResult Begin_login(AsyncCallback callback, object state, AuthenticationRequest auth_request)
{
return send_login(callback, state, auth_request);
}
public void End_login(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
recv_login();
}
#endif
public void login(AuthenticationRequest auth_request)
{
#if !SILVERLIGHT
send_login(auth_request);
recv_login();
#else
var asyncResult = Begin_login(null, null, auth_request);
End_login(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_login(AsyncCallback callback, object state, AuthenticationRequest auth_request)
#else
public void send_login(AuthenticationRequest auth_request)
#endif
{
oprot_.WriteMessageBegin(new TMessage("login", TMessageType.Call, seqid_));
login_args args = new login_args();
args.Auth_request = auth_request;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public void recv_login()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
login_result result = new login_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.authnx) {
throw result.Authnx;
}
if (result.__isset.authzx) {
throw result.Authzx;
}
return;
}
#if SILVERLIGHT
public IAsyncResult Begin_set_keyspace(AsyncCallback callback, object state, string keyspace)
{
return send_set_keyspace(callback, state, keyspace);
}
public void End_set_keyspace(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
recv_set_keyspace();
}
#endif
public void set_keyspace(string keyspace)
{
#if !SILVERLIGHT
send_set_keyspace(keyspace);
recv_set_keyspace();
#else
var asyncResult = Begin_set_keyspace(null, null, keyspace);
End_set_keyspace(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_set_keyspace(AsyncCallback callback, object state, string keyspace)
#else
public void send_set_keyspace(string keyspace)
#endif
{
oprot_.WriteMessageBegin(new TMessage("set_keyspace", TMessageType.Call, seqid_));
set_keyspace_args args = new set_keyspace_args();
args.Keyspace = keyspace;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public void recv_set_keyspace()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
set_keyspace_result result = new set_keyspace_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.ire) {
throw result.Ire;
}
return;
}
#if SILVERLIGHT
public IAsyncResult Begin_get(AsyncCallback callback, object state, byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level)
{
return send_get(callback, state, key, column_path, consistency_level);
}
public ColumnOrSuperColumn End_get(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
return recv_get();
}
#endif
/// <summary>
/// Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This is
/// the only method that can throw an exception under non-failure conditions.)
/// </summary>
/// <param name="key"></param>
/// <param name="column_path"></param>
/// <param name="consistency_level"></param>
public ColumnOrSuperColumn get(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level)
{
#if !SILVERLIGHT
send_get(key, column_path, consistency_level);
return recv_get();
#else
var asyncResult = Begin_get(null, null, key, column_path, consistency_level);
return End_get(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_get(AsyncCallback callback, object state, byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level)
#else
public void send_get(byte[] key, ColumnPath column_path, ConsistencyLevel consistency_level)
#endif
{
oprot_.WriteMessageBegin(new TMessage("get", TMessageType.Call, seqid_));
get_args args = new get_args();
args.Key = key;
args.Column_path = column_path;
args.Consistency_level = consistency_level;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public ColumnOrSuperColumn recv_get()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
get_result result = new get_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.success) {
return result.Success;
}
if (result.__isset.ire) {
throw result.Ire;
}
if (result.__isset.nfe) {
throw result.Nfe;
}
if (result.__isset.ue) {
throw result.Ue;
}
if (result.__isset.te) {
throw result.Te;
}
throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "get failed: unknown result");
}
#if SILVERLIGHT
public IAsyncResult Begin_get_slice(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
return send_get_slice(callback, state, key, column_parent, predicate, consistency_level);
}
public List<ColumnOrSuperColumn> End_get_slice(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
return recv_get_slice();
}
#endif
/// <summary>
/// Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name
/// pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned.
/// </summary>
/// <param name="key"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
public List<ColumnOrSuperColumn> get_slice(byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
#if !SILVERLIGHT
send_get_slice(key, column_parent, predicate, consistency_level);
return recv_get_slice();
#else
var asyncResult = Begin_get_slice(null, null, key, column_parent, predicate, consistency_level);
return End_get_slice(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_get_slice(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#else
public void send_get_slice(byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#endif
{
oprot_.WriteMessageBegin(new TMessage("get_slice", TMessageType.Call, seqid_));
get_slice_args args = new get_slice_args();
args.Key = key;
args.Column_parent = column_parent;
args.Predicate = predicate;
args.Consistency_level = consistency_level;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public List<ColumnOrSuperColumn> recv_get_slice()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
get_slice_result result = new get_slice_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.success) {
return result.Success;
}
if (result.__isset.ire) {
throw result.Ire;
}
if (result.__isset.ue) {
throw result.Ue;
}
if (result.__isset.te) {
throw result.Te;
}
throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "get_slice failed: unknown result");
}
#if SILVERLIGHT
public IAsyncResult Begin_get_count(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
return send_get_count(callback, state, key, column_parent, predicate, consistency_level);
}
public int End_get_count(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
return recv_get_count();
}
#endif
/// <summary>
/// returns the number of columns matching <code>predicate</code> for a particular <code>key</code>,
/// <code>ColumnFamily</code> and optionally <code>SuperColumn</code>.
/// </summary>
/// <param name="key"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
public int get_count(byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
#if !SILVERLIGHT
send_get_count(key, column_parent, predicate, consistency_level);
return recv_get_count();
#else
var asyncResult = Begin_get_count(null, null, key, column_parent, predicate, consistency_level);
return End_get_count(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_get_count(AsyncCallback callback, object state, byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#else
public void send_get_count(byte[] key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#endif
{
oprot_.WriteMessageBegin(new TMessage("get_count", TMessageType.Call, seqid_));
get_count_args args = new get_count_args();
args.Key = key;
args.Column_parent = column_parent;
args.Predicate = predicate;
args.Consistency_level = consistency_level;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public int recv_get_count()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
get_count_result result = new get_count_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.success) {
return result.Success;
}
if (result.__isset.ire) {
throw result.Ire;
}
if (result.__isset.ue) {
throw result.Ue;
}
if (result.__isset.te) {
throw result.Te;
}
throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "get_count failed: unknown result");
}
#if SILVERLIGHT
public IAsyncResult Begin_multiget_slice(AsyncCallback callback, object state, List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
return send_multiget_slice(callback, state, keys, column_parent, predicate, consistency_level);
}
public Dictionary<byte[], List<ColumnOrSuperColumn>> End_multiget_slice(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
return recv_multiget_slice();
}
#endif
/// <summary>
/// Performs a get_slice for column_parent and predicate for the given keys in parallel.
/// </summary>
/// <param name="keys"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
public Dictionary<byte[], List<ColumnOrSuperColumn>> multiget_slice(List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
#if !SILVERLIGHT
send_multiget_slice(keys, column_parent, predicate, consistency_level);
return recv_multiget_slice();
#else
var asyncResult = Begin_multiget_slice(null, null, keys, column_parent, predicate, consistency_level);
return End_multiget_slice(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_multiget_slice(AsyncCallback callback, object state, List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#else
public void send_multiget_slice(List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#endif
{
oprot_.WriteMessageBegin(new TMessage("multiget_slice", TMessageType.Call, seqid_));
multiget_slice_args args = new multiget_slice_args();
args.Keys = keys;
args.Column_parent = column_parent;
args.Predicate = predicate;
args.Consistency_level = consistency_level;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public Dictionary<byte[], List<ColumnOrSuperColumn>> recv_multiget_slice()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
multiget_slice_result result = new multiget_slice_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.success) {
return result.Success;
}
if (result.__isset.ire) {
throw result.Ire;
}
if (result.__isset.ue) {
throw result.Ue;
}
if (result.__isset.te) {
throw result.Te;
}
throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "multiget_slice failed: unknown result");
}
#if SILVERLIGHT
public IAsyncResult Begin_multiget_count(AsyncCallback callback, object state, List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
return send_multiget_count(callback, state, keys, column_parent, predicate, consistency_level);
}
public Dictionary<byte[], int> End_multiget_count(IAsyncResult asyncResult)
{
oprot_.Transport.EndFlush(asyncResult);
return recv_multiget_count();
}
#endif
/// <summary>
/// Perform a get_count in parallel on the given list<binary> keys. The return value maps keys to the count found.
/// </summary>
/// <param name="keys"></param>
/// <param name="column_parent"></param>
/// <param name="predicate"></param>
/// <param name="consistency_level"></param>
public Dictionary<byte[], int> multiget_count(List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
{
#if !SILVERLIGHT
send_multiget_count(keys, column_parent, predicate, consistency_level);
return recv_multiget_count();
#else
var asyncResult = Begin_multiget_count(null, null, keys, column_parent, predicate, consistency_level);
return End_multiget_count(asyncResult);
#endif
}
#if SILVERLIGHT
public IAsyncResult send_multiget_count(AsyncCallback callback, object state, List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#else
public void send_multiget_count(List<byte[]> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
#endif
{
oprot_.WriteMessageBegin(new TMessage("multiget_count", TMessageType.Call, seqid_));
multiget_count_args args = new multiget_count_args();
args.Keys = keys;
args.Column_parent = column_parent;
args.Predicate = predicate;
args.Consistency_level = consistency_level;
args.Write(oprot_);
oprot_.WriteMessageEnd();
#if SILVERLIGHT
return oprot_.Transport.BeginFlush(callback, state);
#else
oprot_.Transport.Flush();
#endif
}
public Dictionary<byte[], int> recv_multiget_count()
{
TMessage msg = iprot_.ReadMessageBegin();
if (msg.Type == TMessageType.Exception) {
TApplicationException x = TApplicationException.Read(iprot_);
iprot_.ReadMessageEnd();
throw x;
}
multiget_count_result result = new multiget_count_result();
result.Read(iprot_);
iprot_.ReadMessageEnd();
if (result.__isset.success) {
return result.Success;