Search in sources :

Example 1 with RawBookieInfo

use of org.apache.pulsar.common.policies.data.RawBookieInfo in project pulsar by apache.

the class Bookies method getAllBookies.

@GET
@Path("/all")
@ApiOperation(value = "Gets raw information for all the bookies in the cluster", response = BookiesClusterInfo.class)
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission") })
public BookiesClusterInfo getAllBookies() throws Exception {
    validateSuperUserAccess();
    BookKeeper bookKeeper = bookKeeper();
    MetadataClientDriver metadataClientDriver = bookKeeper.getMetadataClientDriver();
    RegistrationClient registrationClient = metadataClientDriver.getRegistrationClient();
    Set<BookieId> allBookies = registrationClient.getAllBookies().get().getValue();
    List<RawBookieInfo> result = new ArrayList<>(allBookies.size());
    for (BookieId bookieId : allBookies) {
        RawBookieInfo bookieInfo = new RawBookieInfo(bookieId.toString());
        result.add(bookieInfo);
    }
    return BookiesClusterInfo.builder().bookies(result).build();
}
Also used : BookieId(org.apache.bookkeeper.net.BookieId) RawBookieInfo(org.apache.pulsar.common.policies.data.RawBookieInfo) RegistrationClient(org.apache.bookkeeper.discover.RegistrationClient) ArrayList(java.util.ArrayList) BookKeeper(org.apache.bookkeeper.client.BookKeeper) MetadataClientDriver(org.apache.bookkeeper.meta.MetadataClientDriver) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 2 with RawBookieInfo

use of org.apache.pulsar.common.policies.data.RawBookieInfo in project incubator-pulsar by apache.

the class Bookies method getAllBookies.

@GET
@Path("/all")
@ApiOperation(value = "Gets raw information for all the bookies in the cluster", response = BookiesClusterInfo.class)
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission") })
public BookiesClusterInfo getAllBookies() throws Exception {
    validateSuperUserAccess();
    BookKeeper bookKeeper = bookKeeper();
    MetadataClientDriver metadataClientDriver = bookKeeper.getMetadataClientDriver();
    RegistrationClient registrationClient = metadataClientDriver.getRegistrationClient();
    Set<BookieId> allBookies = registrationClient.getAllBookies().get().getValue();
    List<RawBookieInfo> result = new ArrayList<>(allBookies.size());
    for (BookieId bookieId : allBookies) {
        RawBookieInfo bookieInfo = new RawBookieInfo(bookieId.toString());
        result.add(bookieInfo);
    }
    return BookiesClusterInfo.builder().bookies(result).build();
}
Also used : BookieId(org.apache.bookkeeper.net.BookieId) RawBookieInfo(org.apache.pulsar.common.policies.data.RawBookieInfo) RegistrationClient(org.apache.bookkeeper.discover.RegistrationClient) ArrayList(java.util.ArrayList) BookKeeper(org.apache.bookkeeper.client.BookKeeper) MetadataClientDriver(org.apache.bookkeeper.meta.MetadataClientDriver) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 3 with RawBookieInfo

use of org.apache.pulsar.common.policies.data.RawBookieInfo in project pulsar by yahoo.

the class Bookies method getAllBookies.

@GET
@Path("/all")
@ApiOperation(value = "Gets raw information for all the bookies in the cluster", response = BookiesClusterInfo.class)
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission") })
public BookiesClusterInfo getAllBookies() throws Exception {
    validateSuperUserAccess();
    BookKeeper bookKeeper = bookKeeper();
    MetadataClientDriver metadataClientDriver = bookKeeper.getMetadataClientDriver();
    RegistrationClient registrationClient = metadataClientDriver.getRegistrationClient();
    Set<BookieId> allBookies = registrationClient.getAllBookies().get().getValue();
    List<RawBookieInfo> result = new ArrayList<>(allBookies.size());
    for (BookieId bookieId : allBookies) {
        RawBookieInfo bookieInfo = new RawBookieInfo(bookieId.toString());
        result.add(bookieInfo);
    }
    return BookiesClusterInfo.builder().bookies(result).build();
}
Also used : BookieId(org.apache.bookkeeper.net.BookieId) RawBookieInfo(org.apache.pulsar.common.policies.data.RawBookieInfo) RegistrationClient(org.apache.bookkeeper.discover.RegistrationClient) ArrayList(java.util.ArrayList) BookKeeper(org.apache.bookkeeper.client.BookKeeper) MetadataClientDriver(org.apache.bookkeeper.meta.MetadataClientDriver) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)3 ApiResponses (io.swagger.annotations.ApiResponses)3 ArrayList (java.util.ArrayList)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 BookKeeper (org.apache.bookkeeper.client.BookKeeper)3 RegistrationClient (org.apache.bookkeeper.discover.RegistrationClient)3 MetadataClientDriver (org.apache.bookkeeper.meta.MetadataClientDriver)3 BookieId (org.apache.bookkeeper.net.BookieId)3 RawBookieInfo (org.apache.pulsar.common.policies.data.RawBookieInfo)3