incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [08/28] Adding fields in Thrift to allow for easier paging through Rows on fetch.
Date Wed, 15 Jan 2014 22:03:31 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b220118d/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
index c837219..03799b7 100644
--- a/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
+++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Types.pm
@@ -922,17 +922,29 @@ sub write {
 
 package Blur::FetchRowResult;
 use base qw(Class::Accessor);
-Blur::FetchRowResult->mk_accessors( qw( row ) );
+Blur::FetchRowResult->mk_accessors( qw( row startRecord maxRecordsToFetch moreRecordsToFetch
) );
 
 sub new {
   my $classname = shift;
   my $self      = {};
   my $vals      = shift || {};
   $self->{row} = undef;
+  $self->{startRecord} = -1;
+  $self->{maxRecordsToFetch} = -1;
+  $self->{moreRecordsToFetch} = 0;
   if (UNIVERSAL::isa($vals,'HASH')) {
     if (defined $vals->{row}) {
       $self->{row} = $vals->{row};
     }
+    if (defined $vals->{startRecord}) {
+      $self->{startRecord} = $vals->{startRecord};
+    }
+    if (defined $vals->{maxRecordsToFetch}) {
+      $self->{maxRecordsToFetch} = $vals->{maxRecordsToFetch};
+    }
+    if (defined $vals->{moreRecordsToFetch}) {
+      $self->{moreRecordsToFetch} = $vals->{moreRecordsToFetch};
+    }
   }
   return bless ($self, $classname);
 }
@@ -963,6 +975,24 @@ sub read {
         $xfer += $input->skip($ftype);
       }
       last; };
+      /^2$/ && do{      if ($ftype == TType::I32) {
+        $xfer += $input->readI32(\$self->{startRecord});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^3$/ && do{      if ($ftype == TType::I32) {
+        $xfer += $input->readI32(\$self->{maxRecordsToFetch});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^4$/ && do{      if ($ftype == TType::BOOL) {
+        $xfer += $input->readBool(\$self->{moreRecordsToFetch});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
         $xfer += $input->skip($ftype);
     }
     $xfer += $input->readFieldEnd();
@@ -980,6 +1010,21 @@ sub write {
     $xfer += $self->{row}->write($output);
     $xfer += $output->writeFieldEnd();
   }
+  if (defined $self->{startRecord}) {
+    $xfer += $output->writeFieldBegin('startRecord', TType::I32, 2);
+    $xfer += $output->writeI32($self->{startRecord});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{maxRecordsToFetch}) {
+    $xfer += $output->writeFieldBegin('maxRecordsToFetch', TType::I32, 3);
+    $xfer += $output->writeI32($self->{maxRecordsToFetch});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{moreRecordsToFetch}) {
+    $xfer += $output->writeFieldBegin('moreRecordsToFetch', TType::BOOL, 4);
+    $xfer += $output->writeBool($self->{moreRecordsToFetch});
+    $xfer += $output->writeFieldEnd();
+  }
   $xfer += $output->writeFieldStop();
   $xfer += $output->writeStructEnd();
   return $xfer;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b220118d/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
index 380fac3..b4bcae4 100644
--- a/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
+++ b/distribution/src/main/scripts/interface/gen-rb/blur_types.rb
@@ -268,7 +268,7 @@ module Blur
       STARTRECORD => {:type => ::Thrift::Types::I32, :name => 'startRecord', :default
=> 0},
       # Only valid for Row fetches, the number of records to fetch.  If the row contains
1000 records
 # and you want the first 100, then this value is 100.  If you want records 300-400 then this
value
-# would be 100.  Used in conjunction with maxRecordsToFetch. By default this will fetch the
first
+# would be 100.  Used in conjunction with startRecord. By default this will fetch the first
 # 1000 records of the row.
       MAXRECORDSTOFETCH => {:type => ::Thrift::Types::I32, :name => 'maxRecordsToFetch',
:default => 1000},
       # The HighlightOptions object controls how the data is highlighted.  If null no highlighting
will occur.
@@ -287,10 +287,19 @@ module Blur
   class FetchRowResult
     include ::Thrift::Struct, ::Thrift::Struct_Union
     ROW = 1
+    STARTRECORD = 2
+    MAXRECORDSTOFETCH = 3
+    MORERECORDSTOFETCH = 4
 
     FIELDS = {
       # The row fetched.
-      ROW => {:type => ::Thrift::Types::STRUCT, :name => 'row', :class => ::Blur::Row}
+      ROW => {:type => ::Thrift::Types::STRUCT, :name => 'row', :class => ::Blur::Row},
+      # See Selector startRecord.
+      STARTRECORD => {:type => ::Thrift::Types::I32, :name => 'startRecord', :default
=> -1},
+      # See Selector maxRecordsToFetch.
+      MAXRECORDSTOFETCH => {:type => ::Thrift::Types::I32, :name => 'maxRecordsToFetch',
:default => -1},
+      # Are there more Records to fetch based on the Selector provided.
+      MORERECORDSTOFETCH => {:type => ::Thrift::Types::BOOL, :name => 'moreRecordsToFetch',
:default => false}
     }
 
     def struct_fields; FIELDS; end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b220118d/docs/Blur.html
----------------------------------------------------------------------
diff --git a/docs/Blur.html b/docs/Blur.html
index 9f9b1ff..58dcc13 100644
--- a/docs/Blur.html
+++ b/docs/Blur.html
@@ -333,7 +333,7 @@ FetchResult.  Used in conjunction with maxRecordsToFetch.
 </td><td>default</td><td>0</td></tr>
 <tr><td>9</td><td>maxRecordsToFetch</td><td><code>i32</code></td><td>Only
valid for Row fetches, the number of records to fetch.  If the row contains 1000 records
 and you want the first 100, then this value is 100.  If you want records 300-400 then this
value
-would be 100.  Used in conjunction with maxRecordsToFetch. By default this will fetch the
first
+would be 100.  Used in conjunction with startRecord. By default this will fetch the first
 1000 records of the row.
 </td><td>default</td><td>1000</td></tr>
 <tr><td>10</td><td>highlightOptions</td><td><code><a
href="Blur.html#Struct_HighlightOptions">HighlightOptions</a></code></td><td>The
HighlightOptions object controls how the data is highlighted.  If null no highlighting will
occur.
@@ -343,6 +343,12 @@ would be 100.  Used in conjunction with maxRecordsToFetch. By default
this will
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>
 <tr><td>1</td><td>row</td><td><code><a href="Blur.html#Struct_Row">Row</a></code></td><td>The
row fetched.
 </td><td>default</td><td></td></tr>
+<tr><td>2</td><td>startRecord</td><td><code>i32</code></td><td>See
Selector startRecord.
+</td><td>default</td><td>-1</td></tr>
+<tr><td>3</td><td>maxRecordsToFetch</td><td><code>i32</code></td><td>See
Selector maxRecordsToFetch.
+</td><td>default</td><td>-1</td></tr>
+<tr><td>4</td><td>moreRecordsToFetch</td><td><code>bool</code></td><td>Are
there more Records to fetch based on the Selector provided.
+</td><td>default</td><td>0</td></tr>
 </table><br/>FetchRowResult contains row result from a fetch.
 <br/></p></section><section><div class="page-header"><h3
id="Struct_FetchRecordResult">Struct: FetchRecordResult</h3></div><p class="lead">
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>


Mime
View raw message