Java 类org.apache.hadoop.hbase.protobuf.generated.MasterProtos.GetCompletedSnapshotsRequest 实例源码

项目:ditb    文件:MasterRpcServices.java   
/**
 * List the currently available/stored snapshots. Any in-progress snapshots are ignored
 */
@Override
public GetCompletedSnapshotsResponse getCompletedSnapshots(RpcController controller,
    GetCompletedSnapshotsRequest request) throws ServiceException {
  try {
    master.checkInitialized();
    GetCompletedSnapshotsResponse.Builder builder = GetCompletedSnapshotsResponse.newBuilder();
    List<SnapshotDescription> snapshots = master.snapshotManager.getCompletedSnapshots();

    // convert to protobuf
    for (SnapshotDescription snapshot : snapshots) {
      builder.addSnapshots(snapshot);
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:pbase    文件:MasterRpcServices.java   
/**
 * List the currently available/stored snapshots. Any in-progress snapshots are ignored
 */
@Override
public GetCompletedSnapshotsResponse getCompletedSnapshots(RpcController controller,
    GetCompletedSnapshotsRequest request) throws ServiceException {
  try {
    master.checkInitialized();
    GetCompletedSnapshotsResponse.Builder builder = GetCompletedSnapshotsResponse.newBuilder();
    List<SnapshotDescription> snapshots = master.snapshotManager.getCompletedSnapshots();

    // convert to protobuf
    for (SnapshotDescription snapshot : snapshots) {
      builder.addSnapshots(snapshot);
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:HIndex    文件:HMaster.java   
/**
 * List the currently available/stored snapshots. Any in-progress snapshots are ignored
 */
@Override
public GetCompletedSnapshotsResponse getCompletedSnapshots(RpcController controller,
    GetCompletedSnapshotsRequest request) throws ServiceException {
  try {
    GetCompletedSnapshotsResponse.Builder builder = GetCompletedSnapshotsResponse.newBuilder();
    List<SnapshotDescription> snapshots = snapshotManager.getCompletedSnapshots();

    // convert to protobuf
    for (SnapshotDescription snapshot : snapshots) {
      builder.addSnapshots(snapshot);
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:PyroDB    文件:MasterRpcServices.java   
/**
 * List the currently available/stored snapshots. Any in-progress snapshots are ignored
 */
@Override
public GetCompletedSnapshotsResponse getCompletedSnapshots(RpcController controller,
    GetCompletedSnapshotsRequest request) throws ServiceException {
  try {
    master.checkInitialized();
    GetCompletedSnapshotsResponse.Builder builder = GetCompletedSnapshotsResponse.newBuilder();
    List<SnapshotDescription> snapshots = master.snapshotManager.getCompletedSnapshots();

    // convert to protobuf
    for (SnapshotDescription snapshot : snapshots) {
      builder.addSnapshots(snapshot);
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:c5    文件:HMaster.java   
/**
 * List the currently available/stored snapshots. Any in-progress snapshots are ignored
 */
@Override
public GetCompletedSnapshotsResponse getCompletedSnapshots(RpcController controller,
    GetCompletedSnapshotsRequest request) throws ServiceException {
  try {
    GetCompletedSnapshotsResponse.Builder builder = GetCompletedSnapshotsResponse.newBuilder();
    List<SnapshotDescription> snapshots = snapshotManager.getCompletedSnapshots();

    // convert to protobuf
    for (SnapshotDescription snapshot : snapshots) {
      builder.addSnapshots(snapshot);
    }
    return builder.build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:ditb    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testGetCompletedSnapshots() throws Exception {
  // first check when there are no snapshots
  GetCompletedSnapshotsRequest request = GetCompletedSnapshotsRequest.newBuilder().build();
  GetCompletedSnapshotsResponse response =
    master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());

  // write one snapshot to the fs
  String snapshotName = "completed";
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // check that we get one snapshot
  response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 1, response.getSnapshotsCount());
  List<SnapshotDescription> snapshots = response.getSnapshotsList();
  List<SnapshotDescription> expected = Lists.newArrayList(snapshot);
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);

  // write a second snapshot
  snapshotName = "completed_two";
  snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
  expected.add(snapshot);

  // check that we get one snapshot
  response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
  snapshots = response.getSnapshotsList();
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);
}
项目:ditb    文件:HBaseAdmin.java   
/**
 * List completed snapshots.
 * @return a list of snapshot descriptors for completed snapshots
 * @throws IOException if a network error occurs
 */
@Override
public List<SnapshotDescription> listSnapshots() throws IOException {
  return executeCallable(new MasterCallable<List<SnapshotDescription>>(getConnection()) {
    @Override
    public List<SnapshotDescription> call(int callTimeout) throws ServiceException {
      PayloadCarryingRpcController controller = rpcControllerFactory.newController();
      controller.setCallTimeout(callTimeout);
      return master.getCompletedSnapshots(controller,
        GetCompletedSnapshotsRequest.newBuilder().build()).getSnapshotsList();
    }
  });
}
项目:pbase    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testGetCompletedSnapshots() throws Exception {
  // first check when there are no snapshots
  GetCompletedSnapshotsRequest request = GetCompletedSnapshotsRequest.newBuilder().build();
  GetCompletedSnapshotsResponse response =
    master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());

  // write one snapshot to the fs
  String snapshotName = "completed";
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // check that we get one snapshot
  response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 1, response.getSnapshotsCount());
  List<SnapshotDescription> snapshots = response.getSnapshotsList();
  List<SnapshotDescription> expected = Lists.newArrayList(snapshot);
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);

  // write a second snapshot
  snapshotName = "completed_two";
  snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
  expected.add(snapshot);

  // check that we get one snapshot
  response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
  snapshots = response.getSnapshotsList();
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);
}
项目:pbase    文件:HBaseAdmin.java   
/**
 * List completed snapshots.
 * @return a list of snapshot descriptors for completed snapshots
 * @throws IOException if a network error occurs
 */
@Override
public List<SnapshotDescription> listSnapshots() throws IOException {
  return executeCallable(new MasterCallable<List<SnapshotDescription>>(getConnection()) {
    @Override
    public List<SnapshotDescription> call(int callTimeout) throws ServiceException {
      return master.getCompletedSnapshots(null, GetCompletedSnapshotsRequest.newBuilder().build())
          .getSnapshotsList();
    }
  });
}
项目:HIndex    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testGetCompletedSnapshots() throws Exception {
  // first check when there are no snapshots
  GetCompletedSnapshotsRequest request = GetCompletedSnapshotsRequest.newBuilder().build();
  GetCompletedSnapshotsResponse response = master.getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());

  // write one snapshot to the fs
  String snapshotName = "completed";
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // check that we get one snapshot
  response = master.getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 1, response.getSnapshotsCount());
  List<SnapshotDescription> snapshots = response.getSnapshotsList();
  List<SnapshotDescription> expected = Lists.newArrayList(snapshot);
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);

  // write a second snapshot
  snapshotName = "completed_two";
  snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
  expected.add(snapshot);

  // check that we get one snapshot
  response = master.getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
  snapshots = response.getSnapshotsList();
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);
}
项目:HIndex    文件:HBaseAdmin.java   
/**
 * List completed snapshots.
 * @return a list of snapshot descriptors for completed snapshots
 * @throws IOException if a network error occurs
 */
public List<SnapshotDescription> listSnapshots() throws IOException {
  return executeCallable(new MasterCallable<List<SnapshotDescription>>(getConnection()) {
    @Override
    public List<SnapshotDescription> call() throws ServiceException {
      return master.getCompletedSnapshots(null, GetCompletedSnapshotsRequest.newBuilder().build())
          .getSnapshotsList();
    }
  });
}
项目:PyroDB    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testGetCompletedSnapshots() throws Exception {
  // first check when there are no snapshots
  GetCompletedSnapshotsRequest request = GetCompletedSnapshotsRequest.newBuilder().build();
  GetCompletedSnapshotsResponse response =
    master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());

  // write one snapshot to the fs
  String snapshotName = "completed";
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // check that we get one snapshot
  response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 1, response.getSnapshotsCount());
  List<SnapshotDescription> snapshots = response.getSnapshotsList();
  List<SnapshotDescription> expected = Lists.newArrayList(snapshot);
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);

  // write a second snapshot
  snapshotName = "completed_two";
  snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
  expected.add(snapshot);

  // check that we get one snapshot
  response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
  snapshots = response.getSnapshotsList();
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);
}
项目:PyroDB    文件:HBaseAdmin.java   
/**
 * List completed snapshots.
 * @return a list of snapshot descriptors for completed snapshots
 * @throws IOException if a network error occurs
 */
