All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yamcs.client.storage.Bucket Maven / Gradle / Ivy

The newest version!
package org.yamcs.client.storage;

import java.util.concurrent.CompletableFuture;

import org.yamcs.client.base.ResponseObserver;
import org.yamcs.protobuf.BucketsApiClient;
import org.yamcs.protobuf.ListObjectsRequest;
import org.yamcs.protobuf.ListObjectsResponse;

public class Bucket {

    private BucketsApiClient bucketService;
    private String bucket;

    Bucket(BucketsApiClient bucketService, String bucket) {
        this.bucketService = bucketService;
        this.bucket = bucket;
    }

    public CompletableFuture listObjects(String prefix) {
        ListObjectsRequest.Builder requestb = ListObjectsRequest.newBuilder()
                .setInstance("_global")
                .setBucketName(bucket)
                .setDelimiter("/");
        if (prefix != null) {
            requestb.setPrefix(prefix);
        }
        CompletableFuture f = new CompletableFuture<>();
        bucketService.listObjects(null, requestb.build(), new ResponseObserver<>(f));
        return f;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy