incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [08/12] Modified blur service and added the snapshot methods, generated the code, hooked the controller and shard servers for the new methods and stubbed the BlurNRTIndex
Date Sat, 17 Aug 2013 16:55:48 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d512053c/distribution/src/main/scripts/interface/gen-js/Blur.js
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-js/Blur.js b/distribution/src/main/scripts/interface/gen-js/Blur.js
index 7e9b168..ebb4cdc 100644
--- a/distribution/src/main/scripts/interface/gen-js/Blur.js
+++ b/distribution/src/main/scripts/interface/gen-js/Blur.js
@@ -3981,6 +3981,432 @@ Blur_metrics_result.prototype.write = function(output) {
   return;
 };
 
+Blur_createSnapshot_args = function(args) {
+  this.table = null;
+  this.name = null;
+  if (args) {
+    if (args.table !== undefined) {
+      this.table = args.table;
+    }
+    if (args.name !== undefined) {
+      this.name = args.name;
+    }
+  }
+};
+Blur_createSnapshot_args.prototype = {};
+Blur_createSnapshot_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.table = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 2:
+      if (ftype == Thrift.Type.STRING) {
+        this.name = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_createSnapshot_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_createSnapshot_args');
+  if (this.table !== null && this.table !== undefined) {
+    output.writeFieldBegin('table', Thrift.Type.STRING, 1);
+    output.writeString(this.table);
+    output.writeFieldEnd();
+  }
+  if (this.name !== null && this.name !== undefined) {
+    output.writeFieldBegin('name', Thrift.Type.STRING, 2);
+    output.writeString(this.name);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_createSnapshot_result = function(args) {
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_createSnapshot_result.prototype = {};
+Blur_createSnapshot_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_createSnapshot_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_createSnapshot_result');
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_removeSnapshot_args = function(args) {
+  this.table = null;
+  this.name = null;
+  if (args) {
+    if (args.table !== undefined) {
+      this.table = args.table;
+    }
+    if (args.name !== undefined) {
+      this.name = args.name;
+    }
+  }
+};
+Blur_removeSnapshot_args.prototype = {};
+Blur_removeSnapshot_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.table = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 2:
+      if (ftype == Thrift.Type.STRING) {
+        this.name = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_removeSnapshot_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_removeSnapshot_args');
+  if (this.table !== null && this.table !== undefined) {
+    output.writeFieldBegin('table', Thrift.Type.STRING, 1);
+    output.writeString(this.table);
+    output.writeFieldEnd();
+  }
+  if (this.name !== null && this.name !== undefined) {
+    output.writeFieldBegin('name', Thrift.Type.STRING, 2);
+    output.writeString(this.name);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_removeSnapshot_result = function(args) {
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_removeSnapshot_result.prototype = {};
+Blur_removeSnapshot_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_removeSnapshot_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_removeSnapshot_result');
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_listSnapshots_args = function(args) {
+  this.table = null;
+  if (args) {
+    if (args.table !== undefined) {
+      this.table = args.table;
+    }
+  }
+};
+Blur_listSnapshots_args.prototype = {};
+Blur_listSnapshots_args.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+      if (ftype == Thrift.Type.STRING) {
+        this.table = input.readString().value;
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 0:
+        input.skip(ftype);
+        break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_listSnapshots_args.prototype.write = function(output) {
+  output.writeStructBegin('Blur_listSnapshots_args');
+  if (this.table !== null && this.table !== undefined) {
+    output.writeFieldBegin('table', Thrift.Type.STRING, 1);
+    output.writeString(this.table);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
+Blur_listSnapshots_result = function(args) {
+  this.success = null;
+  this.ex = null;
+  if (args instanceof BlurException) {
+    this.ex = args;
+    return;
+  }
+  if (args) {
+    if (args.success !== undefined) {
+      this.success = args.success;
+    }
+    if (args.ex !== undefined) {
+      this.ex = args.ex;
+    }
+  }
+};
+Blur_listSnapshots_result.prototype = {};
+Blur_listSnapshots_result.prototype.read = function(input) {
+  input.readStructBegin();
+  while (true)
+  {
+    var ret = input.readFieldBegin();
+    var fname = ret.fname;
+    var ftype = ret.ftype;
+    var fid = ret.fid;
+    if (ftype == Thrift.Type.STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+      if (ftype == Thrift.Type.MAP) {
+        var _size320 = 0;
+        var _rtmp3324;
+        this.success = {};
+        var _ktype321 = 0;
+        var _vtype322 = 0;
+        _rtmp3324 = input.readMapBegin();
+        _ktype321 = _rtmp3324.ktype;
+        _vtype322 = _rtmp3324.vtype;
+        _size320 = _rtmp3324.size;
+        for (var _i325 = 0; _i325 < _size320; ++_i325)
+        {
+          if (_i325 > 0 ) {
+            if (input.rstack.length > input.rpos[input.rpos.length -1] + 1) {
+              input.rstack.pop();
+            }
+          }
+          var key326 = null;
+          var val327 = null;
+          key326 = input.readString().value;
+          var _size328 = 0;
+          var _rtmp3332;
+          val327 = [];
+          var _etype331 = 0;
+          _rtmp3332 = input.readListBegin();
+          _etype331 = _rtmp3332.etype;
+          _size328 = _rtmp3332.size;
+          for (var _i333 = 0; _i333 < _size328; ++_i333)
+          {
+            var elem334 = null;
+            elem334 = input.readString().value;
+            val327.push(elem334);
+          }
+          input.readListEnd();
+          this.success[key326] = val327;
+        }
+        input.readMapEnd();
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      case 1:
+      if (ftype == Thrift.Type.STRUCT) {
+        this.ex = new BlurException();
+        this.ex.read(input);
+      } else {
+        input.skip(ftype);
+      }
+      break;
+      default:
+        input.skip(ftype);
+    }
+    input.readFieldEnd();
+  }
+  input.readStructEnd();
+  return;
+};
+
+Blur_listSnapshots_result.prototype.write = function(output) {
+  output.writeStructBegin('Blur_listSnapshots_result');
+  if (this.success !== null && this.success !== undefined) {
+    output.writeFieldBegin('success', Thrift.Type.MAP, 0);
+    output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.LIST, Thrift.objectLength(this.success));
+    for (var kiter335 in this.success)
+    {
+      if (this.success.hasOwnProperty(kiter335))
+      {
+        var viter336 = this.success[kiter335];
+        output.writeString(kiter335);
+        output.writeListBegin(Thrift.Type.STRING, viter336.length);
+        for (var iter337 in viter336)
+        {
+          if (viter336.hasOwnProperty(iter337))
+          {
+            iter337 = viter336[iter337];
+            output.writeString(iter337);
+          }
+        }
+        output.writeListEnd();
+      }
+    }
+    output.writeMapEnd();
+    output.writeFieldEnd();
+  }
+  if (this.ex !== null && this.ex !== undefined) {
+    output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
+    this.ex.write(output);
+    output.writeFieldEnd();
+  }
+  output.writeFieldStop();
+  output.writeStructEnd();
+  return;
+};
+
 BlurClient = function(input, output) {
     this.input = input;
     this.output = (!output) ? input : output;
@@ -5047,3 +5473,110 @@ BlurClient.prototype.recv_metrics = function() {
   }
   throw 'metrics failed: unknown result';
 };
+BlurClient.prototype.createSnapshot = function(table, name) {
+  this.send_createSnapshot(table, name);
+  this.recv_createSnapshot();
+};
+
+BlurClient.prototype.send_createSnapshot = function(table, name) {
+  this.output.writeMessageBegin('createSnapshot', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_createSnapshot_args();
+  args.table = table;
+  args.name = name;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_createSnapshot = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_createSnapshot_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  return;
+};
+BlurClient.prototype.removeSnapshot = function(table, name) {
+  this.send_removeSnapshot(table, name);
+  this.recv_removeSnapshot();
+};
+
+BlurClient.prototype.send_removeSnapshot = function(table, name) {
+  this.output.writeMessageBegin('removeSnapshot', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_removeSnapshot_args();
+  args.table = table;
+  args.name = name;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_removeSnapshot = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_removeSnapshot_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  return;
+};
+BlurClient.prototype.listSnapshots = function(table) {
+  this.send_listSnapshots(table);
+  return this.recv_listSnapshots();
+};
+
+BlurClient.prototype.send_listSnapshots = function(table) {
+  this.output.writeMessageBegin('listSnapshots', Thrift.MessageType.CALL, this.seqid);
+  var args = new Blur_listSnapshots_args();
+  args.table = table;
+  args.write(this.output);
+  this.output.writeMessageEnd();
+  return this.output.getTransport().flush();
+};
+
+BlurClient.prototype.recv_listSnapshots = function() {
+  var ret = this.input.readMessageBegin();
+  var fname = ret.fname;
+  var mtype = ret.mtype;
+  var rseqid = ret.rseqid;
+  if (mtype == Thrift.MessageType.EXCEPTION) {
+    var x = new Thrift.TApplicationException();
+    x.read(this.input);
+    this.input.readMessageEnd();
+    throw x;
+  }
+  var result = new Blur_listSnapshots_result();
+  result.read(this.input);
+  this.input.readMessageEnd();
+
+  if (null !== result.ex) {
+    throw result.ex;
+  }
+  if (null !== result.success) {
+    return result.success;
+  }
+  throw 'listSnapshots failed: unknown result';
+};

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d512053c/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm b/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
index e6e6c1c..68f08fc 100644
--- a/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
+++ b/distribution/src/main/scripts/interface/gen-perl/Blur/Blur.pm
@@ -4549,6 +4549,484 @@ sub write {
   return $xfer;
 }
 
+package Blur::Blur_createSnapshot_args;
+use base qw(Class::Accessor);
+Blur::Blur_createSnapshot_args->mk_accessors( qw( table name ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{table} = undef;
+  $self->{name} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{table}) {
+      $self->{table} = $vals->{table};
+    }
+    if (defined $vals->{name}) {
+      $self->{name} = $vals->{name};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_createSnapshot_args';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{table});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^2$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{name});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_createSnapshot_args');
+  if (defined $self->{table}) {
+    $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
+    $xfer += $output->writeString($self->{table});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{name}) {
+    $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
+    $xfer += $output->writeString($self->{name});
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::Blur_createSnapshot_result;
+use base qw(Class::Accessor);
+Blur::Blur_createSnapshot_result->mk_accessors( qw( ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{ex} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{ex}) {
+      $self->{ex} = $vals->{ex};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_createSnapshot_result';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRUCT) {
+        $self->{ex} = new Blur::BlurException();
+        $xfer += $self->{ex}->read($input);
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_createSnapshot_result');
+  if (defined $self->{ex}) {
+    $xfer += $output->writeFieldBegin('ex', TType::STRUCT, 1);
+    $xfer += $self->{ex}->write($output);
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::Blur_removeSnapshot_args;
+use base qw(Class::Accessor);
+Blur::Blur_removeSnapshot_args->mk_accessors( qw( table name ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{table} = undef;
+  $self->{name} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{table}) {
+      $self->{table} = $vals->{table};
+    }
+    if (defined $vals->{name}) {
+      $self->{name} = $vals->{name};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_removeSnapshot_args';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{table});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^2$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{name});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_removeSnapshot_args');
+  if (defined $self->{table}) {
+    $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
+    $xfer += $output->writeString($self->{table});
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{name}) {
+    $xfer += $output->writeFieldBegin('name', TType::STRING, 2);
+    $xfer += $output->writeString($self->{name});
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::Blur_removeSnapshot_result;
+use base qw(Class::Accessor);
+Blur::Blur_removeSnapshot_result->mk_accessors( qw( ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{ex} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{ex}) {
+      $self->{ex} = $vals->{ex};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_removeSnapshot_result';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRUCT) {
+        $self->{ex} = new Blur::BlurException();
+        $xfer += $self->{ex}->read($input);
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_removeSnapshot_result');
+  if (defined $self->{ex}) {
+    $xfer += $output->writeFieldBegin('ex', TType::STRUCT, 1);
+    $xfer += $self->{ex}->write($output);
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::Blur_listSnapshots_args;
+use base qw(Class::Accessor);
+Blur::Blur_listSnapshots_args->mk_accessors( qw( table ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{table} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{table}) {
+      $self->{table} = $vals->{table};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_listSnapshots_args';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^1$/ && do{      if ($ftype == TType::STRING) {
+        $xfer += $input->readString(\$self->{table});
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_listSnapshots_args');
+  if (defined $self->{table}) {
+    $xfer += $output->writeFieldBegin('table', TType::STRING, 1);
+    $xfer += $output->writeString($self->{table});
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
+package Blur::Blur_listSnapshots_result;
+use base qw(Class::Accessor);
+Blur::Blur_listSnapshots_result->mk_accessors( qw( success ) );
+
+sub new {
+  my $classname = shift;
+  my $self      = {};
+  my $vals      = shift || {};
+  $self->{success} = undef;
+  $self->{ex} = undef;
+  if (UNIVERSAL::isa($vals,'HASH')) {
+    if (defined $vals->{success}) {
+      $self->{success} = $vals->{success};
+    }
+    if (defined $vals->{ex}) {
+      $self->{ex} = $vals->{ex};
+    }
+  }
+  return bless ($self, $classname);
+}
+
+sub getName {
+  return 'Blur_listSnapshots_result';
+}
+
+sub read {
+  my ($self, $input) = @_;
+  my $xfer  = 0;
+  my $fname;
+  my $ftype = 0;
+  my $fid   = 0;
+  $xfer += $input->readStructBegin(\$fname);
+  while (1) 
+  {
+    $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid);
+    if ($ftype == TType::STOP) {
+      last;
+    }
+    SWITCH: for($fid)
+    {
+      /^0$/ && do{      if ($ftype == TType::MAP) {
+        {
+          my $_size284 = 0;
+          $self->{success} = {};
+          my $_ktype285 = 0;
+          my $_vtype286 = 0;
+          $xfer += $input->readMapBegin(\$_ktype285, \$_vtype286, \$_size284);
+          for (my $_i288 = 0; $_i288 < $_size284; ++$_i288)
+          {
+            my $key289 = '';
+            my $val290 = [];
+            $xfer += $input->readString(\$key289);
+            {
+              my $_size291 = 0;
+              $val290 = [];
+              my $_etype294 = 0;
+              $xfer += $input->readListBegin(\$_etype294, \$_size291);
+              for (my $_i295 = 0; $_i295 < $_size291; ++$_i295)
+              {
+                my $elem296 = undef;
+                $xfer += $input->readString(\$elem296);
+                push(@{$val290},$elem296);
+              }
+              $xfer += $input->readListEnd();
+            }
+            $self->{success}->{$key289} = $val290;
+          }
+          $xfer += $input->readMapEnd();
+        }
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+      /^1$/ && do{      if ($ftype == TType::STRUCT) {
+        $self->{ex} = new Blur::BlurException();
+        $xfer += $self->{ex}->read($input);
+      } else {
+        $xfer += $input->skip($ftype);
+      }
+      last; };
+        $xfer += $input->skip($ftype);
+    }
+    $xfer += $input->readFieldEnd();
+  }
+  $xfer += $input->readStructEnd();
+  return $xfer;
+}
+
+sub write {
+  my ($self, $output) = @_;
+  my $xfer   = 0;
+  $xfer += $output->writeStructBegin('Blur_listSnapshots_result');
+  if (defined $self->{success}) {
+    $xfer += $output->writeFieldBegin('success', TType::MAP, 0);
+    {
+      $xfer += $output->writeMapBegin(TType::STRING, TType::LIST, scalar(keys %{$self->{success}}));
+      {
+        while( my ($kiter297,$viter298) = each %{$self->{success}}) 
+        {
+          $xfer += $output->writeString($kiter297);
+          {
+            $xfer += $output->writeListBegin(TType::STRING, scalar(@{${viter298}}));
+            {
+              foreach my $iter299 (@{${viter298}}) 
+              {
+                $xfer += $output->writeString($iter299);
+              }
+            }
+            $xfer += $output->writeListEnd();
+          }
+        }
+      }
+      $xfer += $output->writeMapEnd();
+    }
+    $xfer += $output->writeFieldEnd();
+  }
+  if (defined $self->{ex}) {
+    $xfer += $output->writeFieldBegin('ex', TType::STRUCT, 1);
+    $xfer += $self->{ex}->write($output);
+    $xfer += $output->writeFieldEnd();
+  }
+  $xfer += $output->writeFieldStop();
+  $xfer += $output->writeStructEnd();
+  return $xfer;
+}
+
 package Blur::BlurIf;
 
 use strict;
@@ -4768,6 +5246,29 @@ sub metrics{
   die 'implement interface';
 }
 
+sub createSnapshot{
+  my $self = shift;
+  my $table = shift;
+  my $name = shift;
+
+  die 'implement interface';
+}
+
+sub removeSnapshot{
+  my $self = shift;
+  my $table = shift;
+  my $name = shift;
+
+  die 'implement interface';
+}
+
+sub listSnapshots{
+  my $self = shift;
+  my $table = shift;
+
+  die 'implement interface';
+}
+
 package Blur::BlurRest;
 
 use strict;
@@ -4994,6 +5495,29 @@ sub metrics{
   return $self->{impl}->metrics($metrics);
 }
 
+sub createSnapshot{
+  my ($self, $request) = @_;
+
+  my $table = ($request->{'table'}) ? $request->{'table'} : undef;
+  my $name = ($request->{'name'}) ? $request->{'name'} : undef;
+  return $self->{impl}->createSnapshot($table, $name);
+}
+
+sub removeSnapshot{
+  my ($self, $request) = @_;
+
+  my $table = ($request->{'table'}) ? $request->{'table'} : undef;
+  my $name = ($request->{'name'}) ? $request->{'name'} : undef;
+  return $self->{impl}->removeSnapshot($table, $name);
+}
+
+sub listSnapshots{
+  my ($self, $request) = @_;
+
+  my $table = ($request->{'table'}) ? $request->{'table'} : undef;
+  return $self->{impl}->listSnapshots($table);
+}
+
 package Blur::BlurClient;
 
 
@@ -6350,6 +6874,144 @@ sub recv_metrics{
   }
   die "metrics failed: unknown result";
 }
+sub createSnapshot{
+  my $self = shift;
+  my $table = shift;
+  my $name = shift;
+
+    $self->send_createSnapshot($table, $name);
+  $self->recv_createSnapshot();
+}
+
+sub send_createSnapshot{
+  my $self = shift;
+  my $table = shift;
+  my $name = shift;
+
+  $self->{output}->writeMessageBegin('createSnapshot', TMessageType::CALL, $self->{seqid});
+  my $args = new Blur::Blur_createSnapshot_args();
+  $args->{table} = $table;
+  $args->{name} = $name;
+  $args->write($self->{output});
+  $self->{output}->writeMessageEnd();
+  $self->{output}->getTransport()->flush();
+}
+
+sub recv_createSnapshot{
+  my $self = shift;
+
+  my $rseqid = 0;
+  my $fname;
+  my $mtype = 0;
+
+  $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid);
+  if ($mtype == TMessageType::EXCEPTION) {
+    my $x = new TApplicationException();
+    $x->read($self->{input});
+    $self->{input}->readMessageEnd();
+    die $x;
+  }
+  my $result = new Blur::Blur_createSnapshot_result();
+  $result->read($self->{input});
+  $self->{input}->readMessageEnd();
+
+  if (defined $result->{ex}) {
+    die $result->{ex};
+  }
+  return;
+}
+sub removeSnapshot{
+  my $self = shift;
+  my $table = shift;
+  my $name = shift;
+
+    $self->send_removeSnapshot($table, $name);
+  $self->recv_removeSnapshot();
+}
+
+sub send_removeSnapshot{
+  my $self = shift;
+  my $table = shift;
+  my $name = shift;
+
+  $self->{output}->writeMessageBegin('removeSnapshot', TMessageType::CALL, $self->{seqid});
+  my $args = new Blur::Blur_removeSnapshot_args();
+  $args->{table} = $table;
+  $args->{name} = $name;
+  $args->write($self->{output});
+  $self->{output}->writeMessageEnd();
+  $self->{output}->getTransport()->flush();
+}
+
+sub recv_removeSnapshot{
+  my $self = shift;
+
+  my $rseqid = 0;
+  my $fname;
+  my $mtype = 0;
+
+  $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid);
+  if ($mtype == TMessageType::EXCEPTION) {
+    my $x = new TApplicationException();
+    $x->read($self->{input});
+    $self->{input}->readMessageEnd();
+    die $x;
+  }
+  my $result = new Blur::Blur_removeSnapshot_result();
+  $result->read($self->{input});
+  $self->{input}->readMessageEnd();
+
+  if (defined $result->{ex}) {
+    die $result->{ex};
+  }
+  return;
+}
+sub listSnapshots{
+  my $self = shift;
+  my $table = shift;
+
+    $self->send_listSnapshots($table);
+  return $self->recv_listSnapshots();
+}
+
+sub send_listSnapshots{
+  my $self = shift;
+  my $table = shift;
+
+  $self->{output}->writeMessageBegin('listSnapshots', TMessageType::CALL, $self->{seqid});
+  my $args = new Blur::Blur_listSnapshots_args();
+  $args->{table} = $table;
+  $args->write($self->{output});
+  $self->{output}->writeMessageEnd();
+  $self->{output}->getTransport()->flush();
+}
+
+sub recv_listSnapshots{
+  my $self = shift;
+
+  my $rseqid = 0;
+  my $fname;
+  my $mtype = 0;
+
+  $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid);
+  if ($mtype == TMessageType::EXCEPTION) {
+    my $x = new TApplicationException();
+    $x->read($self->{input});
+    $self->{input}->readMessageEnd();
+    die $x;
+  }
+  my $result = new Blur::Blur_listSnapshots_result();
+  $result->read($self->{input});
+  $self->{input}->readMessageEnd();
+
+  if (defined $result->{success} ) {
+    return $result->{success};
+  }
+  if (defined $result->{ex}) {
+    die $result->{ex};
+  }
+  die "listSnapshots failed: unknown result";
+}
 package Blur::BlurProcessor;
 
 use strict;
@@ -6877,4 +7539,55 @@ sub process_metrics {
     $output->getTransport()->flush();
 }
 
+sub process_createSnapshot {
+    my ($self, $seqid, $input, $output) = @_;
+    my $args = new Blur::Blur_createSnapshot_args();
+    $args->read($input);
+    $input->readMessageEnd();
+    my $result = new Blur::Blur_createSnapshot_result();
+    eval {
+      $self->{handler}->createSnapshot($args->table, $args->name);
+    }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
+      $result->{ex} = $@;
+    }
+    $output->writeMessageBegin('createSnapshot', TMessageType::REPLY, $seqid);
+    $result->write($output);
+    $output->writeMessageEnd();
+    $output->getTransport()->flush();
+}
+
+sub process_removeSnapshot {
+    my ($self, $seqid, $input, $output) = @_;
+    my $args = new Blur::Blur_removeSnapshot_args();
+    $args->read($input);
+    $input->readMessageEnd();
+    my $result = new Blur::Blur_removeSnapshot_result();
+    eval {
+      $self->{handler}->removeSnapshot($args->table, $args->name);
+    }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
+      $result->{ex} = $@;
+    }
+    $output->writeMessageBegin('removeSnapshot', TMessageType::REPLY, $seqid);
+    $result->write($output);
+    $output->writeMessageEnd();
+    $output->getTransport()->flush();
+}
+
+sub process_listSnapshots {
+    my ($self, $seqid, $input, $output) = @_;
+    my $args = new Blur::Blur_listSnapshots_args();
+    $args->read($input);
+    $input->readMessageEnd();
+    my $result = new Blur::Blur_listSnapshots_result();
+    eval {
+      $result->{success} = $self->{handler}->listSnapshots($args->table);
+    }; if( UNIVERSAL::isa($@,'Blur::BlurException') ){ 
+      $result->{ex} = $@;
+    }
+    $output->writeMessageBegin('listSnapshots', TMessageType::REPLY, $seqid);
+    $result->write($output);
+    $output->writeMessageEnd();
+    $output->getTransport()->flush();
+}
+
 1;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d512053c/distribution/src/main/scripts/interface/gen-rb/blur.rb
----------------------------------------------------------------------
diff --git a/distribution/src/main/scripts/interface/gen-rb/blur.rb b/distribution/src/main/scripts/interface/gen-rb/blur.rb
index d060943..b0e5011 100644
--- a/distribution/src/main/scripts/interface/gen-rb/blur.rb
+++ b/distribution/src/main/scripts/interface/gen-rb/blur.rb
@@ -468,6 +468,52 @@ module Blur
         raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT,
'metrics failed: unknown result')
       end
 
+      def createSnapshot(table, name)
+        send_createSnapshot(table, name)
+        recv_createSnapshot()
+      end
+
+      def send_createSnapshot(table, name)
+        send_message('createSnapshot', CreateSnapshot_args, :table => table, :name =>
name)
+      end
+
+      def recv_createSnapshot()
+        result = receive_message(CreateSnapshot_result)
+        raise result.ex unless result.ex.nil?
+        return
+      end
+
+      def removeSnapshot(table, name)
+        send_removeSnapshot(table, name)
+        recv_removeSnapshot()
+      end
+
+      def send_removeSnapshot(table, name)
+        send_message('removeSnapshot', RemoveSnapshot_args, :table => table, :name =>
name)
+      end
+
+      def recv_removeSnapshot()
+        result = receive_message(RemoveSnapshot_result)
+        raise result.ex unless result.ex.nil?
+        return
+      end
+
+      def listSnapshots(table)
+        send_listSnapshots(table)
+        return recv_listSnapshots()
+      end
+
+      def send_listSnapshots(table)
+        send_message('listSnapshots', ListSnapshots_args, :table => table)
+      end
+
+      def recv_listSnapshots()
+        result = receive_message(ListSnapshots_result)
+        return result.success unless result.success.nil?
+        raise result.ex unless result.ex.nil?
+        raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT,
'listSnapshots failed: unknown result')
+      end
+
     end
 
     class Processor
@@ -792,6 +838,39 @@ module Blur
         write_result(result, oprot, 'metrics', seqid)
       end
 
+      def process_createSnapshot(seqid, iprot, oprot)
+        args = read_args(iprot, CreateSnapshot_args)
+        result = CreateSnapshot_result.new()
+        begin
+          @handler.createSnapshot(args.table, args.name)
+        rescue ::Blur::BlurException => ex
+          result.ex = ex
+        end
+        write_result(result, oprot, 'createSnapshot', seqid)
+      end
+
+      def process_removeSnapshot(seqid, iprot, oprot)
+        args = read_args(iprot, RemoveSnapshot_args)
+        result = RemoveSnapshot_result.new()
+        begin
+          @handler.removeSnapshot(args.table, args.name)
+        rescue ::Blur::BlurException => ex
+          result.ex = ex
+        end
+        write_result(result, oprot, 'removeSnapshot', seqid)
+      end
+
+      def process_listSnapshots(seqid, iprot, oprot)
+        args = read_args(iprot, ListSnapshots_args)
+        result = ListSnapshots_result.new()
+        begin
+          result.success = @handler.listSnapshots(args.table)
+        rescue ::Blur::BlurException => ex
+          result.ex = ex
+        end
+        write_result(result, oprot, 'listSnapshots', seqid)
+      end
+
     end
 
     # HELPER FUNCTIONS AND STRUCTURES
@@ -1832,6 +1911,108 @@ module Blur
       ::Thrift::Struct.generate_accessors self
     end
 
+    class CreateSnapshot_args
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      TABLE = 1
+      NAME = 2
+
+      FIELDS = {
+        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
+        NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
+    class CreateSnapshot_result
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      EX = 1
+
+      FIELDS = {
+        EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => ::Blur::BlurException}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
+    class RemoveSnapshot_args
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      TABLE = 1
+      NAME = 2
+
+      FIELDS = {
+        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'},
+        NAME => {:type => ::Thrift::Types::STRING, :name => 'name'}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
+    class RemoveSnapshot_result
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      EX = 1
+
+      FIELDS = {
+        EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => ::Blur::BlurException}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
+    class ListSnapshots_args
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      TABLE = 1
+
+      FIELDS = {
+        TABLE => {:type => ::Thrift::Types::STRING, :name => 'table'}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
+    class ListSnapshots_result
+      include ::Thrift::Struct, ::Thrift::Struct_Union
+      SUCCESS = 0
+      EX = 1
+
+      FIELDS = {
+        SUCCESS => {:type => ::Thrift::Types::MAP, :name => 'success', :key =>
{:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::LIST, :element
=> {:type => ::Thrift::Types::STRING}}},
+        EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => ::Blur::BlurException}
+      }
+
+      def struct_fields; FIELDS; end
+
+      def validate
+      end
+
+      ::Thrift::Struct.generate_accessors self
+    end
+
   end
 
 end


Mime
View raw message