public List<SnapshotDescription> listSnapshots() throws IOException {
  return executeCallable(new MasterCallable<List<SnapshotDescription>>(getConnection()) {
    @Override
    public List<SnapshotDescription> call(int callTimeout) throws ServiceException {
      return master.getCompletedSnapshots(null, GetCompletedSnapshotsRequest.newBuilder().build())
          .getSnapshotsList();
    }
  });
}
项目:c5    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testGetCompletedSnapshots() throws Exception {
  // first check when there are no snapshots
  GetCompletedSnapshotsRequest request = GetCompletedSnapshotsRequest.newBuilder().build();
  GetCompletedSnapshotsResponse response = master.getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());

  // write one snapshot to the fs
  String snapshotName = "completed";
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // check that we get one snapshot
  response = master.getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 1, response.getSnapshotsCount());
  List<SnapshotDescription> snapshots = response.getSnapshotsList();
  List<SnapshotDescription> expected = Lists.newArrayList(snapshot);
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);

  // write a second snapshot
  snapshotName = "completed_two";
  snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
  expected.add(snapshot);

  // check that we get one snapshot
  response = master.getCompletedSnapshots(null, request);
  assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
  snapshots = response.getSnapshotsList();
  assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);
}
项目:c5    文件:HBaseAdmin.java   
/**
 * List completed snapshots.
 * @return a list of snapshot descriptors for completed snapshots
 * @throws IOException if a network error occurs
 */
public List<SnapshotDescription> listSnapshots() throws IOException {
  return executeCallable(new MasterCallable<List<SnapshotDescription>>(getConnection()) {
    @Override
    public List<SnapshotDescription> call() throws ServiceException {
      return master.getCompletedSnapshots(null, GetCompletedSnapshotsRequest.newBuilder().build())
          .getSnapshotsList();
    }
  });
}